List of usage examples for java.lang Long toString
public String toString()
From source file:org.araneaframework.tests.framework.filter.StandardTransactionFilterWidgetTests.java
public void testConsistentKeyRoutesProcess() throws Exception { Long key = ((Long) trans.getTransactionId()); req.addParameter(StandardTransactionFilterWidget.TRANSACTION_ID_KEY, key.toString()); StandardServletInputData input = new StandardServletInputData(req); trans._getWidget().update(input);/* www. j a v a 2 s.com*/ trans._getWidget().process(); assertTrue(child.isProcessCalled()); }
From source file:org.flite.cach3.test.l2.L2InvalidateSingleTest.java
@Test public void test() { final TestSvc test = (TestSvc) context.getBean("testSvc"); final String g1 = RandomStringUtils.randomAlphabetic(4) + "-"; final List<Long> ids = new ArrayList<Long>(); final long base = System.currentTimeMillis() - 200000; for (int ix = 0; ix < 10; ix++) { ids.add(base + ix);/*from w ww. ja v a2s .c om*/ } final List<Long> addls = new ArrayList<Long>(); addls.addAll(ids); for (int ix = 0; ix < 10; ix++) { addls.add(1000L + ix); } Collections.shuffle(addls); // Set the base expectations final List<String> first = test.getL2MultiAlpha(addls, g1); for (final String out : first) { assertTrue(out.startsWith(g1)); } // Now call the invalidate for (final Long id : ids) { test.invalidateL2SingleFoxtrot(id); } // Only the invalidated ones should be different. Collections.shuffle(addls); final String g2 = RandomStringUtils.randomAlphabetic(8) + "-"; final List<String> results = test.getL2MultiAlpha(addls, g2); assertTrue(results.size() > 0); for (int ix = 0; ix < addls.size(); ix++) { final Long key = addls.get(ix); final String result = results.get(ix); assertTrue(StringUtils.contains(result, key.toString())); assertTrue("Key: " + key, result.startsWith(ids.contains(key) ? g2 : g1)); } }
From source file:org.flite.cach3.test.l2.L2InvalidateMultiTest.java
@Test public void test() { final TestSvc test = (TestSvc) context.getBean("testSvc"); final String g1 = RandomStringUtils.randomAlphabetic(4) + "-"; final List<Long> ids = new ArrayList<Long>(); final long base = System.currentTimeMillis() - 200000; for (int ix = 0; ix < 10; ix++) { ids.add(base + ix);/* w ww . j a va 2 s. co m*/ } final List<Long> addls = new ArrayList<Long>(); addls.addAll(ids); for (int ix = 0; ix < 10; ix++) { addls.add(1000L + ix); } Collections.shuffle(addls); // Set the base expectations final List<String> first = test.getL2MultiAlpha(addls, g1); for (final String out : first) { assertTrue(out.startsWith(g1)); } // Now call the invalidate test.invalidateL2MultiCharlie(ids); // Only the invalidated ones should be different. Collections.shuffle(addls); final String g2 = RandomStringUtils.randomAlphabetic(8) + "-"; final List<String> results = test.getL2MultiAlpha(addls, g2); assertTrue(results.size() > 0); for (int ix = 0; ix < addls.size(); ix++) { final Long key = addls.get(ix); final String result = results.get(ix); assertTrue(StringUtils.contains(result, key.toString())); assertTrue("Key: " + key, result.startsWith(ids.contains(key) ? g2 : g1)); } }
From source file:org.flite.cach3.test.l2.L2UpdateSingleTest.java
@Test public void test() { final TestSvc test = (TestSvc) context.getBean("testSvc"); final String g1 = RandomStringUtils.randomAlphabetic(4) + "-"; final List<Long> ids = new ArrayList<Long>(); final long base = System.currentTimeMillis(); for (int ix = 0; ix < 10; ix++) { ids.add(base + ix);//from w ww .j a va2 s .c o m } final List<Long> addls = new ArrayList<Long>(); addls.addAll(ids); for (int ix = 0; ix < 10; ix++) { addls.add(1000L + ix); } Collections.shuffle(addls); // Set the base expectations final List<String> first = test.getL2MultiAlpha(addls, g1); for (final String out : first) { assertTrue(out.startsWith(g1)); } // Now call the update final String g2 = RandomStringUtils.randomAlphabetic(6) + "-"; for (final Long id : ids) { final String out = test.getL2SingleEcho(id, g2); assertTrue(out.startsWith(g2)); } // Only the updated ones should be different. Collections.shuffle(addls); final String g3 = RandomStringUtils.randomAlphabetic(8) + "-"; final List<String> results = test.getL2MultiAlpha(addls, g3); assertTrue(results.size() > 0); for (int ix = 0; ix < addls.size(); ix++) { final Long key = addls.get(ix); final String result = results.get(ix); assertTrue(StringUtils.contains(result, key.toString())); assertTrue("Key: " + key, result.startsWith(ids.contains(key) ? g2 : g1)); } }
From source file:de.berlios.gpon.service.data.validation.DefaultDataValidator.java
public DataValidationError[] validate(Item pItem) { ItemMappedById mappedItem = new ItemMappedById(pItem); List errors = new ArrayList(); Iterator declIt = pItem.getItemType().getInheritedItemPropertyDecls().iterator(); while (declIt.hasNext()) { ItemPropertyDecl itemPropertyDecl = (ItemPropertyDecl) declIt.next(); // MappedItem: DeclId.toString() -> property Long declIdKey = itemPropertyDecl.getId(); if (mappedItem.hasProperty(declIdKey.toString())) { Value value = mappedItem.getValueObject(declIdKey.toString()); if (value == null || value.getInput().trim().length() == 0) { // no value, but mandatory if (itemPropertyDecl.getMandatory().equals(Boolean.TRUE)) { errors.add(new DataValidationError(DataValidationError.MANDATORY_FIELD_ERROR, new Object[] { itemPropertyDecl })); }/*from w w w . j a va 2 s . c om*/ } else { // value is set // construct a typed object try { value.validate(); } catch (ValueTypeValidationException ex) { errors.add(new DataValidationError(DataValidationError.FIELD_VALIDATION_ERROR, new Object[] { value, ex.getCause().getClass().getName() + ":" + ex.getCause().getMessage() })); log.error("Validation exception:", ex); } catch (Exception ex) { log.error("Property type validation error.", ex); } } } else { // item property not present (in hash) if (itemPropertyDecl.getMandatory().equals(Boolean.TRUE)) { // property not set, but mandatory errors.add(new DataValidationError(DataValidationError.MANDATORY_FIELD_ERROR, new Object[] { itemPropertyDecl })); } } } if (errors.size() > 0) { return (DataValidationError[]) errors.toArray(new DataValidationError[0]); } return null; }
From source file:org.flite.cach3.test.l2.L2UpdateMultiTest.java
@Test public void test() { final TestSvc test = (TestSvc) context.getBean("testSvc"); final String g1 = RandomStringUtils.randomAlphabetic(4) + "-"; final List<Long> ids = new ArrayList<Long>(); final long base = System.currentTimeMillis() - 200000; for (int ix = 0; ix < 10; ix++) { ids.add(base + ix);// w w w . jav a2s. c om } final List<Long> addls = new ArrayList<Long>(); addls.addAll(ids); for (int ix = 0; ix < 10; ix++) { addls.add(1000L + ix); } Collections.shuffle(addls); // Set the base expectations final List<String> first = test.getL2MultiAlpha(addls, g1); for (final String out : first) { assertTrue(out.startsWith(g1)); } // Now call the update final String g2 = RandomStringUtils.randomAlphabetic(6) + "-"; final List<String> second = test.getL2MultiBeta(ids, g2); for (final String out : second) { assertTrue(out.startsWith(g2)); } // Only the updated ones should be different. Collections.shuffle(addls); final String g3 = RandomStringUtils.randomAlphabetic(8) + "-"; final List<String> results = test.getL2MultiAlpha(addls, g3); assertTrue(results.size() > 0); for (int ix = 0; ix < addls.size(); ix++) { final Long key = addls.get(ix); final String result = results.get(ix); assertTrue(StringUtils.contains(result, key.toString())); assertTrue("Key: " + key, result.startsWith(ids.contains(key) ? g2 : g1)); } }
From source file:org.syncope.console.rest.ConnectorRestClient.java
public void delete(Long id) { restTemplate.delete(baseURL + "connector/delete/{connectorId}.json", id.toString()); }
From source file:fi.vm.sade.organisaatio.service.oid.OrganisaatioOIDServiceImpl.java
private int luhnChecksum(Long oid) { String oidStr = oid.toString(); int sum = 0;//from www .ja v a2 s . c om boolean alternate = false; for (int i = oidStr.length() - 1; i >= 0; i--) { int n = Integer.parseInt(oidStr.substring(i, i + 1)); if (alternate) { n *= 2; if (n > 9) { n = (n % 10) + 1; } } sum += n; alternate = !alternate; } return sum % 10; }
From source file:net.nelz.simplesm.test.dao.TestDAOImpl.java
@ReadThroughMultiCache(namespace = "Bravo", expiration = 300) public List<String> getTimestampValues(@ParameterValueKeyProvider final List<Long> keys) { final List<String> results = new ArrayList<String>(); try {//from ww w . j a v a 2 s . co m Thread.sleep(1500); } catch (InterruptedException ex) { } final Long now = new Date().getTime(); for (final Long key : keys) { results.add(now.toString() + "-X-" + key.toString()); } return results; }
From source file:com.redhat.rhn.frontend.taglibs.list.helper.ListRhnSetHelper.java
/** {@inheritDoc} */ protected Map getSelections() { Map<String, String> selections = new HashMap<String, String>(); for (Long id : set.getElementValues()) { selections.put(id.toString(), id.toString()); }//w ww . j a v a 2s. c o m return selections; }