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.sm.store.TestRemoteCall.java

public void testMultiPut() {
    Person.Address address = new Person.Address(new Person.Street(4813, "corsica dr"), 90630, "cypress");
    Person person = new Person("mickey", 30, 4000.00, true, null);
    HessianSerializer serializer = new HessianSerializer();
    ScanClientImpl client = new ScanClientImpl("localhost:7100", null, "store");
    int times = 30;
    List<Key> lst = new ArrayList<Key>();
    for (int i = 0; i < times; i++) {
        lst.add(Key.createKey(i));
    }/*from ww w. j a v a2 s . c o m*/
    List<KeyValue> ton = client.multiRemoves(lst);
    System.out.println("multi removes " + ton.toString());
    List<KeyValue> list = new ArrayList<KeyValue>(times);
    for (int i = 0; i < times; i++) {
        Value value = new RemoteValue(serializer.toBytes(person), 0, (short) 0);
        list.add(new KeyValue(Key.createKey(i), value));
    }
    List<KeyValue> toReturn = client.multiPuts(list);
    System.out.println("toReturn " + toReturn.toString());
    //toReturn = client.multiPuts( list);
    List<Key> keyList = new ArrayList<Key>(times);
    for (int i = 0; i < times; i++) {
        keyList.add(Key.createKey(i));
    }
    List<KeyValue> keyValueList = client.multiGets(keyList);
    toReturn = client.multiUpdateQuery(keyList, "replace Person set age=20, income=1000.00 ");
    keyValueList = client.multiGets(keyList);
    System.out.println(keyValueList.toString());

}

From source file:com.liferay.social.activity.test.util.BaseSocialActivityInterpreterTestCase.java

protected void checkLinks() throws Exception {
    List<SocialActivity> activities = getActivities();

    Assert.assertFalse(activities.toString(), activities.isEmpty());

    SocialActivityInterpreter activityInterpreter = getActivityInterpreter();

    for (SocialActivity activity : activities) {
        if (hasClassName(activityInterpreter, activity.getClassName()) && hasActivityType(activity.getType())) {

            SocialActivityFeedEntry activityFeedEntry = activityInterpreter.interpret(activity, serviceContext);

            PortletURL portletURL = trashHelper.getViewContentURL(serviceContext.getRequest(),
                    activity.getClassName(), activity.getClassPK());

            if (Validator.isNull(activityFeedEntry.getLink()) && (portletURL == null)) {

                continue;
            }/*  www  .j av a2 s.  co m*/

            Assert.assertEquals(portletURL.toString(), activityFeedEntry.getLink());
        }
    }
}

From source file:org.openmrs.module.idgen.service.IdentifierSourceServiceTest.java

/**
 * @see {@link IdentifierSourceService#generateIdentifiers(IdentifierSource, Integer, String)}
 *///from w  w w .j  a v a2 s. c o  m
@Test
@Verifies(value = "should return batch of ID of correct size", method = "generateIdentifiers(IdentifierSource, integer, String)")
public void generateIdentifiers_shouldReturnIdentifiersOfCorrectSize() throws Exception {
    IdentifierSource is = iss.getIdentifierSource(1);
    List<String> sig = iss.generateIdentifiers(is, 7, "hello");
    Assert.assertEquals(sig.toString(), "[G-0, H-8, I-5, J-3, K-1, L-9, M-7]");
}

From source file:com.vip.saturn.job.console.controller.HomeController.java

private void renderShellExecutorInfos(final ModelMap model) {
    List<String> aliveExecutorNames = executorService.getAliveExecutorNames();
    if (aliveExecutorNames != null && !aliveExecutorNames.isEmpty()) {
        model.put("aliveExecutors", aliveExecutorNames.toString());
    } else {//from  ww w  .ja va 2  s .  c om
        model.put("aliveExecutors", "");
    }
}

From source file:de.uzk.hki.da.format.PublishImageConversionStrategyTest.java

/**
 * Test watermark with real image./* w  w  w .j  a  va  2s. c om*/
 *
 * @throws FileNotFoundException the file not found exception
 */
