List of usage examples for java.util List toString
public String toString()
From source file:com.trenako.utility.CatTests.java
@Test public void shouldListAllTheCategoryLabelsByPowerMethod() { messageSource = mock(MessageSource.class); Iterable<Cat> cat = Cat.list(PowerMethod.AC, messageSource); List<Cat> l = (List<Cat>) cat; String expected = "[ac-steam-locomotives, ac-diesel-locomotives, " + "ac-electric-locomotives, ac-railcars, ac-electric-multiple-unit, " + "ac-freight-cars, ac-passenger-cars, ac-train-sets, ac-starter-sets]"; assertEquals(expected, l.toString()); }
From source file:org.esupportail.pushnotification.service.Ldap.java
public List<LdapUser> getLdapUsersByGroupId(final String groupId) throws LdapGroupNotFoundException, LdapUserNotFoundException, NullPointerException { logger.info("Entree dans getLdapUsersByGroupId"); logger.info("Le group a chercher est : " + groupId); List<LdapUser> ldapUserList = null; try {//from w w w .j av a 2s . c om logger.info("Entree dans try"); LdapGroup ldapGroup = ldapGroupMembersService.getLdapGroup(groupId); logger.info("ldapGroup => " + ldapGroup.toString()); List<LdapUser> users = this.getMembers(ldapGroup); logger.info(users.toString()); // logger.info("Groupe trouve : " + ldapGroup.toString()); // // List<String> membres = this.getMemberIds(ldapGroup.getId()); // // logger.info("Liste des membres du groupe :"); // for(String login : membres){ // logger.info("Login : " + login); // } // // ldapUserList = this.getMembers(ldapGroup); // // logger.info("Nombre de membres trouve : " + ldapUserList.size()); // // logger.info("Listing des membres du groupe : "); // // for(LdapUser ldapUser : ldapUserList){ // // logger.info("Login : " + ldapUser.getId() + " \n mail : " + ldapUser.getAttribute("mail")); // } // //// for (String user : membres){ //// logger.info("User : " + user); //// } // } catch (GroupNotFoundException e) { LdapGroupNotFoundException(e, groupId); } return ldapUserList; }
From source file:org.tomitribe.tribestream.registryng.resources.RegistryResourceTest.java
@Test @Retry//from w w w. j av a 2s . c o m public void drillDown() { final List<Endpoint> endpoints = em.createQuery("select e from Endpoint e", Endpoint.class).getResultList(); final SearchPage root = registry.target().path("api/registry").request(MediaType.APPLICATION_JSON_TYPE) .get(SearchPage.class); assertEquals(endpoints.toString() + "\n\n" + root.getResults(), endpoints.size(), root.getTotal()); final SearchPage withTag = registry.target().path("api/registry").queryParam("tag", "user") .request(MediaType.APPLICATION_JSON_TYPE).get(SearchPage.class); assertEquals(2, withTag.getTotal()); final SearchPage withTagAndCategory = registry.target().path("api/registry").queryParam("tag", "user") .queryParam("category", "partners").request(MediaType.APPLICATION_JSON_TYPE).get(SearchPage.class); assertEquals(1, withTagAndCategory.getTotal()); }
From source file:info.novatec.testit.livingdoc.interpreter.collection.CollectionInterpreter.java
private List<?> getCollectionProvider() { LOG.trace(ENTRY);//from w ww . j a v a2 s . c o m Object target = fixture.getTarget(); for (Method method : target.getClass().getMethods()) { if (method.isAnnotationPresent(CollectionProvider.class)) { List<?> result = toList(invoke(target, method)); LOG.trace(EXIT_WITH, result.toString()); return result; } } LOG.trace(EXIT_WITH_NULL); return null; }
From source file:com.haulmont.cuba.core.app.entitysql.EntitySqlGenerator.java
protected String convertList(List<String> strings) { String string = strings.toString(); return string.substring(1, string.length() - 1); }
From source file:net.syscrest.clouderamanager.hipchat.HipchatWebhookController.java
@SuppressWarnings("unchecked") @RequestMapping("/hipchat-webhook") public Message processMessage(@RequestBody String messagePayload) { logger.info("messagePayload = " + messagePayload); try {/*from www . jav a 2s. com*/ Map<String, Object> map = mapper.readValue(messagePayload, HashMap.class); int roomIdReceived = (Integer) ((Map<String, Object>) ((Map<String, Object>) map.get("item")) .get("room")).get("id"); if (roomIdReceived != whConf.roomId) { logger.debug("room id from request = " + roomIdReceived); logger.debug("required room id is = " + whConf.roomId); logger.warn("room ids does not match, denying command"); return new Message("Not authorized, roomIds do not match!"); } String message = (String) ((Map<String, Object>) ((Map<String, Object>) map.get("item")).get("message")) .get("message"); logger.info(" message is = " + message); String[] messageParts = message.split(" ", -1); if (messageParts.length == 2 && messageParts[1].equalsIgnoreCase("help")) { List<String> availableCommands = new ArrayList<String>(); for (BaseMessageHandler handler : handlers) { availableCommands.addAll(handler.listAllCommands(apiRoot)); } return new Message("available commands: " + availableCommands.toString()); } for (BaseMessageHandler handler : handlers) { Message msg = handler.processMessage(messageParts, apiRoot); if (msg != null) { return msg; } } logger.warn("message does not match on handler " + message); return new Message(BaseMessageHandler.BAD_MESSAGE_RESPONSE); } catch (IOException e) { logger.error("", e); return new Message("unexpected exception while processing message (" + e.getClass().getName() + " - " + e.getMessage() + ")"); } }
From source file:es.upm.fiware.rss.expenditureLimit.dao.impl.tests.DbeExpendControlDaoTest.java
@Transactional(propagation = Propagation.SUPPORTS) public void testNewExpendLimitDataForaUser() { BmCurrency bmCurrency = new BmCurrency(); bmCurrency.setNuCurrencyId(1);//from w w w. ja va 2 s .co m List<DbeExpendControl> l = expLimitDao.getExpendDataForUserAppProvCurrency("userId01", "agg123", "app123456", bmCurrency); Assert.assertTrue("Elements found before " + l.toString(), l != null && l.size() == 3); Iterator<DbeExpendControl> it = l.iterator(); DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setPropagationBehavior(Propagation.REQUIRES_NEW.value()); TransactionStatus status = transactionManager.getTransaction(def); while (it.hasNext()) { DbeExpendControl el = it.next(); DbeExpendControl neoEc = new DbeExpendControl(); neoEc.setId(new DbeExpendLimitPK()); neoEc.getId().setTxAppProviderId("123456"); neoEc.getId().setTxElType(el.getId().getTxElType()); neoEc.getId().setTxEndUserId("userId101"); neoEc.setDtNextPeriodStart(el.getDtNextPeriodStart()); neoEc.setTxNotifications(el.getTxNotifications()); neoEc.setFtExpensedAmount(el.getFtExpensedAmount()); expLimitDao.saveDbeExpendControl(neoEc); } transactionManager.commit(status); List<DbeExpendControl> l1 = expLimitDao.getExpendDataForUserAppProvCurrency("userId101", "agg123", "123456", bmCurrency); Assert.assertTrue("Elements found after " + l.toString() + " " + l1.toString(), l != null && l.size() == 3); it = l1.iterator(); while (it.hasNext()) { DbeExpendControl el = it.next(); if (!el.getId().getTxAppProviderId().equalsIgnoreCase("123456")) { Assert.fail("Application provider invalid: " + el.getId().getTxAppProviderId()); } if (!el.getId().getTxEndUserId().equalsIgnoreCase("userId101")) { Assert.fail("User invalid: " + el.getId().getTxEndUserId()); } } }
From source file:info.novatec.testit.livingdoc.interpreter.collection.CollectionInterpreter.java
protected List<?> toList(Object results) { LOG.debug(ENTRY_WITH, results);//from w w w . j av a 2 s . c o m if (results instanceof Object[]) { List<?> resultsAsList = Arrays.asList((Object[]) results); LOG.debug(EXIT_WITH, resultsAsList.toString()); return resultsAsList; } if (results instanceof Collection) { List<?> newArrayList = new ArrayList<Object>((Collection<?>) results); LOG.debug(EXIT_WITH, newArrayList.toString()); return newArrayList; } LOG.debug(EXIT_WITH, "null"); return null; }
From source file:it.eng.spagobi.analiticalmodel.document.service.DetailBIObjectModule.java
/** * Controls if there are some BIObjectParameter objects that depend by the BIObjectParameter object * at input, given its id./*from w w w .j ava2 s . co m*/ * * @param objParFatherId The id of the BIObjectParameter object to check * @throws EMFUserError */ public static EMFValidationError checkForDependancies(Integer objParFatherId) throws EMFUserError { EMFValidationError error = null; IObjParuseDAO objParuseDAO = DAOFactory.getObjParuseDAO(); List objParametersCorrelated = objParuseDAO.getDependencies(objParFatherId); if (objParametersCorrelated != null && objParametersCorrelated.size() > 0) { HashMap params = new HashMap(); params.put(AdmintoolsConstants.PAGE, DetailBIObjectModule.MODULE_PAGE); Vector v = new Vector(); v.add(objParametersCorrelated.toString()); error = new EMFValidationError(EMFErrorSeverity.ERROR, 1049, v, params); } return error; }
From source file:com.chinamobile.bcbsp.io.titan.TitanRecordReader.java
/** * get vertex value from titan for hadoop IO * @param vertexID// w w w . ja v a 2 s. c o m * vertexID to get * @return vertex value for hadoop IO */ private Text getValue(long vertexID) { List<Map<String, Object>> result = null; try { result = client.execute("g.V('vertexID','" + vertexID + "').out('outgoing').vertexID"); if (result.toString().length() == 2) { return null; } } catch (RexProException e) { LOG.error("Client of database collapse!"); return null; } catch (IOException e) { LOG.error("Database can not read record!"); return null; } String str = result.toString(); String[] outgoingVertexIDs; if (str.indexOf(",") == -1) { outgoingVertexIDs = new String[1]; outgoingVertexIDs[0] = str.split("\\[")[1].split("\\]")[0]; } else { String[] vertexInfo = str.split(", "); outgoingVertexIDs = new String[vertexInfo.length]; outgoingVertexIDs[0] = vertexInfo[0].split("\\[")[1]; for (int i = 1; i < vertexInfo.length - 1; i++) { outgoingVertexIDs[i] = vertexInfo[i]; } outgoingVertexIDs[vertexInfo.length - 1] = vertexInfo[vertexInfo.length - 1].split("\\]")[0]; } try { result = client.execute("g.V('vertexID','" + vertexID + "').outE.weight"); } catch (RexProException e) { LOG.error("Client of database collapse!"); return null; } catch (IOException e) { LOG.error("Database can not read record!"); return null; } str = result.toString(); String[] outgoingVertexWeight; if (str.indexOf(",") == -1) { outgoingVertexWeight = new String[1]; outgoingVertexWeight[0] = str.split("\\[")[1].split("\\]")[0]; } else { String[] weightInfo = str.split(", "); outgoingVertexWeight = new String[weightInfo.length]; outgoingVertexWeight[0] = weightInfo[0].split("\\[")[1]; for (int i = 1; i < weightInfo.length - 1; i++) { outgoingVertexWeight[i] = weightInfo[i]; } outgoingVertexWeight[weightInfo.length - 1] = weightInfo[weightInfo.length - 1].split("\\]")[0]; } StringBuffer edge = new StringBuffer(); for (int i = 0; i < outgoingVertexIDs.length; i++) { edge.append(outgoingVertexIDs[i] + ":" + outgoingVertexWeight[i] + " "); } return new Text(edge.toString()); }