java.util.ArrayList

Here are the examples of the java api class java.util.ArrayList taken from open source projects.

1. CopyTest#testReferences()

Project: kryo
Source File: CopyTest.java
View license
public void testReferences() {
    ArrayList test = new ArrayList();
    test.add("one");
    test.add("two");
    test.add("three");
    ArrayList test2 = new ArrayList();
    test2.add(1);
    test2.add(2f);
    test2.add(3d);
    test2.add((byte) 4);
    test2.add((short) 5);
    test.add(test2);
    test.add(test2);
    test.add(test2);
    ArrayList copy = kryo.copy(test);
    assertTrue(test != copy);
    assertEquals(test, copy);
    assertTrue(test.get(3) != copy.get(4));
    assertTrue(copy.get(3) == copy.get(4));
    assertTrue(copy.get(3) == copy.get(5));
}

2. ResourceAttributes#initializeLists()

Project: oodt
Source File: ResourceAttributes.java
View license
/**
	 * Initialize all the various {@link java.util.List} fields.
	 */
protected void initializeLists() {
    formats = new ArrayList<String>();
    creators = new ArrayList<String>();
    subjects = new ArrayList<String>();
    publishers = new ArrayList<String>();
    contributors = new ArrayList<String>();
    dates = new ArrayList<String>();
    types = new ArrayList<String>();
    sources = new ArrayList<String>();
    languages = new ArrayList<String>();
    relations = new ArrayList<String>();
    coverages = new ArrayList<String>();
    rights = new ArrayList<String>();
    contexts = new ArrayList<String>();
    locations = new ArrayList<String>();
}

3. SharedActivatableServiceDescriptor#toString()

View license
public String toString() {
    // Would like to call super(), but need different formatting
    ArrayList fields = new ArrayList(12);
    fields.add(getExportCodebase());
    fields.add(getPolicy());
    fields.add(getImportCodebase());
    fields.add(getImplClassName());
    fields.add(((getServerConfigArgs() == null) ? null : Arrays.asList(getServerConfigArgs())));
    fields.add(getLifeCycle());
    fields.add(getServicePreparer());
    fields.add(getInnerProxyPreparer());
    fields.add(sharedGroupLog);
    fields.add(Boolean.valueOf(restart));
    fields.add(host);
    fields.add(new Integer(port));
    return fields.toString();
}

4. EXIFGPSTagSet#initTags()

Project: bioformats
Source File: EXIFGPSTagSet.java
View license
private static List initTags() {
    ArrayList tags = new ArrayList(31);
    tags.add(new GPSVersionID());
    tags.add(new GPSLatitudeRef());
    tags.add(new GPSLatitude());
    tags.add(new GPSLongitudeRef());
    tags.add(new GPSLongitude());
    tags.add(new GPSAltitudeRef());
    tags.add(new GPSAltitude());
    tags.add(new GPSTimeStamp());
    tags.add(new GPSSatellites());
    tags.add(new GPSStatus());
    tags.add(new GPSMeasureMode());
    tags.add(new GPSDOP());
    tags.add(new GPSSpeedRef());
    tags.add(new GPSSpeed());
    tags.add(new GPSTrackRef());
    tags.add(new GPSTrack());
    tags.add(new GPSImgDirectionRef());
    tags.add(new GPSImgDirection());
    tags.add(new GPSMapDatum());
    tags.add(new GPSDestLatitudeRef());
    tags.add(new GPSDestLatitude());
    tags.add(new GPSDestLongitudeRef());
    tags.add(new GPSDestLongitude());
    tags.add(new GPSDestBearingRef());
    tags.add(new GPSDestBearing());
    tags.add(new GPSDestDistanceRef());
    tags.add(new GPSDestDistance());
    tags.add(new GPSProcessingMethod());
    tags.add(new GPSAreaInformation());
    tags.add(new GPSDateStamp());
    tags.add(new GPSDifferential());
    return tags;
}

5. Workbook#createWorkbook()

Project: bioformats
Source File: Workbook.java
View license
/**
     * Creates an empty workbook object with three blank sheets and all the empty
     * fields.  Use this to create a workbook from scratch.
     */
public static Workbook createWorkbook() {
    if (log.check(POILogger.DEBUG))
        log.log(DEBUG, "creating new workbook from scratch");
    Workbook retval = new Workbook();
    ArrayList records = new ArrayList(30);
    ArrayList formats = new ArrayList(8);
    records.add(retval.createBOF());
    records.add(retval.createInterfaceHdr());
    records.add(retval.createMMS());
    records.add(retval.createInterfaceEnd());
    records.add(retval.createWriteAccess());
    records.add(retval.createCodepage());
    records.add(retval.createDSF());
    records.add(retval.createTabId());
    retval.records.setTabpos(records.size() - 1);
    records.add(retval.createFnGroupCount());
    records.add(retval.createWindowProtect());
    records.add(retval.createProtect());
    retval.records.setProtpos(records.size() - 1);
    records.add(retval.createPassword());
    records.add(retval.createProtectionRev4());
    records.add(retval.createPasswordRev4());
    retval.windowOne = (WindowOneRecord) retval.createWindowOne();
    records.add(retval.windowOne);
    records.add(retval.createBackup());
    retval.records.setBackuppos(records.size() - 1);
    records.add(retval.createHideObj());
    records.add(retval.createDateWindow1904());
    records.add(retval.createPrecision());
    records.add(retval.createRefreshAll());
    records.add(retval.createBookBool());
    records.add(retval.createFont());
    records.add(retval.createFont());
    records.add(retval.createFont());
    records.add(retval.createFont());
    // last font record postion
    retval.records.setFontpos(records.size() - 1);
    retval.numfonts = 4;
    // set up format records
    for (int i = 0; i <= 7; i++) {
        Record rec;
        rec = retval.createFormat(i);
        retval.maxformatid = retval.maxformatid >= ((FormatRecord) rec).getIndexCode() ? retval.maxformatid : ((FormatRecord) rec).getIndexCode();
        formats.add(rec);
        records.add(rec);
    }
    retval.formats = formats;
    for (int k = 0; k < 21; k++) {
        records.add(retval.createExtendedFormat(k));
        retval.numxfs++;
    }
    retval.records.setXfpos(records.size() - 1);
    for (int k = 0; k < 6; k++) {
        records.add(retval.createStyle(k));
    }
    records.add(retval.createUseSelFS());
    for (int k = 0; k < 1; k++) {
        // now just do 1
        BoundSheetRecord bsr = (BoundSheetRecord) retval.createBoundSheet(k);
        records.add(bsr);
        retval.boundsheets.add(bsr);
        retval.records.setBspos(records.size() - 1);
    }
    //        retval.records.supbookpos = retval.records.bspos + 1;
    //        retval.records.namepos = retval.records.supbookpos + 2;
    records.add(retval.createCountry());
    retval.sst = (SSTRecord) retval.createSST();
    records.add(retval.sst);
    records.add(retval.createExtendedSST());
    records.add(retval.createEOF());
    retval.records.setRecords(records);
    if (log.check(POILogger.DEBUG))
        log.log(DEBUG, "exit create new workbook from scratch");
    return retval;
}

6. CopyTest#testNested()

Project: kryo
Source File: CopyTest.java
View license
public void testNested() {
    ArrayList test = new ArrayList();
    test.add("one");
    test.add("two");
    test.add("three");
    ArrayList test2 = new ArrayList();
    test2.add(1);
    test2.add(2f);
    test2.add(3d);
    test2.add((byte) 4);
    test2.add((short) 5);
    test.add(test2);
    ArrayList copy = kryo.copy(test);
    assertTrue(test != copy);
    assertTrue(test.get(3) != copy.get(3));
    assertEquals(test, copy);
}

7. CopyTest#testShallow()

Project: kryo
Source File: CopyTest.java
View license
public void testShallow() {
    ArrayList test = new ArrayList();
    test.add("one");
    test.add("two");
    test.add("three");
    ArrayList test2 = new ArrayList();
    test2.add(1);
    test2.add(2f);
    test2.add(3d);
    test2.add((byte) 4);
    test2.add((short) 5);
    test.add(test2);
    ArrayList copy = kryo.copyShallow(test);
    assertTrue(test != copy);
    assertTrue(test.get(3) == copy.get(3));
    assertEquals(test, copy);
}

8. SharedActivationGroupDescriptor#toString()

View license
public String toString() {
    ArrayList fields = new ArrayList(8);
    fields.add(policy);
    fields.add(classpath);
    fields.add(log);
    fields.add(serverCommand);
    fields.add(Arrays.asList(serverOptions));
    fields.add(serverProperties);
    fields.add(host);
    fields.add(new Integer(port));
    return fields.toString();
}

9. NonActivatableServiceDescriptor#toString()

View license
/** Prints out a field summary */
public String toString() {
    ArrayList fields = new ArrayList(7);
    fields.add(codebase);
    fields.add(policy);
    fields.add(classpath);
    fields.add(implClassName);
    fields.add(((serverConfigArgs == null) ? null : Arrays.asList(serverConfigArgs)));
    fields.add(lifeCycle);
    fields.add(servicePreparer);
    return fields.toString();
}

10. Sheet#createSheet()

Project: bioformats
Source File: Sheet.java
View license
/**
     * Creates a sheet with all the usual records minus values and the "index"
     * record (not required).  Sets the location pointer to where the first value
     * records should go.  Use this to create a sheet from "scratch".
     *
     * @return Sheet object with all values set to defaults
     */
