Example usage for java.util List toString

List of usage examples for java.util List toString

Introduction

In this page you can find the example usage for java.util List toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.aes.touresbalon.touresbalonoms.services.LoginService.java

private boolean autenticacionLDAP(String usr, String pass) {
    boolean res = false;

    try {//from  w w  w .  j  a  va2s  . com
        LdapContextSource ctxSrc = new LdapContextSource();
        ctxSrc.setUrl(url);
        ctxSrc.setBase(base);
        ctxSrc.setUserDn(usrDn);
        ctxSrc.setPassword(password);
        ctxSrc.setReferral("follow");
        ctxSrc.afterPropertiesSet();
        LdapTemplate lt = new LdapTemplate(ctxSrc);

        AndFilter filter = new AndFilter();
        filter.and(new EqualsFilter("objectclass", "person"));

        List<String> list = lt.search("", filter.encode(), new ContactAttributeMapperJSON());
        System.out.println(list.toString());

        System.out.println("Auntenticando a " + usr);
        filter.and(new EqualsFilter("sAMAccountName", usr));
        if (lt.authenticate(DistinguishedName.EMPTY_PATH, filter.toString(), pass)) {
            System.out.println("Autenticacion Exitosa a: " + usr);
            res = true;
        } else {
            System.err.println("Autenticacion Fallida a :" + usr);
        }

    } catch (Exception ex) {
        // Logger.getLogger(LDAPView.class.getName()).log(Level.SEVERE, null, ex);
    }

    return res;
}

From source file:org.duracloud.snapshot.service.impl.SyncWriter.java

@Override
public void onWriteError(Exception ex, List<? extends File> items) {
    log.error("Error writing item(s): " + items.toString(), ex);
    //TODO How should this be properly handled.
    //the interface doesn't supply any information about which items were processed
    //and which one(s) failed.
    //TODO Update the database with the failure status (failed to transfer to duracloud.)
}

From source file:org.jboss.pnc.mavenrepositorymanager.UploadOneThenDownloadAndVerifyArtifactHasOriginUrlTest.java

@Test
public void extractBuildArtifacts_ContainsTwoUploads() throws Exception {
    // create a dummy non-chained build execution and repo session based on it
    BuildExecution execution = new TestBuildExecution();
    RepositorySession rc = driver.createBuildRepository(execution, accessToken);

    assertThat(rc, notNullValue());/* w ww. j a v  a 2s  .  co  m*/

    String baseUrl = rc.getConnectionInfo().getDeployUrl();
    String path = "org/commonjava/indy/indy-core/0.17.0/indy-core-0.17.0.pom";
    String content = "This is a test";

    CloseableHttpClient client = HttpClientBuilder.create().build();

    // upload a couple files related to a single GAV using the repo session deployment url
    // this simulates a build deploying one jar and its associated POM
    final String url = UrlUtils.buildUrl(baseUrl, path);

    assertThat("Failed to upload: " + url, ArtifactUploadUtils.put(client, url, content), equalTo(true));

    // download the two files via the repo session's dependency URL, which will proxy the test http server
    // using the expectations above
    assertThat(download(UrlUtils.buildUrl(baseUrl, path)), equalTo(content));

    ProjectVersionRef pvr = new SimpleProjectVersionRef("org.commonjava.indy", "indy-core", "0.17.0");
    String artifactRef = new SimpleArtifactRef(pvr, "pom", null).toString();

    // extract the "builtArtifacts" artifacts we uploaded above.
    RepositoryManagerResult repositoryManagerResult = rc.extractBuildArtifacts();

    // check that both files are present in extracted result
    List<Artifact> builtArtifacts = repositoryManagerResult.getBuiltArtifacts();
    log.info("Built artifacts: " + builtArtifacts.toString());

    assertThat(builtArtifacts, notNullValue());
    assertThat(builtArtifacts.size(), equalTo(1));

    Artifact builtArtifact = builtArtifacts.get(0);
    assertThat(builtArtifact + " doesn't match pom ref: " + artifactRef,
            artifactRef.equals(builtArtifact.getIdentifier()), equalTo(true));

    client.close();
}

From source file:org.springframework.social.soundcloud.api.impl.SoundCloudErrorHandler.java

private String constructMessage(List<String> messages) {
    return messages.toString();
}

From source file:com.yxz97.hr.web.controllers.PersonController.java

@RequestMapping(method = RequestMethod.GET)
public void list(Model model) {
    List<Person> personList = personService.loadAll();
    model.addAttribute(personList);// w w  w .j  ava  2  s  .  c  om
    logger.info("returning to person/list.jsp personList:" + personList.toString());
}

From source file:be.bittich.quote.service.impl.AuthorServiceImplTest.java

@Test
public void autoCompleteLastNameFirstName() {
    List<LastnameFirstnameVO> vo = authorService.autoCompleteLastNameFirstName();
    assertNotNull(vo);/*from  w w w  .  ja va  2  s  . co m*/
    System.out.println(vo.toString());
}

From source file:com.insightml.data.AbstractDataset.java

