Example usage for java.util ArrayList toString

List of usage examples for java.util ArrayList toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.wso2.am.integration.tests.server.mgt.OSGIServerBundleStatusTestCase.java

private String getString(ArrayList<String> list) {
    if (list != null && list.size() > 0) {
        return list.toString();
    }//  ww w.j a  v  a 2  s .c om
    return "";
}

From source file:nl.hnogames.domoticz.Fragments.Logs.java

private void processLogs() {
    mDomoticz.getLogs(new LogsReceiver() {
        @Override//from   w ww .ja  v  a 2  s . co m
        public void onReceiveLogs(ArrayList<LogInfo> mLogInfos) {
            successHandling(mLogInfos.toString(), false);

            adapter = new LogAdapter(mContext, mLogInfos);

            createListView();
            hideProgressDialog();
        }

        @Override
        public void onError(Exception error) {
            errorHandling(error);
        }
    });
}

From source file:com.hanuor.sapphire.hub.SapphireIntentHandler.java

public void saveIntent(String keyTag, Intent intent) throws IOException {
    ObjectMapper mapper = new ObjectMapper();

    String jsonString = mapper.writeValueAsString(intent);
    Log.d("SappHeya", "" + jsonString);
    //Intent bj = mapper.readValue(jsonString, Intent.class);
    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("a", "aa");
    hashMap.put("b", "lalala");
    ArrayList<String> m = new ArrayList<String>();
    m.add("frost");
    m.add("girl");
    m.add("Bumblebee");
    hashMap.put("c", m.toString());
    Log.d("SappTestTag", "" + mapper.writeValueAsString(hashMap));

    //  String saveIntentthroughString = ToStringBuilder.reflectionToString(intent);
    // suggestionTempDBHandler.insertData(keyTag, saveIntentthroughString);
}

From source file:edu.harvard.i2b2.util.I2b2UtilTest.java

@Test
public void getPatientListForAProject()
        throws XQueryUtilException, IOException, JAXBException, AuthenticationFailure {
    String i2b2ResponseXml = I2b2Util.getAllPatients(i2b2User, i2b2Password, i2b2Url, i2b2Domain, projectId);

    logger.info("i2b2ResponseXm:" + i2b2ResponseXml);
    ArrayList<String> list = I2b2Util.getAllPatientsAsList(i2b2ResponseXml);

    logger.info("list:" + list.toString());
}

From source file:petascope.util.ras.Gdalinfo.java

/**
 * Gets the number of dimensions and the type of each band from a file, as
 * given by gdalinfo./*ww  w . j  a v a  2 s .c  om*/
 *
 * @param filePath the path to the file
 * @return
 * @throws IOException
 */
public static Pair<Integer, ArrayList<String>> getDimensionAndTypes(String filePath)
        throws IOException, WCSTNoReadPermissionException {
    log.trace("Reading gdal info output for " + filePath);
    Integer dimensions = 0;
    ArrayList<String> bandTypes = new ArrayList<String>();
    File f = new File(filePath);
    if (!f.canRead()) {
        log.error("Failed retrieving gdalinfo for file: " + filePath);
        throw new WCSTNoReadPermissionException(filePath);
    }
    try {
        Process process = Runtime.getRuntime().exec(GDAL_INFO + filePath);
        BufferedReader stdOutReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String currentLine;
        while ((currentLine = stdOutReader.readLine()) != null) {
            //parse number of dimensions
            if (currentLine.startsWith(GDAL_SIZE)) {
                dimensions = parseNumberOfDimensions(currentLine);
            }
            //parse band type information
            if (currentLine.startsWith(GDAL_BAND)) {
                bandTypes.add(parseBandType(currentLine));
            }
        }
    } catch (IOException e) {
        log.error("Failed retrieving gdalinfo for file: " + e.getMessage());
        throw e;
    }
    log.trace("Got " + dimensions + " dimensions and " + bandTypes.toString() + " band types.");
    return Pair.of(dimensions, bandTypes);
}

From source file:jsentvar.GenerateTestsResults.java

public void getUrisResult() throws IOException {
    System.out.println("getUris");
    String term_value0 = "intelligent_systems";
    String term_value = term_value0.substring(0, 1).toUpperCase() + term_value0.substring(1);
    Surrogate sur = new Surrogate(term_value, this.model);

    String mode = "wide";
    String term_id = term_value.replace(" ", "_");
    String queryString = sur.preQuery(mode, term_id);
    DataMapper instance = new DataMapper();
    instance.setModel(this.model);
    ArrayList<String> result0 = instance.getUris(queryString, mode);
    System.out.println("Generating getUrisResult:");
    System.out.println(result0.toString());
    //Utils.writeFile("resources/test/getUrisResult.txt", result0.toString());
    FileUtils.writeStringToFile(new File("resources/test/getUrisResult.txt"), result0.toString(), "utf8");
}

From source file:jsentvar.SurrogateTest.java

/**
 * Test of getSurrogates method, of class Surrogate.
 *///from w w  w  .j  a  v  a  2s .c  o  m