public static Sheet createSheet() {
    if (log.check(POILogger.DEBUG))
        log.log(POILogger.DEBUG, "Sheet createsheet from scratch called");
    Sheet retval = new Sheet();
    ArrayList records = new ArrayList(30);
    records.add(retval.createBOF());
    // records.add(retval.createIndex());
    records.add(retval.createCalcMode());
    records.add(retval.createCalcCount());
    records.add(retval.createRefMode());
    records.add(retval.createIteration());
    records.add(retval.createDelta());
    records.add(retval.createSaveRecalc());
    records.add(retval.createPrintHeaders());
    retval.printGridlines = (PrintGridlinesRecord) retval.createPrintGridlines();
    records.add(retval.printGridlines);
    retval.gridset = (GridsetRecord) retval.createGridset();
    records.add(retval.gridset);
    records.add(retval.createGuts());
    retval.defaultrowheight = (DefaultRowHeightRecord) retval.createDefaultRowHeight();
    records.add(retval.defaultrowheight);
    records.add(retval.createWSBool());
    retval.rowBreaks = new PageBreakRecord(PageBreakRecord.HORIZONTAL_SID);
    records.add(retval.rowBreaks);
    retval.colBreaks = new PageBreakRecord(PageBreakRecord.VERTICAL_SID);
    records.add(retval.colBreaks);
    retval.header = (HeaderRecord) retval.createHeader();
    records.add(retval.header);
    retval.footer = (FooterRecord) retval.createFooter();
    records.add(retval.footer);
    records.add(retval.createHCenter());
    records.add(retval.createVCenter());
    retval.printSetup = (PrintSetupRecord) retval.createPrintSetup();
    records.add(retval.printSetup);
    retval.defaultcolwidth = (DefaultColWidthRecord) retval.createDefaultColWidth();
    records.add(retval.defaultcolwidth);
    ColumnInfoRecordsAggregate columns = new ColumnInfoRecordsAggregate();
    records.add(columns);
    retval.columns = columns;
    retval.dims = (DimensionsRecord) retval.createDimensions();
    records.add(retval.dims);
    retval.dimsloc = records.size() - 1;
    records.add(retval.windowTwo = retval.createWindowTwo());
    retval.setLoc(records.size() - 1);
    retval.selection = (SelectionRecord) retval.createSelection();
    records.add(retval.selection);
    retval.protect = (ProtectRecord) retval.createProtect();
    records.add(retval.protect);
    records.add(retval.createEOF());
    retval.records = records;
    if (log.check(POILogger.DEBUG))
        log.log(POILogger.DEBUG, "Sheet createsheet from scratch exit");
    return retval;
}

11. SortTest#testSort()