@Override
public String getReport() {
    final List<Pair<String, String>> fields = new ArrayList<>(2);
    fields.add(new Pair<>("Name", getName()));
    fields.add(new Pair<>("Description", getDescription()));
    return fields.toString();
}

From source file:de.tudarmstadt.lt.lm.service.PreTokenizedStringProvider.java

@Override
public List<String>[] getNgrams(String text, String language_code) throws Exception {
    LOG.trace(String.format("Computing ngrams from text: %s", StringUtils.abbreviate(text, 200)));
    List<String>[] ngrams = null;

    text = text.trim();/*  w  ww  . j  a v  a  2s. co  m*/
    for (LineIterator iter = new LineIterator(new StringReader(text)); iter.hasNext();) {

        List<String> tokens = tokenizeSentence(iter.nextLine());

        LOG.trace(String.format("Current sentence: %s", StringUtils.abbreviate(tokens.toString(), 200)));
        if (tokens.size() < getLanguageModel().getOrder()) {
            LOG.trace("Too few tokens.");
            continue;
        }
        List<String>[] current_ngrams = getNgramSequenceFromSentence(tokens);

        LOG.trace(String.format("Current ngrams: %s",
                StringUtils.abbreviate(Arrays.toString(current_ngrams), 200)));
        if (ngrams == null)
            ngrams = current_ngrams;
        else
            ngrams = ArrayUtils.getConcatinatedArray(ngrams, current_ngrams);
    }
    LOG.trace(String.format("Ngrams for text: %n\t'%s'%n\t%s ", StringUtils.abbreviate(text, 200),
            StringUtils.abbreviate(Arrays.toString(ngrams), 200)));
    return ngrams;
}

From source file:com.bluelotussoftware.apache.commons.fileupload.example.CommonsFileUploadServlet.java

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    log("Content-Type: " + request.getContentType());

    DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
    /*//from  ww w .  j ava  2s .  co m
     *Set the size threshold, above which content will be stored on disk.
     */
    fileItemFactory.setSizeThreshold(10 * 1024 * 1024); //10 MB
    /*
    * Set the temporary directory to store the uploaded files of size above threshold.
    */
    fileItemFactory.setRepository(tmpDir);

    ServletFileUpload uploadHandler = new ServletFileUpload(fileItemFactory);
    try {
        /*
         * Parse the request
         */
        List items = uploadHandler.parseRequest(request);
        log("FileItems: " + items.toString());
        Iterator itr = items.iterator();
        while (itr.hasNext()) {

            FileItem item = (FileItem) itr.next();
            /*
             * Handle Form Fields.
             */
            if (item.isFormField()) {
                out.println("File Name = " + item.getFieldName() + ", Value = " + item.getString());
            } else {
                //Handle Uploaded files.
                out.println("<html><head><title>CommonsFileUploadServlet</title></head><body><p>");
                out.println("Field Name = " + item.getFieldName() + "\nFile Name = " + item.getName()
                        + "\nContent type = " + item.getContentType() + "\nFile Size = " + item.getSize());
                out.println("</p>");
                out.println("<img src=\"" + request.getContextPath() + "/files/" + item.getName() + "\"/>");
                out.println("</body></html>");
                /*
                 * Write file to the ultimate location.
                 */
                File file = new File(destinationDir, item.getName());
                item.write(file);
            }
            out.close();
        }
    } catch (FileUploadException ex) {
        log("Error encountered while parsing the request", ex);
    } catch (Exception ex) {
        log("Error encountered while uploading file", ex);
    }
}

From source file:com.sillelien.dollar.DollarOperatorsRegressionTest.java

public void regression(String symbol, String operation, String variant, @NotNull List<List<var>> result)
        throws IOException {
    String filename = operation + "." + variant + ".json";
    final JsonArray previous = new JsonArray(IOUtils.toString(getClass().getResourceAsStream("/" + filename)));
    //Use small to stop massive string creation
    final File file = new File("target", filename);
    final var current = $(result);
    FileUtils.writeStringToFile(file, current.jsonArray().encodePrettily());
    System.out.println(file.getAbsolutePath());
    SortedSet<String> typeComparison = new TreeSet<>();
    SortedSet<String> humanReadable = new TreeSet<>();
    for (List<var> res : result) {
        if (res.size() != 3) {
            throw new IllegalStateException(res.toString());
        }/*  w  w  w .ja  v  a 2s  . c om*/

        typeComparison.add(
                res.get(0).$type() + " " + operation + " " + res.get(1).$type() + " = " + res.get(2).$type());
        humanReadable.add(res.get(0).toDollarScript() + " " + symbol + " " + res.get(1).toDollarScript()
                + " <=> " + res.get(2).toDollarScript());
    }
    final String typesFile = operation + "." + variant + ".types.txt";
    final String humanFile = operation + "." + variant + ".ds";
    FileUtils.writeLines(new File("target", typesFile), typeComparison);
    FileUtils.writeLines(new File("target", humanFile), humanReadable);
    final TreeSet previousTypeComparison = new TreeSet<String>(
            IOUtils.readLines(getClass().getResourceAsStream("/" + typesFile)));
    diff("type", previousTypeComparison.toString(), typeComparison.toString());
    diff("result", previous, current.jsonArray());
}