List of usage examples for java.lang Long Long
@Deprecated(since = "9") public Long(String s) throws NumberFormatException
From source file:io.selendroid.server.handler.AddCookie.java
@Override public Response safeHandle(HttpRequest request) throws JSONException { Date expiry = null;//from w w w.j a v a 2 s .c om SelendroidLogger.info("set cookie to a session command"); String url = getSelendroidDriver(request).getCurrentUrl(); JSONObject cookie = getPayload(request).getJSONObject("cookie"); String name = cookie.get("name").toString(); String value = cookie.get("value").toString(); if (cookie.has("expiry")) { expiry = new Date(new Long(cookie.get("expiry").toString())); } Cookie cookie1 = new Cookie(name, value, "/", expiry); getSelendroidDriver(request).addCookie(url, cookie1); return new SelendroidResponse(getSessionId(request), ""); }
From source file:cz.muni.fi.pa165.rentalofconstructionmachinery.dao.MachineDAOTest.java
@Test public void testCreateMachineWithId() { Long id = new Long(3141592); machine.setId(id);// w ww . j a v a 2s.co m try { mDAO.createMachine(machine); fail("Machine with artifical Id should not be created."); } catch (Exception e) { } }
From source file:nc.noumea.mairie.appock.core.utility.AppockUtilTest.java
@Test public void sameIdNotNull() { Assert.assertTrue(AppockUtil.sameIdAndNotNull(new Long(0), new Long(0))); Assert.assertTrue(AppockUtil.sameIdAndNotNull(new Long(100), new Long(100))); Assert.assertFalse(AppockUtil.sameIdAndNotNull(new Long(100), new Long(10000))); Assert.assertFalse(AppockUtil.sameIdAndNotNull(new Long(100), null)); Assert.assertFalse(AppockUtil.sameIdAndNotNull(null, new Long(100))); Assert.assertFalse(AppockUtil.sameIdAndNotNull(null, new Long(0))); }
From source file:io.apiman.test.policies.EchoBackEndService.java
/** * @see io.apiman.test.policies.IPolicyTestBackEndService#invoke(io.apiman.gateway.engine.beans.ServiceRequest, byte[]) *///from w w w . j a v a 2s. co m @Override public PolicyTestBackEndServiceResponse invoke(ServiceRequest request, byte[] requestBody) { try { EchoResponse echoResponse = new EchoResponse(); if (requestBody != null) { echoResponse.setBodyLength(new Long(requestBody.length)); echoResponse.setBodySha1(DigestUtils.sha1Hex(requestBody)); } echoResponse.setCounter(counter++); echoResponse.setHeaders(request.getHeaders()); echoResponse.setMethod(request.getType()); echoResponse.setResource(request.getDestination()); echoResponse.setUri("urn:" + request.getDestination()); //$NON-NLS-1$ ServiceResponse serviceResponse = new ServiceResponse(); serviceResponse.setCode(200); serviceResponse.setMessage("OK"); //$NON-NLS-1$ serviceResponse.getHeaders().put("Date", new Date().toString()); //$NON-NLS-1$ serviceResponse.getHeaders().put("Server", "apiman.policy-test"); //$NON-NLS-1$ //$NON-NLS-2$ serviceResponse.getHeaders().put("Content-Type", "application/json"); //$NON-NLS-1$ //$NON-NLS-2$ String responseBody = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(echoResponse); serviceResponse.getHeaders().put("Content-Length", String.valueOf(responseBody.length())); //$NON-NLS-1$ PolicyTestBackEndServiceResponse response = new PolicyTestBackEndServiceResponse(serviceResponse, responseBody); return response; } catch (IOException e) { throw new RuntimeException(e); } }
From source file:Crypt.java
private Crypt() { DESKeySpec dk;// w ww . j ava 2 s. c om try { dk = new DESKeySpec(new Long(serialVersionUID).toString().getBytes()); SecretKeyFactory kf = SecretKeyFactory.getInstance("DES"); secretKey = kf.generateSecret(dk); } catch (Exception e) { log.error("", e); } }
From source file:io.vertx.tempmail.TempMailOptions.java
public TempMailOptions() { jsonObject.put(CHECK_PERIOD, new Long(30000)); }
From source file:com.fusesource.forge.jmstest.peristence.ProbeAwarePeristenceAdapter.java
public void setStartTime(long startTime) { this.startTime = new Long(startTime); }
From source file:io.apiman.test.policies.EchoBackEndApi.java
/** * @see io.apiman.test.policies.IPolicyTestBackEndApi#invoke(io.apiman.gateway.engine.beans.ApiRequest, byte[]) *//*w ww . j ava2s . co m*/ @Override public PolicyTestBackEndApiResponse invoke(ApiRequest request, byte[] requestBody) { try { EchoResponse echoResponse = new EchoResponse(); if (requestBody != null) { echoResponse.setBodyLength(new Long(requestBody.length)); echoResponse.setBodySha1(DigestUtils.sha1Hex(requestBody)); } echoResponse.setCounter(counter++); echoResponse.setHeaders(request.getHeaders().toMap()); echoResponse.setMethod(request.getType()); echoResponse.setResource(request.getDestination()); echoResponse.setUri("urn:" + request.getDestination()); ApiResponse apiResponse = new ApiResponse(); String errorCode = request.getHeaders().get("X-Echo-ErrorCode"); if (errorCode != null) { int ec = new Integer(errorCode); String errorMsg = request.getHeaders().get("X-Echo-ErrorMessage"); apiResponse.setCode(ec); apiResponse.setMessage(errorMsg); } else { apiResponse.setCode(200); apiResponse.setMessage("OK"); } apiResponse.getHeaders().put("Date", new Date().toString()); apiResponse.getHeaders().put("Server", "apiman.policy-test"); apiResponse.getHeaders().put("Content-Type", "application/json"); String responseBody = normalize( mapper.writerWithDefaultPrettyPrinter().writeValueAsString(echoResponse)); apiResponse.getHeaders().put("Content-Length", String.valueOf(responseBody.length())); PolicyTestBackEndApiResponse response = new PolicyTestBackEndApiResponse(apiResponse, responseBody); return response; } catch (IOException e) { throw new RuntimeException(e); } }
From source file:dao.MykeywordsAddQuery.java
/** * Method is used to insert mykeywords/*from w ww .ja v a 2 s . co m*/ * @param conn - the connection1 * @param keywords - the keywords * @param loginid - the loginid **/ public void run(Connection conn, String keyword, String loginid) throws BaseDaoException { Long myloginid = new Long(loginid); try { PreparedStatement stmt = conn .prepareStatement("insert into mykeywords values(" + myloginid + ", '" + keyword + "')"); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing MykeywordsAddQuery ", e); throw new BaseDaoException("Error occured while executing MykeywordsAddQuery ", e); } }
From source file:com.redhat.rhn.manager.kickstart.IpAddress.java
/** * * @param ipIn Ip Address in String Form */// ww w. j a v a2 s. c o m public IpAddress(String ipIn) { this(); if (StringUtils.isEmpty(ipIn)) { throw new InvalidIpAddressException(StringUtils.defaultString(ipIn)); } String[] soctets = StringUtils.split(ipIn, "."); if (soctets.length == 4) { try { for (int i = 0; i < 4; i++) { setOctet(i, new Long(soctets[i])); } } catch (NumberFormatException num) { throw new InvalidIpAddressException(ipIn); } } else { throw new InvalidIpAddressException(ipIn); } }