Project: ant-ivy
Source File: SortTest.java
View license
public void testSort() throws Exception {
    Ivy ivy = new Ivy();
    ivy.configureDefault();
    toSort = new ArrayList(Arrays.asList(new Object[] { md[0], md[2], md[1], md[3] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
    toSort = new ArrayList(Arrays.asList(new Object[] { md[0], md[1], md[2], md[3] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
    toSort = new ArrayList(Arrays.asList(new Object[] { md[1], md[0], md[2], md[3] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
    toSort = new ArrayList(Arrays.asList(new Object[] { md[1], md[2], md[0], md[3] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
    toSort = new ArrayList(Arrays.asList(new Object[] { md[2], md[1], md[0], md[3] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
    toSort = new ArrayList(Arrays.asList(new Object[] { md[2], md[0], md[1], md[3] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
    toSort = new ArrayList(Arrays.asList(new Object[] { md[1], md[3], md[2], md[0] }));
    assertSorted(md, ivy.sortModuleDescriptors(toSort));
}

12. RPCCallTest#testmultiArrays()

Project: axis2-java
Source File: RPCCallTest.java
View license
public void testmultiArrays() throws AxisFault {
    RPCServiceClient sender = getRPCClient("EchoXMLService", "multiArrays");
    ArrayList args = new ArrayList();
    String[] values = new String[] { "abc", "cde", "efg" };
    args.add(values);
    String[] values2 = new String[] { "abc", "cde", "efg" };
    args.add(values2);
    String[] values3 = new String[] { "abc", "cde", "efg" };
    args.add(values3);
    args.add("10");
    ArrayList ret = new ArrayList();
    ret.add(Integer.class);
    Object[] objs = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "multiArrays", "req"), args.toArray(), (Class[]) ret.toArray(new Class[ret.size()]));
    assertNotNull(objs);
    assertEquals(19, Integer.parseInt(objs[0].toString()));
}

13. FilteringIteratorTest#testRemove()

Project: consulo
Source File: FilteringIteratorTest.java
View license
public void testRemove() {
    ArrayList collection = new ArrayList();
    collection.add(new Integer(1));
    collection.add("x");
    collection.add(new Integer(2));
    collection.add("2");
    collection.add("x");
    Object[] expected = new Object[] { new Integer(1), new Integer(2), "2" };
    checkRemove(expected, collection);
    collection.add(0, "x");
    checkRemove(expected, collection);
}

14. FilteringIteratorTest#testRemove()

View license
public void testRemove() {
    ArrayList collection = new ArrayList();
    collection.add(new Integer(1));
    collection.add("x");
    collection.add(new Integer(2));
    collection.add("2");
    collection.add("x");
    Object[] expected = new Object[] { new Integer(1), new Integer(2), "2" };
    checkRemove(expected, collection);
    collection.add(0, "x");
    checkRemove(expected, collection);
}

15. DavaDecompileFolderLauncher#setCmd()

View license
/**
	 * Method getCmd.
	 * @return String
	 */
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    commands.add(getProcessPath() + getSootClasspath().getSeparator() + getClasspathAppend());
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    commands.add("--" + LaunchCommands.PROCESS_PATH);
    commands.add(getProcessPath());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.DAVA);
    getSootCommandList().addSingleOpt(commands);
}

16. DavaDecompileProjectLauncher#setCmd()

View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    commands.add(getProcess_path() + getSootClasspath().getSeparator() + getClasspathAppend());
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    commands.add("--" + LaunchCommands.PROCESS_PATH);
    commands.add(getProcess_path());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.DAVA);
    getSootCommandList().addSingleOpt(commands);
}

17. SootJimpleProjectLauncher#setCmd()

View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    commands.add(getProcess_path() + getSootClasspath().getSeparator() + getClasspathAppend());
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    commands.add("--" + LaunchCommands.PROCESS_PATH);
    commands.add(getProcess_path());
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.OUTPUT, LaunchCommands.JIMPLE_OUT);
    getSootCommandList().addSingleOpt(commands);
}

18. PartDiversionTransporter#getSyncPacket()

View license
@Override
public ArrayList getSyncPacket(TransporterStack stack, boolean kill) {
    ArrayList data = super.getSyncPacket(stack, kill);
    data.add(modes[0]);
    data.add(modes[1]);
    data.add(modes[2]);
    data.add(modes[3]);
    data.add(modes[4]);
    data.add(modes[5]);
    return data;
}

19. JettisonMappedXmlDriverTest#testWriteHierarchy()

View license
public void testWriteHierarchy() {
    Category category = new Category("fruit", "111");
    ArrayList products = new ArrayList();
    Product banana = new Product("Banana", "123", 23.01);
    ArrayList bananaTags = new ArrayList();
    bananaTags.add("yellow");
    bananaTags.add("fresh");
    bananaTags.add("tasty");
    banana.setTags(bananaTags);
    products.add(banana);
    Product mango = new Product("Mango", "124", 34.01);
    products.add(mango);
    category.setProducts(products);
    String result = xstream.toXML(category);
    assertEquals(HIERARCHY, result);
}

20. JettisonMappedXmlDriverTest#testListWithComplexNestedObjects()

View license
public void testListWithComplexNestedObjects() {
    ArrayList list1 = new ArrayList();
    list1.add(new Product("Banana", "123", 23.00));
    list1.add(new Product("Apple", "47", 11.00));
    list1.add(new Product("Orange", "100", 42.00));
    ArrayList tags = new ArrayList();
    ((Product) list1.get(1)).setTags(tags);
    tags.add(new Product("Braeburn", "47.1", 10.00));
    String json = xstream.toXML(list1);
    assertEquals((JVM.is15() ? "{'list':[{'product':[{'name':'Banana','id':123,'price':23},{'name':'Apple','id':47,'price':11,'tags':[{'product':{'name':'Braeburn','id':47.1,'price':10}}]},{'name':'Orange','id':100,'price':42}]}]}" : "{'list':{'product':[{'name':'Banana','id':123,'price':23},{'name':'Apple','id':47,'price':11,'tags':{'product':[{'name':'Braeburn','id':47.1,'price':10}]}},{'name':'Orange','id':100,'price':42}]}}").replace('\'', '"'), json);
    ArrayList list2 = (ArrayList) xstream.fromXML(json);
    assertEquals(json, xstream.toXML(list2));
}

21. FeatureDictionaryTest#makeDenseFeatureVector()

View license
public FeatureVector makeDenseFeatureVector(String id, double v1, double v2) {
    ArrayList list = new ArrayList<Double>();
    list.add(v1);
    list.add(v2);
    HashMap denseFeatures = new HashMap<String, List<Double>>();
    denseFeatures.put("a", list);
    ArrayList list2 = new ArrayList<Double>();
    list2.add(v2);
    list2.add(v1);
    denseFeatures.put("b", list2);
    Set<String> list3 = new HashSet<>();
    list3.add(id);
    Map<String, Set<String>> stringFeatures = new HashMap<>();
    stringFeatures.put("id", list3);
    FeatureVector featureVector = new FeatureVector();
    featureVector.setDenseFeatures(denseFeatures);
    featureVector.setStringFeatures(stringFeatures);
    return featureVector;
}

22. StreamUtil#makeJavaCommand()

Project: hadoop-20
Source File: StreamUtil.java
View license
public static String makeJavaCommand(Class main, String[] argv) {
    ArrayList vargs = new ArrayList();
    File javaHomeBin = new File(System.getProperty("java.home"), "bin");
    File jvm = new File(javaHomeBin, "java");
    vargs.add(jvm.toString());
    // copy parent classpath
    vargs.add("-classpath");
    vargs.add("\"" + System.getProperty("java.class.path") + "\"");
    // add heap-size limit
    vargs.add("-Xmx" + Runtime.getRuntime().maxMemory());
    // Add main class and its arguments
    vargs.add(main.getName());
    for (int i = 0; i < argv.length; i++) {
        vargs.add(argv[i]);
    }
    return collate(vargs, " ");
}

23. StreamUtil#makeJavaCommand()

Project: hadoop-common
Source File: StreamUtil.java
View license
public static String makeJavaCommand(Class main, String[] argv) {
    ArrayList vargs = new ArrayList();
    File javaHomeBin = new File(System.getProperty("java.home"), "bin");
    File jvm = new File(javaHomeBin, "java");
    vargs.add(jvm.toString());
    // copy parent classpath
    vargs.add("-classpath");
    vargs.add("\"" + System.getProperty("java.class.path") + "\"");
    // add heap-size limit
    vargs.add("-Xmx" + Runtime.getRuntime().maxMemory());
    // Add main class and its arguments
    vargs.add(main.getName());
    for (int i = 0; i < argv.length; i++) {
        vargs.add(argv[i]);
    }
    return collate(vargs, " ");
}

24. StreamUtil#makeJavaCommand()

Project: hadoop-mapreduce
Source File: StreamUtil.java
View license
public static String makeJavaCommand(Class main, String[] argv) {
    ArrayList vargs = new ArrayList();
    File javaHomeBin = new File(System.getProperty("java.home"), "bin");
    File jvm = new File(javaHomeBin, "java");
    vargs.add(jvm.toString());
    // copy parent classpath
    vargs.add("-classpath");
    vargs.add("\"" + System.getProperty("java.class.path") + "\"");
    // add heap-size limit
    vargs.add("-Xmx" + Runtime.getRuntime().maxMemory());
    // Add main class and its arguments
    vargs.add(main.getName());
    for (int i = 0; i < argv.length; i++) {
        vargs.add(argv[i]);
    }
    return collate(vargs, " ");
}

25. ClientExam2#main()

Project: hprose-java
Source File: ClientExam2.java
View license
public static void main(String[] args) throws Throwable {
    HproseHttpClient client = new HproseHttpClient();
    client.useService("http://localhost:8084/examserver/Methods");
    System.out.println(client.invoke("ex1_sum", new Object[] { new int[] { 1, 2, 3, 4, 5 } }));
    System.out.println(client.invoke("ex1_sum", new Object[] { new short[] { 6, 7, 8, 9, 10 } }));
    System.out.println(client.invoke("ex1_sum", new Object[] { new long[] { 11, 12, 13, 14, 15 } }));
    System.out.println(client.invoke("ex1_sum", new Object[] { new double[] { 16, 17, 18, 19, 20 } }));
    System.out.println(client.invoke("ex1_sum", new Object[] { new String[] { "21", "22", "23", "24", "25" } }));
    ArrayList intList = new ArrayList();
    intList.add(26);
    intList.add(27);
    intList.add(28);
    intList.add(29);
    intList.add(30);
    System.out.println(client.invoke("ex2_sum", new Object[] { intList }, double.class));
}

26. ClientExam6#main()

Project: hprose-java
Source File: ClientExam6.java
View license
public static void main(String[] args) throws IOException {
    HproseHttpClient client = new HproseHttpClient();
    client.useService("http://localhost:8084/examserver/Methods");
    IExam1 exam = client.useService(IExam1.class, "ex1");
    System.out.println(exam.sum(new int[] { 1, 2, 3, 4, 5 }));
    System.out.println(exam.sum(new short[] { 6, 7, 8, 9, 10 }));
    System.out.println(exam.sum(new long[] { 11, 12, 13, 14, 15 }));
    System.out.println(exam.sum(new double[] { 16, 17, 18, 19, 20 }));
    System.out.println(exam.sum(new String[] { "21", "22", "23", "24", "25" }));
    ArrayList intList = new ArrayList();
    intList.add(26);
    intList.add(27);
    intList.add(28);
    intList.add(29);
    intList.add(30);
    System.out.println(exam.sum(intList));
}

27. ReferenceTest#testReadingNestedObjectsFirst()

Project: kryo
Source File: ReferenceTest.java
View license
public void testReadingNestedObjectsFirst() {
    ArrayList list = new ArrayList();
    list.add("1");
    list.add("1");
    list.add("2");
    list.add("1");
    list.add("1");
    List subList = list.subList(0, 5);
    kryo.setRegistrationRequired(false);
    kryo.register(ArrayList.class);
    Class<List> subListClass = (Class<List>) subList.getClass();
    if (subListClass.getName().equals("java.util.ArrayList$SubList")) {
        // This is JDK > = 1.7
        kryo.register(subList.getClass(), new ArraySubListSerializer());
    } else {
        kryo.register(subList.getClass(), new SubListSerializer());
    }
    roundTrip(26, 26, subList);
}

28. SaveKeyringParcel#reset()

View license
public void reset() {
    mNewUnlock = null;
    mAddUserIds = new ArrayList<>();
    mAddUserAttribute = new ArrayList<>();
    mAddSubKeys = new ArrayList<>();
    mChangePrimaryUserId = null;
    mChangeSubKeys = new ArrayList<>();
    mRevokeUserIds = new ArrayList<>();
    mRevokeSubKeys = new ArrayList<>();
    mSecurityTokenPin = null;
    mSecurityTokenAdminPin = null;
    mUpload = false;
    mUploadAtomic = false;
    mKeyserver = null;
}

29. TestDeser#testSparseArray1()

Project: axis1-java
Source File: TestDeser.java
View license
public void testSparseArray1() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add(null);
    list.add(null);
    list.add("abc");
    list.add("def");
    boolean expectedExceptionThrown = false;
    try {
        deserialize(HEAD + "<result xsi:type=\"soapenc:Array\" " + "soapenc:itemType=\"xsd:string\" soapenc:arraySize=\"4\" " + " soapenc:offset=\"[2]\">" + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>" + TAIL, list, true);
    } catch (Exception af) {
        String expected = Messages.getMessage("noSparseArray");
        if (af.toString().indexOf(expected) != -1)
            expectedExceptionThrown = true;
    }
    assertTrue(expectedExceptionThrown);
}

30. TestDeser#testSparseArray2()

Project: axis1-java
Source File: TestDeser.java
View license
public void testSparseArray2() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add("abc");
    list.add(null);
    list.add("def");
    list.add(null);
    boolean expectedExceptionThrown = false;
    try {
        deserialize(HEAD + "<result xsi:type=\"soapenc:Array\" " + "soapenc:itemType=\"xsd:string\" soapenc:arraySize=\"4\">" + "<item soapenc:position=\"[0]\" xsi:type=\"xsd:string\">abc</item>" + "<item soapenc:position=\"[2]\" xsi:type=\"xsd:string\">def</item>" + "</result>" + TAIL, list, true);
    } catch (Exception af) {
        String expected = Messages.getMessage("noSparseArray");
        if (af.toString().indexOf(expected) != -1)
            expectedExceptionThrown = true;
    }
    assertTrue(expectedExceptionThrown);
}

31. TestDeser#testSparseArray1()

Project: axis1-java
Source File: TestDeser.java
View license
public void testSparseArray1() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add(null);
    list.add(null);
    list.add("abc");
    list.add("def");
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:string[4]\" " + "soapenc:offset=\"[2]\"> " + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>", list, true);
}

32. ADBXMLStreamReaderTest#testNullableAttribute()

View license
/** Test a completely null element */
public void testNullableAttribute() throws Exception {
    /*
        This is what I expect :

        */
    String exptectedXML = "<Person xmlns=\"\"><Name xmlns=\"\">FooOne</Name><DependentOne xmlns=\"\" " + "xsi:nil=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>" + "</Person>";
    ArrayList propertyList = new ArrayList();
    propertyList.add("Name");
    propertyList.add("FooOne");
    propertyList.add(new QName("DependentOne"));
    propertyList.add(null);
    QName projectQName = new QName("Person");
    XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(projectQName, propertyList.toArray(), null);
    Document actualDom = newDocument(getStringXML(pullParser));
    Document expectedDocument = newDocument(exptectedXML);
    assertXMLEqual(actualDom, expectedDocument);
}

33. ModelComparator#compareModels()

Project: ddlutils
Source File: ModelComparator.java
View license
/**
     * Compares the given source and target models and creates change objects to get from
     * the source to the target one. These changes will be applied to the given
     * intermediate model (the other two won't be changed), so that it will be equal to
     * the target model after this model has finished.
     * 
     * @param sourceModel       The source model
     * @param intermediateModel The intermediate model to apply the changes to
     * @param targetModel       The target model
     * @return The changes
     */
protected List compareModels(Database sourceModel, Database intermediateModel, Database targetModel) {
    ArrayList changes = new ArrayList();
    changes.addAll(checkForRemovedForeignKeys(sourceModel, intermediateModel, targetModel));
    changes.addAll(checkForRemovedTables(sourceModel, intermediateModel, targetModel));
    for (int tableIdx = 0; tableIdx < intermediateModel.getTableCount(); tableIdx++) {
        Table intermediateTable = intermediateModel.getTable(tableIdx);
        Table sourceTable = sourceModel.findTable(intermediateTable.getName(), _caseSensitive);
        Table targetTable = targetModel.findTable(intermediateTable.getName(), _caseSensitive);
        List tableChanges = compareTables(sourceModel, sourceTable, intermediateModel, intermediateTable, targetModel, targetTable);
        changes.addAll(tableChanges);
    }
    changes.addAll(checkForAddedTables(sourceModel, intermediateModel, targetModel));
    changes.addAll(checkForAddedForeignKeys(sourceModel, intermediateModel, targetModel));
    return changes;
}

34. SerializerTest#TestListArray()

Project: Gaea
Source File: SerializerTest.java
View license
@Test
public void TestListArray() throws Exception {
    Serializer serializer = new Serializer();
    ArrayList a1 = new ArrayList();
    a1.add(1);
    ArrayList a2 = new ArrayList();
    a2.add(2);
    Object data = new ArrayList[] { a1, a2 };
    byte[] buffer = serializer.Serialize(data);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, data.getClass());
    Object expect = data;
    Object a = Array.newInstance(List.class, 3);
    assertEquals(expect, obj);
    ArrayList[] abc = (ArrayList[]) obj;
}

35. StreamUtil#makeJavaCommand()

Project: hadoop-20
Source File: StreamUtil.java
View license
public static String makeJavaCommand(Class main, String[] argv) {
    ArrayList vargs = new ArrayList();
    File javaHomeBin = new File(System.getProperty("java.home"), "bin");
    File jvm = new File(javaHomeBin, "java");
    vargs.add(jvm.toString());
    // copy parent classpath
    vargs.add("-classpath");
    vargs.add("\"" + System.getProperty("java.class.path") + "\"");
    // Add main class and its arguments
    vargs.add(main.getName());
    for (int i = 0; i < argv.length; i++) {
        vargs.add(argv[i]);
    }
    return collate(vargs, " ");
}

36. ArrayListTest#test_ArrayList_addAll_scenario1()

Project: j2objc
Source File: ArrayListTest.java
View license
public void test_ArrayList_addAll_scenario1() {
    ArrayList arrayListA = new ArrayList();
    arrayListA.add(1);
    ArrayList arrayListB = new ArrayList();
    arrayListB.add(1);
    arrayListA.addAll(1, arrayListB);
    int size = arrayListA.size();
    assertEquals(2, size);
    for (int index = 0; index < size; index++) {
        assertEquals(1, arrayListA.get(index));
    }
}

37. CollectionsTest#test_copy_check_index()

Project: j2objc
Source File: CollectionsTest.java
View license
/**
	 * @tests java.util.Collections#copy(java.util.List, java.util.List)
	 */
public void test_copy_check_index() {
    ArrayList a1 = new ArrayList();
    a1.add("one");
    a1.add("two");
    ArrayList a2 = new ArrayList();
    a2.add("aa");
    try {
        Collections.copy(a2, a1);
        fail("Expected IndexOutOfBoundsException");
    } catch (IndexOutOfBoundsException e) {
    }
    assertEquals("aa", a2.get(0));
}

38. SootGrimpFromJavaFileLauncher#setCmd()

View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    commands.add(getClasspathAppend());
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.OUTPUT, LaunchCommands.GRIMP_OUT);
    if (isExtraCmd()) {
        getSootCommandList().addSingleOpt("--" + getExtraCmd());
    }
    if (isSrcPrec()) {
        getSootCommandList().addDoubleOpt("--" + LaunchCommands.SRC_PREC, getSrcPrec());
    }
    Iterator it = getToProcessList().iterator();
    while (it.hasNext()) {
        commands.add((String) it.next());
    }
    getSootCommandList().addSingleOpt(commands);
}

39. SootJimpleFileLauncher#setCmd()

Project: JAADAS
Source File: SootJimpleFileLauncher.java
View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    commands.add(getClasspathAppend());
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.OUTPUT, LaunchCommands.JIMPLE_OUT);
    if (isExtraCmd()) {
        getSootCommandList().addSingleOpt("--" + getExtraCmd());
    }
    if (isSrcPrec()) {
        getSootCommandList().addDoubleOpt("--" + LaunchCommands.SRC_PREC, getSrcPrec());
    }
    Iterator it = getToProcessList().iterator();
    while (it.hasNext()) {
        commands.add((String) it.next());
    }
    getSootCommandList().addSingleOpt(commands);
}

40. SootJimpleFromJavaFileLauncher#setCmd()

View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    commands.add(getClasspathAppend());
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.OUTPUT, LaunchCommands.JIMPLE_OUT);
    if (isExtraCmd()) {
        getSootCommandList().addSingleOpt("--" + getExtraCmd());
    }
    if (isSrcPrec()) {
        getSootCommandList().addDoubleOpt("--" + LaunchCommands.SRC_PREC, getSrcPrec());
    }
    Iterator it = getToProcessList().iterator();
    while (it.hasNext()) {
        commands.add((String) it.next());
    }
    getSootCommandList().addSingleOpt(commands);
}

41. SootJimpleJavaProjectLauncher#setCmd()

View license
private void setCmd() {
    ArrayList commands = new ArrayList();
    commands.add("--" + LaunchCommands.SOOT_CLASSPATH);
    Iterator it = getJavaProcessPath().iterator();
    String cp = (String) it.next();
    while (it.hasNext()) {
        cp = cp + getSootClasspath().getSeparator() + (String) it.next();
    }
    cp = cp + getSootClasspath().getSeparator() + getClasspathAppend();
    commands.add(cp);
    commands.add("--" + LaunchCommands.OUTPUT_DIR);
    commands.add(getOutputLocation());
    getSootCommandList().addSingleOpt("--" + LaunchCommands.KEEP_LINE_NUMBER);
    getSootCommandList().addSingleOpt("--" + LaunchCommands.XML_ATTRIBUTES);
    Iterator it2 = getJavaProcessPath().iterator();
    while (it2.hasNext()) {
        commands.add("--" + LaunchCommands.PROCESS_PATH);
        commands.add((String) it2.next());
    }
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.OUTPUT, LaunchCommands.JIMPLE_OUT);
    getSootCommandList().addDoubleOpt("--" + LaunchCommands.SRC_PREC, "java");
    getSootCommandList().addSingleOpt(commands);
}