public void testWatermarkWithRealImage() throws FileNotFoundException {

    Document dom = XPathUtils.parseDom(TC.TEST_ROOT_FORMAT + "/PublishImageConversionStrategyTests/premis.xml");
    if (dom == null) {
        throw new RuntimeException("Error while parsing premis.xml");
    }

    Object o = TESTHelper.setUpObject("123", new RelativePath(workAreaRootPath));

    PublishImageConversionStrategy s = new PublishImageConversionStrategy();
    s.setCLIConnector(new SimplifiedCommandLineConnector());

    DAFile sourceFile = new DAFile(o.getLatestPackage(), "a", "filename.tif");

    ConversionInstruction ci = new ConversionInstruction();
    ci.setSource_file(sourceFile);
    ci.setTarget_folder("target/");

    ConversionRoutine cr = new ConversionRoutine();
    cr.setTarget_suffix("jpg");
    ci.setConversion_routine(cr);

    s.setObject(o);
    List<Event> events = s.convertFile(ci);

    System.out.println(events.toString());

}

From source file:com.pinterest.arcee.aws.EC2HostInfoDAOImpl.java

@Override
public List<HostBean> launchEC2Instances(GroupBean groupBean, int instanceCnt, String subnet) throws Exception {
    RunInstancesRequest request = new RunInstancesRequest();
    request.setImageId(groupBean.getImage_id());
    request.setInstanceType(groupBean.getInstance_type());
    request.setKeyName("ops");
    request.setSecurityGroupIds(Arrays.asList(groupBean.getSecurity_group()));
    request.setSubnetId(subnet);//from w  w  w.  j  a va 2  s .  co  m
    request.setUserData(groupBean.getUser_data());
    IamInstanceProfileSpecification iamRole = new IamInstanceProfileSpecification();
    iamRole.setArn(groupBean.getIam_role());
    request.setIamInstanceProfile(iamRole);
    request.setMinCount(instanceCnt);
    request.setMaxCount(instanceCnt);

    List<HostBean> newHosts = new ArrayList<>();
    try {
        RunInstancesResult result = ec2Client.runInstances(request);
        List<Instance> instances = result.getReservation().getInstances();
        LOG.info("Launch instances {}", instances.toString());
        for (Instance instance : instances) {
            HostBean host = new HostBean();
            host.setHost_name(instance.getInstanceId());
            host.setHost_id(instance.getInstanceId());
            host.setIp(instance.getPrivateIpAddress());
            host.setGroup_name(groupBean.getGroup_name());
            host.setState(HostState.PROVISIONED);
            host.setCreate_date(instance.getLaunchTime().getTime());
            host.setLast_update(instance.getLaunchTime().getTime());
            newHosts.add(host);
        }
    } catch (AmazonClientException ex) {
        LOG.error(String.format("Failed to call aws runInstances when launching host %s", newHosts.toString()),
                ex);
        throw new DeployInternalException(
                String.format("Failed to call aws runInstances when launching host %s", newHosts.toString()),
                ex);
    }
    return newHosts;
}

From source file:com.bt.aloha.stack.SessionDescriptionHelper.java

@SuppressWarnings("unchecked")
public static void setMediaDescription(SessionDescription sessionDescription,
        List<MediaDescription> mediaDescriptions, Map<String, String> dynamicPayloadMap) {
    if (mediaDescriptions == null || mediaDescriptions.size() == 0)
        throw new IllegalArgumentException("Media description must not be null");

    if (sessionDescription == null)
        throw new IllegalArgumentException("SDP must not be null");

    if (sessionDescription.getConnection() == null) {
        for (MediaDescription mediaDescription : mediaDescriptions) {
            if (mediaDescription.getConnection() == null)
                throw new IllegalArgumentException(
                        "SDP must have a Connection (c=) attribute either at session or at media level");
        }/*from   w  w  w.  java2s  . c  om*/
    }

    log.debug(String.format("Setting media %s in session description",
            mediaDescriptions.toString().replace("\n", "").replace("\r", "")));

    try {
        Origin o = SdpFactory.getInstance().createOrigin(DASH, System.currentTimeMillis(),
                System.currentTimeMillis(), IN, IP4, sessionDescription.getOrigin().getAddress());
        sessionDescription.setOrigin(o);
    } catch (SdpException e) {
        throw new StackException(ERROR_ADDING_MEDIA_DESCRIPTION_S_TO_SDP, e);
    }

    List<MediaDescription> newMediaDescriptionVector = new Vector<MediaDescription>();
    for (MediaDescription mediaDescription : mediaDescriptions) {
        MediaDescription newMediaDescription = cloneMediaDescription(mediaDescription);
        //removeDynamicPayloadTypesFromMediaDescription(newMediaDescription);
        if (dynamicPayloadMap != null)
            mapDynamicPayloadTypes(newMediaDescription, dynamicPayloadMap);
        else
            log.debug("NOT mapping dynamic media payload types when adding media to SDP");
        newMediaDescriptionVector.add(newMediaDescription);
    }

    try {
        sessionDescription.setMediaDescriptions((Vector) newMediaDescriptionVector);

        if (newMediaDescriptionVector.get(0).getConnection() != null) {
            Connection sessionConnection = SdpFactory.getInstance()
                    .createConnection(newMediaDescriptionVector.get(0).getConnection().getAddress());
            sessionDescription.setConnection(sessionConnection);
        }
    } catch (SdpException e) {
        throw new StackException(ERROR_ADDING_MEDIA_DESCRIPTION_S_TO_SDP, e);
    }
}