@Test
public void testGetSurrogates_0args() {
    System.out.println("getSurrogates Test");
    RDFReader lector = new RDFReader();
    String filename;
    filename = "resources/test/miniReasoner.owl";
    Model model;

    String term_value0 = "intelligent_systems";
    String term_value = term_value0.substring(0, 1).toUpperCase() + term_value0.substring(1);
    model = lector.reader(filename);

    Resource term = model.getResource(term_value);

    //System.out.print(term.toString() + "\n");

    Surrogate sur = new Surrogate(term_value, model);

    ArrayList<String> new_terms = sur.getSurrogates();
    //System.out.println(new_terms.toString());
    String result = new_terms.toString().trim();
    String expResult = "[Computational and artificial intelligence, Artificial intelligence]";

    assertEquals(expResult, result);

}

From source file:jsentvar.GenerateTestsResults.java

public void findTermsFoundResults() throws IOException {
    DataMapper dm = new DataMapper();
    dm.setModel(model);/*w  ww . j a va 2s . co m*/
    ArrayList<String> labels = dm.getAllLabels();
    //System.out.println(labels.size());

    FindTerms finder = new FindTerms();
    FindTerms.vocabulary = labels;
    String docFile = "resources/test/findtermsdoc.txt";
    String doc = FileUtils.readFileToString(new File(docFile), "utf8");
    ArrayList<String> f = finder.found(doc);
    System.out.println(f);
    FileUtils.writeStringToFile(new File("resources/test/findtermsdocResult.txt"), f.toString(), "utf8");
}

From source file:jsentvar.SurrogateTest.java

/**
 * Test of getSurrogates method, of class Surrogate.
 *///  ww w. j av  a2 s  .  c o  m
@Test
public void testGetSurrogates_String() {
    System.out.println("getSurrogates(wide) Test");

    RDFReader lector = new RDFReader();
    String filename;
    filename = "resources/test/miniReasoner.owl";
    Model model;

    String term_value0 = "intelligent_systems";
    String term_value = term_value0.substring(0, 1).toUpperCase() + term_value0.substring(1);
    model = lector.reader(filename);

    Resource term = model.getResource(term_value);

    //System.out.print(term.toString() + "\n");

    Surrogate sur = new Surrogate(term_value, model);

    ArrayList<String> new_terms = sur.getSurrogates("wide");
    //System.out.println(new_terms.toString());
    String result = new_terms.toString().trim();
    String expResult = "[Computational and artificial intelligence, Artificial intelligence]";

    assertEquals(expResult, result);

}

From source file:com.vmware.bdd.service.impl.SetLocalRepoService.java

@Override
public boolean setLocalRepoForNodes(String clusterName, List<NodeEntity> nodes, String repoId,
        String localRepoURL) {/*from  w  ww  .  j a v  a  2s .  co m*/
    AuAssert.check(CollectionUtils.isNotEmpty(nodes), "cannot set localrepo to empty node list");

    logger.info("Setting password for " + clusterName);
    ArrayList<String> ipsOfNodes = VcVmUtil.getNodePrimaryMgtIPV4sFromEntitys(nodes);
    logger.info("Nodes needed to be set password: " + ipsOfNodes.toString());

    boolean succeed = true;
    List<Callable<Void>> storeProcedures = new ArrayList<Callable<Void>>();
    for (NodeEntity node : nodes) {
        SetLocalRepoSP setLocalRepoSP = new SetLocalRepoSP(node, repoId, localRepoURL);
        storeProcedures.add(setLocalRepoSP);
    }
    AuAssert.check(!storeProcedures.isEmpty());

    try {
        Callable<Void>[] storeProceduresArray = storeProcedures.toArray(new Callable[0]);
        NoProgressUpdateCallback callback = new NoProgressUpdateCallback();
        ExecutionResult[] result = Scheduler.executeStoredProcedures(
                com.vmware.aurora.composition.concurrent.Priority.BACKGROUND, storeProceduresArray, callback);

        for (int i = 0; i < storeProceduresArray.length; i++) {
            SetLocalRepoSP sp = (SetLocalRepoSP) storeProceduresArray[i];
            NodeEntity node = sp.getNodeEntity();
            String vmNameWithIP = node.getVmNameWithIP();
            if (result[i].finished && result[i].throwable == null) {
                updateNodeData(node, true, null, null);
                logger.info("Set local repo: store procedure succeed for " + vmNameWithIP);
            }
            if (!result[i].finished || result[i].throwable != null) {
                succeed = false;
                if (result[i].throwable != null) {
                    String errMsg = result[i].throwable.getMessage();
                    updateNodeData(node, false, errMsg, CommonUtil.getCurrentTimestamp());
                    logger.error("Set local repo: store procedure failed for " + vmNameWithIP + ": " + errMsg);
                }
            }
        }
    } catch (Exception e) {
        //place holder in case of known error, in this case, we just log it and
        //throw cli exception, we don't set node task field
        String errMsg = " : " + e.getMessage();
        logger.error("Unknown error in setting local repo for " + clusterName, e);
        throw SetLocalRepoException.FAIL_TO_SET_LOCAL_REPO(" cluster " + clusterName, errMsg);
    }

    return succeed;
}