42. AnnotationSimpleQueryTest#importData()

View license
private void importData() throws JcrMappingException {
    ObjectContentManager ocm = getObjectContentManager();
    Page page = new Page();
    page.setPath("/test");
    page.setTitle("Page Title");
    ArrayList paragraphs = new ArrayList();
    paragraphs.add(new Paragraph("Para 1"));
    paragraphs.add(new Paragraph("Para 2"));
    paragraphs.add(new Paragraph("Para 3"));
    paragraphs.add(new Paragraph("Another Para "));
    page.setParagraphs(paragraphs);
    ocm.insert(page);
    ocm.save();
}

43. ErrataHandlerTest#testAdvisoryReleaseAtMax()

Project: spacewalk
Source File: ErrataHandlerTest.java
View license
public void testAdvisoryReleaseAtMax() throws Exception {
    Channel channel = ChannelFactoryTest.createBaseChannel(admin);
    channel.setOrg(admin.getOrg());
    Map errataInfo = new HashMap();
    String advisoryName = TestUtils.randomString();
    populateErrataInfo(errataInfo);
    errataInfo.put("advisory_name", advisoryName);
    errataInfo.put("advisory_release", new Integer(9999));
    ArrayList packages = new ArrayList();
    ArrayList bugs = new ArrayList();
    ArrayList keywords = new ArrayList();
    ArrayList channels = new ArrayList();
    channels.add(channel.getLabel());
    Errata errata = handler.create(admin, errataInfo, bugs, keywords, packages, true, channels);
    assertEquals(ErrataManager.MAX_ADVISORY_RELEASE, errata.getAdvisoryRel().longValue());
}

44. JettisonMappedXmlDriverTest#testListWithSimpleObjects()

View license
public void testListWithSimpleObjects() {
    ArrayList list1 = new ArrayList();
    list1.add("one");
    list1.add("two");
    list1.add("three");
    String json = xstream.toXML(list1);
    assertEquals((JVM.is15() ? "{'list':[{'string':['one','two','three']}]}" : "{'list':{'string':['one','two','three']}}").replace('\'', '"'), json);
    ArrayList list2 = (ArrayList) xstream.fromXML(json);
    assertEquals(json, xstream.toXML(list2));
}

45. YamlWriterTest#testRootList()

Project: yamlbeans
Source File: YamlWriterTest.java
View license
public void testRootList() throws Exception {
    ArrayList list = new ArrayList();
    list.add(new PhoneNumber("206-555-1234"));
    list.add(new PhoneNumber("206-555-4321"));
    list.add(new PhoneNumber("206-555-6789"));
    list.add(new PhoneNumber("206-555-9876"));
    List roundTrip = roundTrip(list, ArrayList.class, new YamlConfig());
    assertEquals("206-555-1234", ((PhoneNumber) roundTrip.get(0)).number);
    assertEquals("206-555-4321", ((PhoneNumber) roundTrip.get(1)).number);
    assertEquals("206-555-6789", ((PhoneNumber) roundTrip.get(2)).number);
    assertEquals("206-555-9876", ((PhoneNumber) roundTrip.get(3)).number);
    Contact contact = new Contact();
    contact.name = "Bill";
    contact.phoneNumbers = list;
    roundTrip = roundTrip(contact, Contact.class, new YamlConfig()).phoneNumbers;
    assertEquals("206-555-1234", ((PhoneNumber) roundTrip.get(0)).number);
    assertEquals("206-555-4321", ((PhoneNumber) roundTrip.get(1)).number);
    assertEquals("206-555-6789", ((PhoneNumber) roundTrip.get(2)).number);
    assertEquals("206-555-9876", ((PhoneNumber) roundTrip.get(3)).number);
}

46. MapModule#initSides()

Project: SquidLib
Source File: MapModule.java
View license
private void initSides() {
    leftDoors = new ArrayList<>(8);
    rightDoors = new ArrayList<>(8);
    topDoors = new ArrayList<>(8);
    bottomDoors = new ArrayList<>(8);
    for (Coord dr : validDoors) {
        if (dr.x * max.y < dr.y * max.x && dr.y * max.x < (max.x - dr.x) * max.y)
            leftDoors.add(dr);
        else if (dr.x * max.y > dr.y * max.x && dr.y * max.x > (max.x - dr.x) * max.y)
            rightDoors.add(dr);
        else if (dr.x * max.y > dr.y * max.x && dr.y * max.x < (max.x - dr.x) * max.y)
            topDoors.add(dr);
        else if (dr.x * max.y < dr.y * max.x && dr.y * max.x > (max.x - dr.x) * max.y)
            bottomDoors.add(dr);
    }
}

47. CollectionActivity#initData()