From source file:com.termmed.utils.ResourceUtils.java

/**
 * Gets the resource scripts.//from   w  w  w.jav a  2s  . c  o m
 *
 * @param path the path
 * @return the resource scripts
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static Collection<String> getResourceScripts(String path) throws IOException {
    System.out.println("getting files from " + path);
    List<String> strFiles = new ArrayList<String>();

    //      InputStream is=ResourceUtils.class.getResourceAsStream("/" + path);
    //      InputStreamReader risr = new InputStreamReader(is);
    //      BufferedReader br=new BufferedReader(risr);
    //      String line;
    //      while((line=br.readLine())!=null){
    //         strFiles.add(line);
    //      }

    String file = null;
    if (new File("stats-build.jar").exists()) {
        file = "stats-build.jar";
    } else {
        file = "target/stats-build.jar";
    }
    ZipInputStream zip = new ZipInputStream(new FileInputStream(file));
    while (true) {
        ZipEntry e = zip.getNextEntry();
        if (e == null)
            break;
        String name = e.getName();
        if (name.startsWith(path) && !name.endsWith("/")) {
            //            if (!name.startsWith("/")){
            //               name="/" + name;
            //            }
            strFiles.add(name);
        }
    }

    System.out.println("files:" + strFiles.toString());
    return strFiles;
}

From source file:com.liferay.social.activity.test.util.BaseSocialActivityInterpreterTestCase.java

protected void checkInterpret(long time) throws Exception {
    List<SocialActivity> activities = getActivities();

    Assert.assertFalse(activities.toString(), activities.isEmpty());

    Map<String, String> entryTitles = new HashMap<>();

    SocialActivityInterpreter activityInterpreter = getActivityInterpreter();

    for (SocialActivity activity : activities) {
        String title = activity.getExtraDataValue("title", serviceContext.getLocale());

        if (isSupportsRename(activity.getClassName()) && Validator.isNotNull(title)) {

            if (activity.getCreateDate() < time) {
                entryTitles.put(activity.getClassName(), title);
            } else {
                Assert.assertNotNull(entryTitles.get(activity.getClassName()));
                Assert.assertNotEquals(entryTitles.get(activity.getClassName()), title);
            }//from   w w w .ja v a2  s  . c o m
        }

        if (hasClassName(activityInterpreter, activity.getClassName()) && hasActivityType(activity.getType())) {

            SocialActivityFeedEntry activityFeedEntry = activityInterpreter.interpret(activity, serviceContext);

            Assert.assertNotNull(activityFeedEntry);

            title = activityFeedEntry.getTitle();

            Assert.assertFalse("Title contains parameters: " + title, title.matches("\\{\\d\\}"));
        }
    }
}

From source file:de.cologneintelligence.fitgoodies.maven.FitIntegrationTestMojo.java

private ProcessBuilder prepareProcess(File bootJar) throws MojoExecutionException {
    try {//from w w w .  jav  a2 s . c  o  m
        String executable = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
        List<String> args = createJavaArgs(executable, bootJar);
        getLog().debug("Running process: " + args.toString());
        return new ProcessBuilder(args).directory(project.getBasedir());
    } catch (Exception e) {
        throw new MojoExecutionException("Error while preparing java process", e);
    }
}