List of usage examples for java.util List toString
public String toString()
From source file:com.symbian.driver.plugins.ftptelnet.test.FtpTransferTest.java
public final void testDir() { FtpTransfer lSession = FtpTransfer.getInstance("tcp:192.168.0.3:21"); List<File> lFiles = lSession.dir(new File("something wrong")); if (!lFiles.isEmpty()) { fail("dir returned a list of files from a non existing dir."); }//from w w w.j a va 2 s . c o m assertTrue(lSession.send(iSmallTextFile, new File(iDeepRemoteFolder, iSmallTextFile.getName()))); assertTrue(lSession.send(iSmallTextFile, new File(iRemoteFolder, iSmallTextFile.getName()))); assertTrue(lSession.send(iSmallTextFile, new File(iRemoteFolder, "second" + iSmallTextFile.getName()))); assertTrue(lSession.send(ismallBinFile, new File(iRemoteFolder, ismallBinFile.getName()))); lFiles = lSession.dir(new File("/")); System.out.println(lFiles.toString()); lFiles = lSession.dir(iRemoteFolder); System.out.println(lFiles.toString()); lFiles = lSession.dir(new File(iRemoteFolder, "level2")); System.out.println(lFiles.toString()); lFiles = lSession.dir(iDeepRemoteFolder); System.out.println(lFiles.toString()); lFiles = lSession.dir(new File(iRemoteFolder, "*.txt")); System.out.println(lFiles.toString()); }
From source file:eu.eubrazilcc.lvl.storage.ResourceOwnerCollectionTest.java
@Test public void test() { System.out.println("ResourceOwnerCollectionTest.test()"); try {//www. java 2 s . c o m final Collection<String> roles = newArrayList("role1", "role2"); final Collection<String> permissions = newArrayList("sequences:leishmania:public:*:view", "sequences:sandflies:public:*:view"); // insert (no salt) final ResourceOwner resourceOwner = ResourceOwner.builder() .user(User.builder().userid("username").password("password").email("username@example.com") .firstname("firstname").lastname("lastname").roles(roles).permissions(permissions) .build()) .build(); WriteResult<ResourceOwner> result = RESOURCE_OWNER_DAO.insert(resourceOwner); assertThat("insert resource owner result is not null", result, notNullValue()); assertThat("insert resource owner result id is not null", result.getId(), notNullValue()); assertThat("insert resource owner result id is not empty", isNotBlank(result.getId()), equalTo(true)); assertThat("insert resource owner result element is not null", result.getElement(), notNullValue()); assertThat("insert resource owner result user is not null", result.getElement().getUser(), notNullValue()); assertThat("insert resource owner result hashed password", result.getElement().getUser().getPassword(), notNullValue()); assertThat("insert resource owner result hashed password", isNotBlank(result.getElement().getUser().getPassword()), equalTo(true)); assertThat("insert resource owner result salt", result.getElement().getUser().getSalt(), notNullValue()); assertThat("insert resource owner result salt", isNotBlank(result.getElement().getUser().getSalt()), equalTo(true)); assertThat("inserted resource owner coincides with original (ignoring password & salt)", resourceOwner.equalsToUnprotected(result.getElement()), equalTo(true)); final ResourceOwner hashed = result.getElement(); // find (no salt) ResourceOwner resourceOwner2 = RESOURCE_OWNER_DAO.find(resourceOwner.getOwnerId()); assertThat("resource owner is not null", resourceOwner2, notNullValue()); assertThat("resource owner coincides with original", resourceOwner2, equalTo(hashed)); System.out.println(resourceOwner2.toString()); // find (no salt) with volatile values resourceOwner2 = RESOURCE_OWNER_DAO.useGravatar(true).find(resourceOwner.getOwnerId()); assertThat("resource owner with volatile values is not null", resourceOwner2, notNullValue()); assertThat("resource owner links are null", resourceOwner2.getUser().getLinks(), nullValue()); assertThat("resource owner picture URL is not null", resourceOwner2.getUser().getPictureUrl(), notNullValue()); assertThat("resource owner picture URL is not empty", isNotBlank(resourceOwner2.getUser().getPictureUrl())); assertThat("resource owner with volatile values coincides with original", resourceOwner2.getUser().equalsIgnoringVolatile(hashed.getUser())); System.out.println(resourceOwner2.toString()); // insert element with hard link final ResourceOwner resourceOwner1 = ResourceOwner.builder() .user(User.builder() .links(newArrayList(Link.fromUri("http://example.com/users/username1").rel(SELF) .type(APPLICATION_JSON).build())) .userid("username1").password("password1").email("username1@example.com") .firstname("Firstname 1").lastname("Lastname 1").roles(roles).permissions(permissions) .build()) .build(); result = RESOURCE_OWNER_DAO.insert(resourceOwner1); resourceOwner1.getUser().setLinks(null); assertThat("resource owner result inserted with hard link is not null", result, notNullValue()); assertThat("resource owner inserted with hard link is not null", result.getElement(), notNullValue()); assertThat("resource owner inserted with hard link coincides with original (ignoring password & salt)", resourceOwner1.equalsToUnprotected(result.getElement()), equalTo(true)); System.out.println(resourceOwner2.toString()); RESOURCE_OWNER_DAO.delete(resourceOwner1.getOwnerId()); // update final String plainPassword = "new_password"; updatePassword(hashed, plainPassword); RESOURCE_OWNER_DAO.update(hashed); // find after update resourceOwner2 = RESOURCE_OWNER_DAO.reset().find(resourceOwner.getOwnerId()); assertThat("resource owner is not null", resourceOwner2, notNullValue()); assertThat("resource owner coincides with original", resourceOwner2, equalTo(hashed)); System.out.println(resourceOwner2.toString()); // check validity using owner Id and username AtomicReference<String> ownerIdRef = new AtomicReference<String>(); boolean validity = RESOURCE_OWNER_DAO.isValid(hashed.getOwnerId(), hashed.getUser().getUserid(), plainPassword, false, null, ownerIdRef); assertThat("resource owner is valid (using owner Id & username)", validity, equalTo(true)); assertThat("resource owner Id passed as reference coincides with expected", ownerIdRef.get(), equalTo(hashed.getOwnerId())); // check validity using email address ownerIdRef = new AtomicReference<String>(); validity = RESOURCE_OWNER_DAO.isValid(null, hashed.getUser().getEmail(), plainPassword, true, null, ownerIdRef); assertThat("resource owner is valid (using email)", validity, equalTo(true)); assertThat("resource owner Id passed as reference coincides with expected", ownerIdRef.get(), equalTo(hashed.getOwnerId())); // add roles RESOURCE_OWNER_DAO.addRoles(resourceOwner.getOwnerId(), "role3"); // remove roles RESOURCE_OWNER_DAO.removeRoles(resourceOwner.getOwnerId(), "role2"); // test listing unexisting shared datasets List<DatasetShare> shares = RESOURCE_OWNER_DAO.listDatashares("otheruser@lvl", "mysequences.xml", 0, Integer.MAX_VALUE, null, null, null); assertThat("dataset shares is null", shares, notNullValue()); assertThat("dataset shares is empty", shares.isEmpty(), equalTo(true)); // uncomment for additional output System.out.println(" >> Dataset shares (before permissions are granted): " + shares.toString()); // share dataset by adding permissions to resource owner RESOURCE_OWNER_DAO.addPermissions(resourceOwner.getOwnerId(), "datasets:files:otheruser@lvl:mysequences.xml:view"); resourceOwner2 = RESOURCE_OWNER_DAO.reset().find(resourceOwner.getOwnerId()); assertThat("resource owner is not null", resourceOwner2, notNullValue()); // uncomment for additional output System.out.println(" >> Owner with permissions to view shared dataset: " + resourceOwner2.toString()); // test listing shared datasets shares = RESOURCE_OWNER_DAO.listDatashares("otheruser@lvl", "mysequences.xml", 0, Integer.MAX_VALUE, null, null, null); assertThat("dataset shares is not null", shares, notNullValue()); assertThat("number of dataset shares coincides with expected", shares.size(), equalTo(1)); // uncomment for additional output System.out.println(" >> Dataset shares (after permissions are granted): " + shares.toString()); // insert redundant permissions RESOURCE_OWNER_DAO.addPermissions(resourceOwner.getOwnerId(), "datasets:files:otheruser@lvl:mysequences.xml:view,edit"); // test getting information about a specific share DatasetShare share = RESOURCE_OWNER_DAO.findDatashare("otheruser@lvl", "mysequences.xml", resourceOwner.getOwnerId()); assertThat("dataset share is not null", share, notNullValue()); // uncomment for additional output System.out.println(" >> Dataset share (after adding redundant permissions): " + share.toString()); // test modifying a share // not available // remove all permissions and stop sharing RESOURCE_OWNER_DAO.removePermissions(resourceOwner.getOwnerId(), "datasets:files:otheruser@lvl:mysequences.xml:view", "datasets:files:otheruser@lvl:mysequences.xml:view,edit"); shares = RESOURCE_OWNER_DAO.listDatashares("otheruser@lvl", "mysequences.xml", 0, Integer.MAX_VALUE, null, null, null); assertThat("dataset shares is null", shares, notNullValue()); assertThat("dataset shares is empty", shares.isEmpty(), equalTo(true)); // uncomment for additional output System.out.println(" >> Dataset shares (after permissions are removed): " + shares.toString()); // get OAuth scope resourceOwner2 = RESOURCE_OWNER_DAO.find(resourceOwner.getOwnerId()); final String oauthScope = ResourceOwnerDAO.oauthScope(resourceOwner2, true); assertThat("resource owner OAuth scope is not null", oauthScope, notNullValue()); assertThat("resource owner OAuth scope is not blank", isNotBlank(oauthScope)); assertThat("resource owner OAuth scope coincided with expected", oauthScope, equalTo("role1 role3")); System.out.println("OAuth scope: '" + oauthScope + "'"); // remove (default LVL administrator is not removed) RESOURCE_OWNER_DAO.delete(resourceOwner.getOwnerId()); final long numRecords = RESOURCE_OWNER_DAO.count(); assertThat("number of resource owners stored in the database coincides with expected", numRecords, equalTo(1l)); // insert (with salt) result = RESOURCE_OWNER_DAO.insert(hashed); assertThat("insert resource owner result (with salt) is not null", result, notNullValue()); assertThat("insert resource owner result (with salt) id is not null", result.getId(), notNullValue()); assertThat("insert resource owner result (with salt) id is not empty", isNotBlank(result.getId()), equalTo(true)); // find (with salt) resourceOwner2 = RESOURCE_OWNER_DAO.find(hashed.getOwnerId()); assertThat("resource owner (with salt) is not null", resourceOwner2, notNullValue()); assertThat("resource owner (with salt) coincides with original", resourceOwner2, equalTo(hashed)); System.out.println(resourceOwner2.toString()); // pagination final List<String> ids = newArrayList(); for (int i = 0; i < 11; i++) { final ResourceOwner resourceOwner3 = ResourceOwner.builder() .user(User.builder().userid(Integer.toString(i)).password("password") .email("username" + i + "@example.com").firstname("Firstname").lastname("Lastname") .roles(roles).permissions(permissions).build()) .build(); ids.add(resourceOwner3.getOwnerId()); RESOURCE_OWNER_DAO.insert(resourceOwner3); } final int size = 3; int start = 0; List<ResourceOwner> resourceOwners = null; final MutableLong count = new MutableLong(0l); do { resourceOwners = RESOURCE_OWNER_DAO.list(start, size, null, null, null, count); if (resourceOwners.size() != 0) { System.out.println("Paging: first item " + start + ", showing " + resourceOwners.size() + " of " + count.getValue() + " items"); } start += resourceOwners.size(); } while (!resourceOwners.isEmpty()); for (final String id2 : ids) { RESOURCE_OWNER_DAO.delete(id2); } RESOURCE_OWNER_DAO.stats(System.out); } catch (Exception e) { e.printStackTrace(System.err); fail("ResourceOwnerCollectionTest.test() failed: " + e.getMessage()); } finally { System.out.println("ResourceOwnerCollectionTest.test() has finished"); } }
From source file:com.taobao.android.FastPatchTool.java
private boolean isEqualObj(List<? extends CharSequence> parameters, List<? extends CharSequence> modifyParameters) { if (parameters.size() != modifyParameters.size()) { return false; }//from w w w. j a va2s. co m if (!parameters.toString().equals(modifyParameters.toString())) { return false; } return true; }
From source file:edu.cornell.mannlib.vitro.webapp.rdfservice.filter.LanguageFilteringRDFService.java
private String showSortedStatements(List<Statement> candidatesForRemoval) { List<String> langStrings = new ArrayList<String>(); for (Statement stmt : candidatesForRemoval) { if (stmt == null) { langStrings.add("null stmt"); } else {// w w w . ja v a2s. c o m RDFNode node = stmt.getObject(); if (!node.isLiteral()) { langStrings.add("not literal"); } else { langStrings.add(node.asLiteral().getLanguage()); } } } return langStrings.toString(); }
From source file:com.vodafone360.people.service.transport.http.HttpConnectionThread.java
/** * Adds a response to the response decoder. * /* w w w. ja v a 2s . c o m*/ * @param input The data of the response. * @param reqIds The request IDs that a response was received for. */ private void addToDecoder(byte[] input, List<Integer> reqIds) { if (input != null && mDecoder != null) { int reqId = reqIds.size() > 0 ? reqIds.get(0) : 0; mDecoder.addToDecode(new RawResponse(reqId, input, false, false)); logI("RpgHttpConnectionThread.handleApiResponse()", "Added response(s) to decoder: " + reqIds.toString()); } }
From source file:com.epam.gepard.rest.jira.JiraSiteHandler.java
/** * Detect the actual workflow possibilities of the ticket, from its actual status. * * @param ticket is the id//from ww w. j av a 2s . com * @return with String representation of the list of possibilities, in form of statusTransferId;newStatusName strings * @throws IOException in case of problem * @throws JSONException in case of problem */ public String detectWorkflow(final String ticket) throws IOException, JSONException { String jqlURL; //first detect status String ticketFields = getTicketFields(ticket); JSONObject fieldObj = new JSONObject(ticketFields); fieldObj = fieldObj.getJSONObject("fields"); fieldObj = fieldObj.getJSONObject("status"); String status = "@" + fieldObj.get("name").toString(); //then collect possible transactions jqlURL = getIssueTransitionsUrl(ticket); WebRequest requestSettings = new WebRequest(new URL(jqlURL), HttpMethod.GET); requestSettings.setAdditionalHeader("Content-type", "application/json"); UnexpectedPage infoPage = webClient.getPage(requestSettings); if (infoPage.getWebResponse().getStatusCode() == HTTP_RESPONSE_OK) { String ticketList = infoPage.getWebResponse().getContentAsString(); JSONObject obj = new JSONObject(ticketList); JSONArray array = obj.getJSONArray("transitions"); List<String> toList = new ArrayList<>(); toList.add(status); for (int i = 0; i < array.length(); i++) { JSONObject o = (JSONObject) array.get(i); JSONObject o2 = o.getJSONObject("to"); String toPossibility = o2.get("name").toString(); String toPossibilityID = o.get("id").toString(); //it is the transition id not the status id toList.add(toPossibilityID + ";" + toPossibility); } return toList.toString(); } throw new SimpleGepardException("ERROR: Cannot fetch Issue transition possibilities from JIRA, for ticket: " + ticket + ", Status code:" + infoPage.getWebResponse().getStatusCode()); }
From source file:com.openshift.internal.restclient.model.properties.ResourcePropertiesRegistry.java
private <T extends APIModelVersion> T getMaxSupportedVersion(List<T> clientVersions, List<T> serverVersions) { Collections.sort(clientVersions, new APIModelVersion.VersionComparitor()); Collections.sort(serverVersions, new APIModelVersion.VersionComparitor()); T maxClientVersion = clientVersions.get(clientVersions.size() - 1); T maxServerVersion = serverVersions.get(serverVersions.size() - 1); if (serverVersions.contains(maxClientVersion)) { return maxClientVersion; }// ww w . j a va 2s .c om if (clientVersions.contains(maxServerVersion)) { return maxServerVersion; } throw new IncompatibleApiVersionsException(clientVersions.toString(), serverVersions.toString()); }
From source file:com.aquest.emailmarketing.web.controllers.BroadcastController.java
/** * Embed image.//w ww. ja va 2 s .c o m * * @param model the model * @param principal the principal * @param id the id * @param url the url * @return the string */ @RequestMapping(value = "/embedImages", method = RequestMethod.POST) public String embedImage(Model model, Principal principal, @RequestParam(value = "id") int id, @RequestParam(value = "url", required = false, defaultValue = "nesto") List<String> url) { //DONE: NullPointerException when no pictures is selected System.out.println(url.toString()); Broadcast broadcast = broadcastService.getBroadcastById(id); System.out.println(broadcast.toString()); String addedTracking = broadcast.getHtmlbody_tracking(); if (url.size() > 0 && !url.get(0).equals("nesto")) { EmbeddedImage embeddedImage = new EmbeddedImage(); embeddedImage.setBroadcast_id(broadcast.getBroadcast_id()); System.out.println(embeddedImage.getBroadcast_id()); // iz array u string sa ; kao separatorom StringBuilder sb = new StringBuilder(); for (int i = 0; i < url.size(); i++) { sb.append(url.get(i)); sb.append(";"); } System.out.println(sb.toString()); String urls = sb.toString(); System.out.println(urls); if (urls.charAt(urls.length() - 1) == ';') { urls = urls.substring(0, urls.length() - 1); } System.out.println(urls); embeddedImage.setUrl(urls); embeddedImageService.SaveOrUpdate(embeddedImage); for (int k = 0; k < url.size(); k++) { addedTracking = addedTracking.replace(url.get(k), "[IMAGE:" + k + "]"); } System.out.println(addedTracking); } broadcast.setHtmlbody_embed(addedTracking); broadcast.setStatus("DEFINED"); broadcastService.SaveOrUpdate(broadcast); model.addAttribute("broadcast", broadcast); return "sendbroadcast"; }
From source file:de.felixschulze.maven.plugins.xcode.XcodeCleanMojo.java
/** * Execute the xcode command line utility. *///from www . j a v a2 s.c om public void execute() throws MojoExecutionException { if (!xcodeCommandLine.exists()) { throw new MojoExecutionException("Invalid path for xcodebuild: " + xcodeCommandLine.getAbsolutePath()); } CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor(); executor.setLogger(this.getLog()); List<String> commands = new ArrayList<String>(); commands.add("clean"); if (xcodeProject != null) { commands.add("-project"); commands.add(xcodeProject.getAbsolutePath()); } if (xcodeTarget != null) { commands.add("-target"); commands.add(xcodeTarget); } if (xcodeConfiguration != null) { commands.add("-configuration"); commands.add(xcodeConfiguration); } if (xcodeWorkspace != null) { commands.add("-workspace"); commands.add(xcodeWorkspace.getAbsolutePath()); } if (xcodeScheme != null) { commands.add("-scheme"); commands.add(xcodeScheme); } getLog().info(xcodeCommandLine.getAbsolutePath() + " " + commands.toString()); try { executor.executeCommand(xcodeCommandLine.getAbsolutePath(), commands, false); } catch (ExecutionException e) { getLog().error(executor.getStandardOut()); getLog().error(executor.getStandardError()); throw new MojoExecutionException("Error while executing: ", e); } try { getLog().info("Deleting " + buildDirectory); FileUtils.deleteDirectory(buildDirectory); } catch (IOException e) { getLog().error("Failed to delete build directory."); throw new MojoExecutionException("Error while deleting build directory: ", e); } }
From source file:nl.knaw.dans.common.lang.spring.FileBasedPropertyPlaceholderConfigurer.java
public FileBasedPropertyPlaceholderConfigurer(final String resourcePath) throws FileNotFoundException { final List<File> locationsToTry = new LinkedList<File>(); final String filename = System.getProperty("user.name") + ".properties"; locationsToTry.add(new File(resourcePath, filename)); locationsToTry.add(new File(resourcePath, DEFAULT_RESOURCE_PATH + "/" + filename)); locationsToTry.add(new File(resourcePath, DEFAULT_PROPERTIES_FILE)); locationsToTry.add(new File(resourcePath, DEFAULT_RESOURCE_PATH + "/" + DEFAULT_PROPERTIES_FILE)); for (final File file : locationsToTry) { if (file.exists()) { logger.info("Found application properties at " + file.getAbsolutePath()); setLocation(new FileSystemResource(file)); return; }//from w w w . j a v a 2 s . c o m } throw new FileNotFoundException( String.format("No properties file found; tried: %s", locationsToTry.toString())); }