View license
private void initData() {
    Collection_data_real = new ArrayList<Integer>(Arrays.asList(R.mipmap.a01, R.mipmap.a02, R.mipmap.a03, R.mipmap.a04, R.mipmap.a05, R.mipmap.a06, R.mipmap.a07, R.mipmap.a08, R.mipmap.a09, R.mipmap.a10, R.mipmap.a11, R.mipmap.a12));
    Collection_data_cartoon = new ArrayList<Integer>(Arrays.asList(R.mipmap.bg01, R.mipmap.bg02, R.mipmap.bg03, R.mipmap.bg04, R.mipmap.bg05));
    Collection_data_real_mini = new ArrayList<Integer>(Arrays.asList(R.mipmap.a01_mini, R.mipmap.a02_mini, R.mipmap.a03_mini, R.mipmap.a04_mini, R.mipmap.a05_mini, R.mipmap.a06_mini, R.mipmap.a07_mini, R.mipmap.a08_mini, R.mipmap.a09_mini, R.mipmap.a10_mini, R.mipmap.a11_mini, R.mipmap.a12_mini));
    Collection_data_cartoon_mini = new ArrayList<Integer>(Arrays.asList(R.mipmap.bg01_mini, R.mipmap.bg02_mini, R.mipmap.bg03_mini, R.mipmap.bg04_mini, R.mipmap.bg05_mini));
}

48. TreeTableDataView#getTableColunms()

Project: tapestry3
Source File: TreeTableDataView.java
View license
public ITableColumn[] getTableColunms() {
    ArrayList arrColumnsList = new ArrayList();
    arrColumnsList.add(new TreeTableColumn("Name", false, null));
    ArrayList arrTableColunms = getTableColunmsFromBinding();
    if (arrTableColunms != null)
        arrColumnsList.addAll(arrTableColunms);
    ITableColumn[] arrColumns = new ITableColumn[arrColumnsList.size()];
    arrColumnsList.toArray(arrColumns);
    return arrColumns;
}

49. PartLogisticalTransporter#getSyncPacket()

View license
public ArrayList getSyncPacket(TransporterStack stack, boolean kill) {
    ArrayList data = new ArrayList();
    data.add(1);
    data.add(kill);
    data.add(getTransmitter().transit.indexOf(stack));
    if (!kill) {
        stack.write(getTransmitter(), data);
    }
    return data;
}

50. DataStruturesTest#testRecordLocationImplComparison()

View license
public synchronized void testRecordLocationImplComparison() throws IOException {
    Location l1 = new Location(0, 1);
    Location l2 = new Location(0, 2);
    Location l3 = new Location(0, 3);
    assertTrue(l1.compareTo(l2) < 0);
    // Sort them using a list.  Put them in the wrong order.
    ArrayList l = new ArrayList();
    l.add(l2);
    l.add(l3);
    l.add(l1);
    Collections.sort(l);
    // Did they get sorted to the correct order?
    assertSame(l.get(0), l1);
    assertSame(l.get(1), l2);
    assertSame(l.get(2), l3);
}

51. TestDeser#testSparseArray2()

Project: axis1-java
Source File: TestDeser.java
View license
public void testSparseArray2() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add("abc");
    list.add(null);
    list.add("def");
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:string[4]\"> " + "<item soapenc:position=\"[0]\" xsi:type=\"xsd:string\">abc</item>" + "<item soapenc:position=\"[2]\" xsi:type=\"xsd:string\">def</item>" + "</result>", list, true);
}

52. TestDeser#testHugeSparseArray()

Project: axis1-java
Source File: TestDeser.java
View license
public void testHugeSparseArray() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add("abc");
    list.add(null);
    list.add("def");
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:string[50000000]\"> " + "<item soapenc:position=\"[0]\" xsi:type=\"xsd:string\">abc</item>" + "<item soapenc:position=\"[2]\" xsi:type=\"xsd:string\">def</item>" + "</result>", list, true);
}

53. TestDeser1999#testArrayWithNullInt()

Project: axis1-java
Source File: TestDeser1999.java
View license
public void testArrayWithNullInt() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add(new Integer(1));
    list.add(null);
    list.add(new Integer(3));
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:int[3]\"> " + "<item xsi:type=\"xsd:int\">1</item>" + "<item xsi:null=\"true\"/>" + "<item xsi:type=\"xsd:int\">3</item>" + "</result>", list, true);
}

54. TestDeser1999#testArrayWithNullString()

Project: axis1-java
Source File: TestDeser1999.java
View license
public void testArrayWithNullString() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add("abc");
    list.add(null);
    list.add("def");
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:string[3]\"> " + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:null=\"true\"/>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>", list, true);
}

55. TestDeser2000#testArrayWithNullInt()

Project: axis1-java
Source File: TestDeser2000.java
View license
public void testArrayWithNullInt() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add(new Integer(1));
    list.add(null);
    list.add(new Integer(3));
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:int[3]\"> " + "<item xsi:type=\"xsd:int\">1</item>" + "<item xsi:null=\"true\"/>" + "<item xsi:type=\"xsd:int\">3</item>" + "</result>", list, true);
}

56. TestDeser2000#testArrayWithNullString()

Project: axis1-java
Source File: TestDeser2000.java
View license
public void testArrayWithNullString() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add("abc");
    list.add(null);
    list.add("def");
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:string[3]\"> " + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:null=\"true\"/>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>", list, true);
}

57. TestDeser2001#testArrayWithNilInt()

Project: axis1-java
Source File: TestDeser2001.java
View license
public void testArrayWithNilInt() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add(new Integer(1));
    list.add(null);
    list.add(new Integer(3));
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:int[3]\"> " + "<item xsi:type=\"xsd:int\">1</item>" + "<item xsi:nil=\"true\"/>" + "<item xsi:type=\"xsd:int\">3</item>" + "</result>", list, true);
}

58. TestDeser2001#testArrayWithNilString()

Project: axis1-java
Source File: TestDeser2001.java
View license
public void testArrayWithNilString() throws Exception {
    ArrayList list = new ArrayList(4);
    list.add("abc");
    list.add(null);
    list.add("def");
    deserialize("<result xsi:type=\"soapenc:Array\" " + "soapenc:arrayType=\"xsd:string[3]\"> " + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:nil=\"true\"/>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>", list, true);
}

59. RPCCallTest#testechoBean2()

Project: axis2-java
Source File: RPCCallTest.java
View license
////////////////////////////////////////////////// Invoking by Passing Return types //////////
public void testechoBean2() throws AxisFault {
    RPCServiceClient sender = getRPCClient("EchoXMLService", "echoBean");
    MyBean bean = new MyBean();
    bean.setAge(100);
    bean.setName("Deepal");
    bean.setValue(false);
    AddressBean ab = new AddressBean();
    ab.setNumber(1010);
    ab.setTown("Colombo3");
    bean.setAddress(ab);
    ArrayList args = new ArrayList();
    args.add(bean);
    ArrayList ret = new ArrayList();
    ret.add(MyBean.class);
    Object[] response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoBean", "req"), args.toArray(), (Class[]) ret.toArray(new Class[ret.size()]));
    MyBean resBean = (MyBean) response[0];
    assertNotNull(resBean);
    assertEquals(resBean.getAge(), 100);
}

60. RPCCallTest#testechoInt2()

Project: axis2-java
Source File: RPCCallTest.java
View license
public void testechoInt2() throws AxisFault {
    RPCServiceClient sender = getRPCClient("EchoXMLService", "echoInt");
    ArrayList args = new ArrayList();
    args.add("100");
    ArrayList ret = new ArrayList();
    ret.add(Integer.class);
    Object[] response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "echoInt", "req"), args.toArray(), (Class[]) ret.toArray(new Class[ret.size()]));
    assertEquals(((Integer) response[0]).intValue(), 100);
}

61. RPCCallTest#testStringArray()

Project: axis2-java
Source File: RPCCallTest.java
View license
//    public void testmultireturn() throws AxisFault {
//        configureSystem("multireturn");
//
//        Options options = new Options();
//        options.setTo(targetEPR);
//        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
//
//        ConfigurationContext configContext =
//                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
//        RPCServiceClient sender = new RPCServiceClient(configContext, null);
//        sender.setOptions(options);
//
//        ArrayList args = new ArrayList();
//        args.add("1");
//
//        ArrayList ret = new ArrayList();
//        ret.add(Integer.class);
//        ret.add(String.class);
//
//        Object [] response = sender.invokeBlocking(operationName, args.toArray(), ret.toArray());
//        assertEquals(((Integer) response[0]).intValue(), 10);
//        assertEquals(response[1], "foo");
//    }
public void testStringArray() throws AxisFault {
    RPCServiceClient sender = getRPCClient("EchoXMLService", "handleStringArray");
    ArrayList args = new ArrayList();
    String[] values = new String[] { "abc", "cde", "efg" };
    args.add(values);
    ArrayList ret = new ArrayList();
    ret.add(Boolean.class);
    Object[] objs = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "handleStringArray", "req"), args.toArray(), (Class[]) ret.toArray(new Class[ret.size()]));
    assertNotNull(objs);
    assertEquals(Boolean.TRUE, Boolean.valueOf(objs[0].toString()));
}

62. RPCServiceClass#mulReturn()

Project: axis2-java
Source File: RPCServiceClass.java
View license
/**
     * This methods return mutiple object , so it creat an Object array and retuen that so , if a
     * method want to return mutiple value , this way can be used
     *
     * @param obj
     * @return Object []
     */
public Object[] mulReturn(OMElement obj) {
    ArrayList objs = new ArrayList();
    objs.add(new Integer(100));
    MyBean bean = new MyBean();
    bean.setAge(100);
    bean.setName("Deepal");
    bean.setValue(false);
    AddressBean ab = new AddressBean();
    ab.setNumber(1010);
    ab.setTown("Colombo3");
    bean.setAddress(ab);
    objs.add(bean);
    return objs.toArray();
}

63. CodeGenerationUtility#findPlainBase64Types()

View license
/**
     * @param sts
     * @return array list
     */
private static List findPlainBase64Types(SchemaTypeSystem sts) {
    ArrayList allSeenTypes = new ArrayList();
    allSeenTypes.addAll(Arrays.asList(sts.documentTypes()));
    allSeenTypes.addAll(Arrays.asList(sts.globalTypes()));
    ArrayList base64Types = new ArrayList();
    for (Iterator iterator = allSeenTypes.iterator(); iterator.hasNext(); ) {
        SchemaType stype = (SchemaType) iterator.next();
        findPlainBase64Types(stype, base64Types, new ArrayList());
    }
    return base64Types;
}

64. ObjectGraphIteratorTest#setUp()

View license
@Override
public void setUp() {
    list1 = new ArrayList<String>();
    list1.add("One");
    list1.add("Two");
    list1.add("Three");
    list2 = new ArrayList<String>();
    list2.add("Four");
    list3 = new ArrayList<String>();
    list3.add("Five");
    list3.add("Six");
    iteratorList = new ArrayList<Iterator<String>>();
    iteratorList.add(list1.iterator());
    iteratorList.add(list2.iterator());
    iteratorList.add(list3.iterator());
}

65. TestAlgorithms#setUp()

Project: commons-functor
Source File: TestAlgorithms.java
View license
// Lifecycle
// ------------------------------------------------------------------------
@Before
public void setUp() throws Exception {
    list = new ArrayList<Integer>();
    evens = new ArrayList<Integer>();
    doubled = new ArrayList<Integer>();
    listWithDuplicates = new ArrayList<Integer>();
    sum = 0;
    for (int i = 0; i < 10; i++) {
        list.add(Integer.valueOf(i));
        doubled.add(Integer.valueOf(i * 2));
        listWithDuplicates.add(Integer.valueOf(i));
        listWithDuplicates.add(Integer.valueOf(i));
        sum += i;
        if (i % 2 == 0) {
            evens.add(Integer.valueOf(i));
        }
    }
}

66. Bug2562DeserializedUnkeyedListTest#writeRoot()

View license
private void writeRoot(final LogicalDatastoreType store) {
    final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
    final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).setKey(new BarrootKey(2)).build();
    final ArrayList barRootList = new ArrayList();
    barRootList.add(barRoot);
    final Fooroot fooRoot = new FoorootBuilder().setBarroot(barRootList).build();
    final ArrayList fooRootList = new ArrayList();
    fooRootList.add(fooRoot);
    final Root root = new RootBuilder().setFooroot(fooRootList).build();
    readWriteTransaction.put(store, ROOT_PATH, root);
    assertCommit(readWriteTransaction.submit());
}

67. SieveCoreferenceSystem#initScorers()

Project: CoreNLP
Source File: SieveCoreferenceSystem.java
View license
public void initScorers() {
    linksCountInPass = new ArrayList<>();
    scorePairwise = new ArrayList<>();
    scoreBcubed = new ArrayList<>();
    scoreMUC = new ArrayList<>();
    for (String sieveClassName : sieveClassNames) {
        scorePairwise.add(new ScorerPairwise());
        scoreBcubed.add(new ScorerBCubed(BCubedType.Bconll));
        scoreMUC.add(new ScorerMUC());
        linksCountInPass.add(new Pair<>(0, 0));
    }
}

68. BasicFSTTest#testSimpleCollections()

View license
@Test
public void testSimpleCollections() throws Exception {
    HashMap obj = new HashMap();
    ArrayList li = new ArrayList();
    li.add("zero");
    li.add(null);
    li.add("second");
    obj.put("x", li);
    obj.put("y", li);
    obj.put("yy", null);
    obj.put(null, "asd");
    obj.put(3, "99999");
    out.writeObject(obj);
    final byte[] copyOfWrittenBuffer = out.getCopyOfWrittenBuffer();
    in.resetForReuseUseArray(copyOfWrittenBuffer);
    out.flush();
    HashMap res = (HashMap) in.readObject();
    assertTrue(res.get("x") == res.get("y"));
    assertTrue(DeepEquals.deepEquals(obj, res));
}

69. JSSessionModel#pushClass()

Project: flex-falcon
Source File: JSSessionModel.java
View license
public void pushClass(IClassDefinition currentClass) {
    Context context = new Context();
    context.bindableVars = bindableVars;
    context.interfacePropertyMap = interfacePropertyMap;
    context.propertyMap = propertyMap;
    context.staticPropertyMap = staticPropertyMap;
    context.classDefinition = this.currentClass;
    context.vars = vars;
    context.methods = methods;
    stack.push(context);
    this.currentClass = currentClass;
    bindableVars = new ArrayList<String>();
    staticPropertyMap = new LinkedHashMap<String, PropertyNodes>();
    interfacePropertyMap = new ArrayList<String>();
    propertyMap = new LinkedHashMap<String, PropertyNodes>();
    vars = new ArrayList<IVariableNode>();
    methods = new ArrayList<IFunctionNode>();
}

70. PipelineSqlMapDaoIntegrationTest#shouldGetLatestRevisionFromOrderedLists()

View license
@Test
public void shouldGetLatestRevisionFromOrderedLists() {
    PipelineSqlMapDao pipelineSqlMapDao = new PipelineSqlMapDao(null, null, null, null, null, null, null, systemEnvironment, goConfigDao, database);
    ArrayList list1 = new ArrayList();
    ArrayList list2 = new ArrayList();
    assertThat(pipelineSqlMapDao.getLatestRevisionFromOrderedLists(list1, list2), is((String) null));
    Modification modification1 = new Modification(MOD_USER, MOD_COMMENT, EMAIL_ADDRESS, YESTERDAY_CHECKIN, ModificationsMother.nextRevision());
    list1.add(modification1);
    assertThat(pipelineSqlMapDao.getLatestRevisionFromOrderedLists(list1, list2), is(ModificationsMother.currentRevision()));
    Modification modification2 = new Modification(MOD_USER_COMMITTER, MOD_COMMENT_2, EMAIL_ADDRESS, TODAY_CHECKIN, ModificationsMother.nextRevision());
    list2.add(modification2);
    assertThat(pipelineSqlMapDao.getLatestRevisionFromOrderedLists(list1, list2), is(ModificationsMother.currentRevision()));
}

71. HintCaseView#init()

Project: hintcase
Source File: HintCaseView.java
View license
private void init(HintCase hintCase) {
    setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    this.hintCase = hintCase;
    closeOnTouch = true;
    showExtraContentHolderAnimators = new ArrayList<>();
    hideExtraContentHolderAnimators = new ArrayList<>();
    hintBlock = NO_BLOCK_INFO;
    hintBlockView = NO_BLOCK_INFO_VIEW;
    extraBlocks = new ArrayList<>();
    extraBlockViews = new ArrayList<>();
    backgroundColor = DEFAULT_BACKGROUND_COLOR;
    offsetInPx = HintCase.NO_OFFSET_IN_PX;
    hintBlockPosition = DEFAULT_HINT_BLOCK_POSITION;
    basePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    navigationBarSizeIfExistAtTheBottom = DimenUtils.getNavigationBarSizeIfExistAtTheBottom(getContext());
    navigationBarSizeIfExistOnTheRight = DimenUtils.getNavigationBarSizeIfExistOnTheRight(getContext());
}

72. TypeDecl#emitBoxingOperation()

Project: JAADAS
Source File: TypeDecl.java
View license
/**
   * @ast method 
   * @aspect AutoBoxingCodegen
   * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AutoBoxingCodegen.jrag:57
   */
protected soot.Value emitBoxingOperation(Body b, soot.Value v, ASTNode location) {
    // Box the value on the stack into this Reference type
    ArrayList parameters = new ArrayList();
    parameters.add(unboxed().getSootType());
    SootMethodRef ref = Scene.v().makeMethodRef(getSootClassDecl(), "valueOf", parameters, getSootType(), true);
    ArrayList args = new ArrayList();
    args.add(asLocal(b, v));
    return b.newStaticInvokeExpr(ref, args, location);
}

73. CmsVfsConfiguration#initMembers()

View license
/**
     * @see org.opencms.configuration.A_CmsXmlConfiguration#initMembers()
     */
@Override
protected void initMembers() {
    setXmlFileName(DEFAULT_XML_FILE_NAME);
    m_fileTranslations = new ArrayList<String>();
    m_folderTranslations = new ArrayList<String>();
    m_xsdTranslations = new ArrayList<String>();
    m_defaultFiles = new ArrayList<String>();
    if (CmsLog.INIT.isInfoEnabled()) {
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_CONFIG_INIT_0));
    }
}

74. CmsHistoryClearDialog#getClearDeletedModes()

View license
/**
     * Returns a list with the possible modes for the clean deleted action.<p>
     *
     * @return a list with the possible modes for the clean deleted action
     */
private List getClearDeletedModes() {
    ArrayList ret = new ArrayList();
    ret.add(new CmsSelectWidgetOption(MODE_CLEANDELETED_KEEP_RESTORE_VERSION, getClearDeletedMode().equals(MODE_CLEANDELETED_KEEP_RESTORE_VERSION), key(Messages.GUI_HISTORY_CLEAR_DELETED_KEEPRESTORE_0)));
    ret.add(new CmsSelectWidgetOption(MODE_CLEANDELETED_DELETE_ALL, getClearDeletedMode().equals(MODE_CLEANDELETED_DELETE_ALL), key(Messages.GUI_HISTORY_CLEAR_DELETED_DELETEALL_0)));
    ret.add(new CmsSelectWidgetOption(MODE_CLEANDELETED_DELETE_NONE, getClearDeletedMode().equals(MODE_CLEANDELETED_DELETE_NONE), key(Messages.GUI_HISTORY_CLEAR_DELETED_DELETENONE_0)));
    return ret;
}

75. CmsHistorySettingsDialog#getModes()

View license
/**
     * Returns a list with the possible modes for the history to keep.<p>
     *
     * @return a list with the possible modes for the history to keep
     */
private List getModes() {
    ArrayList ret = new ArrayList();
    ret.add(new CmsSelectWidgetOption(String.valueOf(CmsHistorySettings.MODE_DELETED_HISTORY_DISABLED), m_historySettings.getMode() == CmsHistorySettings.MODE_DELETED_HISTORY_DISABLED, key(Messages.GUI_HISTORY_SETTINGS_MODE_DISABLED_0)));
    ret.add(new CmsSelectWidgetOption(String.valueOf(CmsHistorySettings.MODE_DELETED_HISTORY_KEEP_NO_VERSIONS), m_historySettings.getMode() == CmsHistorySettings.MODE_DELETED_HISTORY_KEEP_NO_VERSIONS, key(Messages.GUI_HISTORY_SETTINGS_MODE_KEEP_NO_VERSIONS_0)));
    ret.add(new CmsSelectWidgetOption(String.valueOf(CmsHistorySettings.MODE_DELETED_HISTORY_KEEP_WITH_VERSIONS), m_historySettings.getMode() == CmsHistorySettings.MODE_DELETED_HISTORY_KEEP_WITH_VERSIONS, key(Messages.GUI_HISTORY_SETTINGS_MODE_KEEP_WITH_VERSIONS_0)));
    return ret;
}

76. GraphTest#setup()

Project: parceler
Source File: GraphTest.java
View license
@Before
public void setup() {
    as = new ArrayList<A>();
    bs = new ArrayList<B>();
    cs = new ArrayList<C>();
    ds = new ArrayList<D>();
    as.add(null);
    bs.add(null);
    cs.add(null);
    ds.add(null);
}

77. QuestionPoolBean#getCheckedQuestion()

Project: sakai
Source File: QuestionPoolBean.java
View license
public void getCheckedQuestion() {
    String itemId = ContextUtil.lookupParam("itemid");
    ItemService delegate = new ItemService();
    ItemFacade itemfacade = delegate.getItem(new Long(itemId), AgentFacade.getAgentString());
    ArrayList itemIds = new ArrayList();
    itemIds.add(itemId);
    setCurrentItemIds(itemIds);
    ArrayList itemFacades = new ArrayList();
    itemFacades.add(itemfacade);
    setCurrentItems(itemFacades);
    setActionType("item");
}

78. MockConnection#clear()

Project: spacewalk
Source File: MockConnection.java
View license
public static void clear() {
    profiles = new ArrayList<Map>();
    distros = new ArrayList<Map>();
    systems = new ArrayList<Map>();
    images = new ArrayList<Map>();
    systemMap = new HashMap<String, Map>();
    profileMap = new HashMap<String, Map>();
    distroMap = new HashMap<String, Map>();
    imageMap = new HashMap<String, Map>();
}

79. AlignedJournalImplTest#setUp()

View license
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    records = new ArrayList<>();
    transactions = new ArrayList<>();
    incompleteTransactions = new ArrayList<>();
    factory = null;
    journalImpl = null;
}

80. ResideMenu#initValue()

Project: AndroidResideMenu
Source File: ResideMenu.java
View license
private void initValue(Activity activity) {
    this.activity = activity;
    leftMenuItems = new ArrayList<ResideMenuItem>();
    rightMenuItems = new ArrayList<ResideMenuItem>();
    ignoredViews = new ArrayList<View>();
    viewDecor = (ViewGroup) activity.getWindow().getDecorView();
    viewActivity = new TouchDisableView(this.activity);
    View mContent = viewDecor.getChildAt(0);
    viewDecor.removeViewAt(0);
    viewActivity.setContent(mContent);
    addView(viewActivity);
    ViewGroup parent = (ViewGroup) scrollViewLeftMenu.getParent();
    parent.removeView(scrollViewLeftMenu);
    parent.removeView(scrollViewRightMenu);
}

81. FileWordCount#setup()

Project: apex-malhar
Source File: FileWordCount.java
View license
/**
   * {@inheritDoc}
   * Initialize various map and list fields
   */
@Override
public void setup(OperatorContext context) {
    if (null == wordMapFile) {
        wordMapFile = new HashMap<>();
    }
    if (null == wordMapGlobal) {
        wordMapGlobal = new HashMap<>();
    }
    resultPerFile = new ArrayList(1);
    resultGlobal = new ArrayList(1);
    // singleton map {<fileName> => fileFinalList}; cannot populate it yet since we need fileName
    resultFileFinal = new HashMap<>(1);
    fileFinalList = new ArrayList<>();
}

82. TestDeser#testNoSizeDefinedArray()

Project: axis1-java
Source File: TestDeser.java
View license
public void testNoSizeDefinedArray() throws Exception {
    ArrayList a = new ArrayList();
    a.add("abc");
    a.add("def");
    deserialize(HEAD + "<result xsi:type=\"soapenc:Array\" " + "soapenc:itemType=\"xsd:string\" soapenc:arraySize=\"*\">" + "<item xsi:type=\"xsd:string\">abc</item>" + "<item xsi:type=\"xsd:string\">def</item>" + "</result>" + TAIL, a, true);
}

83. ADBXMLStreamReaderTest#testElementText()

View license
/** A text only element */
public void testElementText() throws Exception {
    String expectedXML = "<ns1:testElementText xmlns:ns1=\"http://testElementText.org\">" + "This is some Text for the element</ns1:testElementText>";
    ArrayList properties = new ArrayList();
    properties.add(ADBXMLStreamReader.ELEMENT_TEXT);
    properties.add("This is some Text for the element");
    XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(new QName("http://testElementText.org", "testElementText", "ns1"), properties.toArray(), null);
    String actualXML = getStringXML(pullParser);
    assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
}

84. ADBXMLStreamReaderTest#testUnQualifiedAttributes()

View license
/// todo Fails due to a bug in WSTX writer
//    /**
//     * Test multiple qualified attributes
//     * @throws XMLStreamException
//     */
//    public void testAttributesWithNamespaces() throws XMLStreamException {
//
//        String expectedXML = "<emp:Employee xmlns:emp=\"http://ec.org/software\" " +
//                "xmlns:attrNS=\"mailto:whoever@whatever.com\" attrNS:Attr2=\"Value 2\" " +
//                "attrNS:Attr3=\"Value 3\" attrNS:Attr1=\"Value 1\"\n" +
//                "              attrNS:Attr5=\"Value 5\" attrNS:Attr4=\"Value 4\"></emp:Employee>";
//
//        OMFactory factory = OMAbstractFactory.getOMFactory();
//        QName elementQName = new QName("http://ec.org/software", "Employee", "emp");
//        OMNamespace attrNS = factory.createOMNamespace("mailto:whoever@whatever.com", "attrNS");
//
//        // add some attributes with namespaces
//        OMAttribute[] attribute = new OMAttribute[5];
//        for (int i = 0; i < 5; i++) {
//            attribute[i] = factory.createOMAttribute("Attr" + (i + 1), attrNS, "Value " + (i + 1));
//        }
//
//        List omAttribList = new ArrayList();
//        for (int i = 0; i < attribute.length; i++) {
//            omAttribList.add(Constants.OM_ATTRIBUTE_KEY);
//            omAttribList.add(attribute[i]);
//        }
//        String stringXML = getStringXML(new ADBXMLStreamReaderImpl(elementQName,
//                null,
//                omAttribList.toArray()));
//        try {
//            Document actualDom = newDocument(stringXML);
//            Document expectedDocument = newDocument(expectedXML);
//            assertXMLEqual(actualDom, expectedDocument);
//        } catch (ParserConfigurationException e) {
//            fail("Exception in parsing documents " + e);
//        } catch (SAXException e) {
//            fail("Exception in parsing documents " + e);
//        } catch (IOException e) {
//            fail("Exception in parsing documents " + e);
//        }
//    }
/** test for qualified attributes */
public void testUnQualifiedAttributes() throws Exception {
    String expectedXML = "<ns1:testElementText xmlns:ns1=\"http://testElementText.org\" MyUnQualifiedAttribute=\"MyAttributeValue\">" + "<ns2:QualifiedElement xmlns:ns2=\"http://testQElementText.org\">" + "This is some Text for the element</ns2:QualifiedElement></ns1:testElementText>";
    ArrayList properties = new ArrayList();
    properties.add(new QName("http://testQElementText.org", "QualifiedElement", "ns2"));
    properties.add("This is some Text for the element");
    String[] attributes = new String[2];
    attributes[0] = "MyUnQualifiedAttribute";
    attributes[1] = "MyAttributeValue";
    XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(new QName("http://testElementText.org", "testElementText", "ns1"), properties.toArray(), attributes);
    String actualXML = getStringXML(pullParser);
    assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
}

85. ADBXMLStreamReaderTest#testBase64EncodedText()

View license
/** test for base64 */
public void testBase64EncodedText() throws Exception {
    String textTobeSent = "33344MthwrrewrIOTEN)(&**^E(W)EW";
    String expectedXML = "<ns1:testElementText xmlns:ns1=\"http://testElementText.org\">" + "<ns2:QualifiedElement xmlns:ns2=\"http://testQElementText.org\">" + Base64Utils.encode(textTobeSent.getBytes()) + "</ns2:QualifiedElement></ns1:testElementText>";
    ArrayList properties = new ArrayList();
    properties.add(new QName("http://testQElementText.org", "QualifiedElement", "ns2"));
    properties.add(new DataHandler(new ByteArrayDataSource(textTobeSent.getBytes())));
    XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(new QName("http://testElementText.org", "testElementText", "ns1"), properties.toArray(), null);
    String actualXML = getStringXML(pullParser);
    assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
}

86. ADBXMLStreamReaderTest#testQualifiedElement()

View license
/** test the qualified elements A qulified element has been associated with a namespace */
public void testQualifiedElement() throws Exception {
    String expectedXML = "<ns1:testElementText xmlns:ns1=\"http://testElementText.org\">" + "<ns2:QualifiedElement xmlns:ns2=\"http://testQElementText.org\">" + "This is some Text for the element</ns2:QualifiedElement></ns1:testElementText>";
    ArrayList properties = new ArrayList();
    properties.add(new QName("http://testQElementText.org", "QualifiedElement", "ns2"));
    properties.add("This is some Text for the element");
    XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(new QName("http://testElementText.org", "testElementText", "ns1"), properties.toArray(), null);
    String actualXML = getStringXML(pullParser);
    assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
}

87. HandlerFailureTest#setUp()

Project: axis2-java
Source File: HandlerFailureTest.java
View license
public void setUp() throws Exception {
    super.setUp();
    AxisService as = deployClassAsService(Echo.SERVICE_NAME, Echo.class);
    AxisOperation operation = as.getOperation(new QName(Echo.ECHO_OM_ELEMENT_OP_NAME));
    ArrayList phasec = new ArrayList();
    phasec.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
    operation.setRemainingPhasesInFlow(phasec);
    ArrayList phase = operation.getRemainingPhasesInFlow();
    for (int i = 0; i < phase.size(); i++) {
        Phase phase1 = (Phase) phase.get(i);
        if (PhaseMetadata.PHASE_POLICY_DETERMINATION.equals(phase1.getPhaseName())) {
            phase1.addHandler(culprit);
        }
    }
}

88. RPCCallTest#testEditBean()

Project: axis2-java
Source File: RPCCallTest.java
View license
public void testEditBean() throws AxisFault {
    RPCServiceClient sender = getRPCClient("EchoXMLService", "editBean");
    MyBean bean = new MyBean();
    bean.setAge(100);
    bean.setName("Deepal");
    bean.setValue(false);
    AddressBean ab = new AddressBean();
    ab.setNumber(1010);
    ab.setTown("Colombo3");
    bean.setAddress(ab);
    ArrayList args = new ArrayList();
    args.add(bean);
    args.add("159");
    OMElement response = sender.invokeBlocking(new QName("http://rpc.axis2.apache.org", "editBean", "req"), args.toArray());
    MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement(), new DefaultObjectSupplier(), null);
    assertNotNull(resBean);
    assertEquals(resBean.getAge(), 159);
}

89. SOAPHeaderTest#testAddUpgradeHeaderElement()

Project: axis2-java
Source File: SOAPHeaderTest.java
View license
@Validated
@Test
public void testAddUpgradeHeaderElement() throws Exception {
    javax.xml.soap.SOAPMessage soapMessage = javax.xml.soap.MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
    javax.xml.soap.SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
    javax.xml.soap.SOAPHeader header = soapEnv.getHeader();
    // create a list of supported URIs.
    ArrayList supported = new ArrayList();
    supported.add(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE);
    supported.add(SOAPConstants.URI_NS_SOAP_ENVELOPE);
    SOAPElement soapElement = header.addUpgradeHeaderElement(supported.iterator());
    assertNotNull(soapElement);
    Name name = soapElement.getElementName();
    String uri = name.getURI();
    String localName = name.getLocalName();
    //Validate the URI which must be SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE);
    assertTrue(uri.equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE));
    assertTrue(localName.equals("Upgrade"));
}

90. LibraryServiceClient#lendBook()

View license
public void lendBook(String isbn, String userName, RPCServiceClient rpcClient) throws Exception {
    rpcClient.getOptions().setAction("urn:lendBook");
    ArrayList args = new ArrayList();
    args.add(isbn);
    args.add(userName);
    Object obj[] = rpcClient.invokeBlocking(new QName("http://servicelifecycle.sample", "lendBook"), args.toArray(), new Class[] { Book.class });
    Book book = (Book) obj[0];
    System.out.println("Title : " + book.getTitle());
    System.out.println("Isbn : " + book.getIsbn());
    System.out.println("Author : " + book.getAuthor());
}

91. PreferenceImpl#getValues()

Project: cocoon
Source File: PreferenceImpl.java
View license
/**
     * @see org.apache.pluto.om.common.Preference#getValues()
     */
public Iterator getValues() {
    // replace the NULL_VALUE String by NULL
    if (value.contains(NULL_VALUE)) {
        return null;
    }
    ArrayList returnValue = new ArrayList(value.size());
    returnValue.addAll(value);
    // replace all NULL_ARRAYENTRY Strings by NULL
    for (int i = 0; i < returnValue.size(); i++) {
        if (NULL_ARRAYENTRY.equals(returnValue.get(i))) {
            returnValue.set(i, null);
        }
    }
    return returnValue.iterator();
}

92. CollatingIteratorTest#setUp()

View license
@Override
public void setUp() throws Exception {
    super.setUp();
    comparator = new ComparableComparator<Integer>();
    evens = new ArrayList<Integer>();
    odds = new ArrayList<Integer>();
    for (int i = 0; i < 20; i++) {
        if (0 == i % 2) {
            evens.add(i);
        } else {
            odds.add(i);
        }
    }
    fib = new ArrayList<Integer>();
    fib.add(1);
    fib.add(1);
    fib.add(2);
    fib.add(3);
    fib.add(5);
    fib.add(8);
    fib.add(13);
    fib.add(21);
}

93. IteratorChainTest#setUp()

View license
@Override
public void setUp() {
    list1 = new ArrayList<String>();
    list1.add("One");
    list1.add("Two");
    list1.add("Three");
    list2 = new ArrayList<String>();
    list2.add("Four");
    list3 = new ArrayList<String>();
    list3.add("Five");
    list3.add("Six");
}

94. LazyIteratorChainTest#setUp()

View license
@Override
public void setUp() {
    list1 = new ArrayList<String>();
    list1.add("One");
    list1.add("Two");
    list1.add("Three");
    list2 = new ArrayList<String>();
    list2.add("Four");
    list3 = new ArrayList<String>();
    list3.add("Five");
    list3.add("Six");
}

95. ZippingIteratorTest#setUp()

View license
@Override
public void setUp() throws Exception {
    super.setUp();
    evens = new ArrayList<Integer>();
    odds = new ArrayList<Integer>();
    for (int i = 0; i < 20; i++) {
        if (0 == i % 2) {
            evens.add(i);
        } else {
            odds.add(i);
        }
    }
    fib = new ArrayList<Integer>();
    fib.add(1);
    fib.add(1);
    fib.add(2);
    fib.add(3);
    fib.add(5);
    fib.add(8);
    fib.add(13);
    fib.add(21);
}

96. ClusterTest#clearTests()

Project: copycat
Source File: ClusterTest.java
View license
@BeforeMethod
@AfterMethod
public void clearTests() throws Exception {
    clients.forEach( c -> {
        try {
            c.close().get(10, TimeUnit.SECONDS);
        } catch (Exception e) {
        }
    });
    servers.forEach( s -> {
        try {
            if (s.isRunning()) {
                s.shutdown().get(10, TimeUnit.SECONDS);
            }
        } catch (Exception e) {
        }
    });
    members = new ArrayList<>();
    port = 5000;
    registry = new LocalServerRegistry();
    clients = new ArrayList<>();
    servers = new ArrayList<>();
}

97. BasicMinBinTest#testSimpleCollections()

View license
@Override
@Test
public void testSimpleCollections() throws Exception {
    HashMap obj = new HashMap();
    ArrayList li = new ArrayList();
    li.add("zero");
    li.add("second");
    obj.put("x", li);
    obj.put("y", li);
    obj.put(3, "99999");
    out.writeObject(obj);
    MBPrinter.printMessage(out.getBuffer(), System.out);
    writeTmp("simplecollections.minbin", out.getBuffer());
    final byte[] copyOfWrittenBuffer = out.getCopyOfWrittenBuffer();
    in.resetForReuseUseArray(copyOfWrittenBuffer);
    out.flush();
    HashMap res = (HashMap) in.readObject();
    assertTrue(res.get("x") == res.get("y"));
    assertTrue(DeepEquals.deepEquals(obj, res));
}

98. StringUtil#split()

Project: geronimo-yoko
Source File: StringUtil.java
View license
public static String[] split(String str, char splitChar) {
    ArrayList al = new ArrayList(8);
    int i = -1;
    String s;
    String rest = str;
    while ((i = rest.indexOf(splitChar)) != -1) {
        s = rest.substring(0, i);
        al.add(s);
        rest = rest.substring(i + 1);
    }
    al.add(rest);
    String[] result = new String[al.size()];
    al.toArray(result);
    return result;
}

99. JobRunnerTest#setUp()

Project: gocd
Source File: JobRunnerTest.java
View license
@Before
public void setUp() throws Exception {
    runner = new JobRunner();
    work = new FakeWork();
    consoleOut = new ArrayList<>();
    statesAndResult = new ArrayList<>();
    properties = new ArrayList<>();
    agentIdentifier = new AgentIdentifier("localhost", "127.0.0.1", "uuid");
    new SystemEnvironment().setProperty("serviceUrl", SERVER_URL);
    resolver = mock(UpstreamPipelineResolver.class);
}

100. AsmClassGenerator#despreadList()

Project: groovy
Source File: AsmClassGenerator.java
View license
public void despreadList(List expressions, boolean wrap) {
    ArrayList spreadIndexes = new ArrayList();
    ArrayList spreadExpressions = new ArrayList();
    ArrayList normalArguments = new ArrayList();
    for (int i = 0; i < expressions.size(); i++) {
        Object expr = expressions.get(i);
        if (!(expr instanceof SpreadExpression)) {
            normalArguments.add(expr);
        } else {
            spreadIndexes.add(new ConstantExpression(Integer.valueOf(i - spreadExpressions.size()), true));
            spreadExpressions.add(((SpreadExpression) expr).getExpression());
        }
    }
    //load normal arguments as array
    visitTupleExpression(new ArgumentListExpression(normalArguments), wrap);
    //load spread expressions as array
    (new TupleExpression(spreadExpressions)).visit(this);
    //load insertion index
    (new ArrayExpression(ClassHelper.int_TYPE, spreadIndexes, null)).visit(this);
    controller.getOperandStack().remove(1);
    despreadList.call(controller.getMethodVisitor());
}