Here are the examples of the java api class java.util.List taken from open source projects.
1. HSSFDataFormat#createBuiltinFormats()
View licenseprivate static synchronized List createBuiltinFormats() { List builtinFormats = new Vector(); builtinFormats.add(0, "General"); builtinFormats.add(1, "0"); builtinFormats.add(2, "0.00"); builtinFormats.add(3, "#,##0"); builtinFormats.add(4, "#,##0.00"); builtinFormats.add(5, "($#,##0_);($#,##0)"); builtinFormats.add(6, "($#,##0_);[Red]($#,##0)"); builtinFormats.add(7, "($#,##0.00);($#,##0.00)"); builtinFormats.add(8, "($#,##0.00_);[Red]($#,##0.00)"); builtinFormats.add(9, "0%"); builtinFormats.add(0xa, "0.00%"); builtinFormats.add(0xb, "0.00E+00"); builtinFormats.add(0xc, "# ?/?"); builtinFormats.add(0xd, "# ??/??"); builtinFormats.add(0xe, "m/d/yy"); builtinFormats.add(0xf, "d-mmm-yy"); builtinFormats.add(0x10, "d-mmm"); builtinFormats.add(0x11, "mmm-yy"); builtinFormats.add(0x12, "h:mm AM/PM"); builtinFormats.add(0x13, "h:mm:ss AM/PM"); builtinFormats.add(0x14, "h:mm"); builtinFormats.add(0x15, "h:mm:ss"); builtinFormats.add(0x16, "m/d/yy h:mm"); // 0x17 - 0x24 reserved for international and undocumented builtinFormats.add(0x17, "0x17"); builtinFormats.add(0x18, "0x18"); builtinFormats.add(0x19, "0x19"); builtinFormats.add(0x1a, "0x1a"); builtinFormats.add(0x1b, "0x1b"); builtinFormats.add(0x1c, "0x1c"); builtinFormats.add(0x1d, "0x1d"); builtinFormats.add(0x1e, "0x1e"); builtinFormats.add(0x1f, "0x1f"); builtinFormats.add(0x20, "0x20"); builtinFormats.add(0x21, "0x21"); builtinFormats.add(0x22, "0x22"); builtinFormats.add(0x23, "0x23"); builtinFormats.add(0x24, "0x24"); // 0x17 - 0x24 reserved for international and undocumented builtinFormats.add(0x25, "(#,##0_);(#,##0)"); builtinFormats.add(0x26, "(#,##0_);[Red](#,##0)"); builtinFormats.add(0x27, "(#,##0.00_);(#,##0.00)"); builtinFormats.add(0x28, "(#,##0.00_);[Red](#,##0.00)"); builtinFormats.add(0x29, "_(*#,##0_);_(*(#,##0);_(* \"-\"_);_(@_)"); builtinFormats.add(0x2a, "_($*#,##0_);_($*(#,##0);_($* \"-\"_);_(@_)"); builtinFormats.add(0x2b, "_(*#,##0.00_);_(*(#,##0.00);_(*\"-\"??_);_(@_)"); builtinFormats.add(0x2c, "_($*#,##0.00_);_($*(#,##0.00);_($*\"-\"??_);_(@_)"); builtinFormats.add(0x2d, "mm:ss"); builtinFormats.add(0x2e, "[h]:mm:ss"); builtinFormats.add(0x2f, "mm:ss.0"); builtinFormats.add(0x30, "##0.0E+0"); builtinFormats.add(0x31, "@"); return builtinFormats; }
2. PermissionLevelManagerImpl#getCustomPermissions()
View licensepublic List getCustomPermissions() { List customPerms = new ArrayList(); customPerms.add(PermissionLevel.NEW_FORUM); customPerms.add(PermissionLevel.NEW_RESPONSE); customPerms.add(PermissionLevel.NEW_RESPONSE_TO_RESPONSE); customPerms.add(PermissionLevel.NEW_TOPIC); customPerms.add(PermissionLevel.DELETE_ANY); customPerms.add(PermissionLevel.DELETE_OWN); customPerms.add(PermissionLevel.MARK_AS_READ); customPerms.add(PermissionLevel.MODERATE_POSTINGS); customPerms.add(PermissionLevel.IDENTIFY_ANON_AUTHORS); customPerms.add(PermissionLevel.MOVE_POSTING); customPerms.add(PermissionLevel.POST_TO_GRADEBOOK); customPerms.add(PermissionLevel.READ); customPerms.add(PermissionLevel.REVISE_ANY); customPerms.add(PermissionLevel.REVISE_OWN); customPerms.add(PermissionLevel.CHANGE_SETTINGS); return customPerms; }
3. InitializerTests#testCrazyInitializer()
View license@SuppressWarnings({ "unchecked", "rawtypes" }) public void testCrazyInitializer() { Map map = (Map) exec("int y = 2; int z = 3; Map x = [y*z : y + z, 's' : [y, [y : [[z], [], [:]]]], z : [z, 9]]; return x;"); List list0 = new ArrayList(); list0.add(3); List list1 = new ArrayList(); list1.add(list0); list1.add(new ArrayList()); list1.add(new HashMap()); Map map0 = new HashMap(); map0.put(2, list1); List list2 = new ArrayList(); list2.add(2); list2.add(map0); List list3 = new ArrayList(); list3.add(3); list3.add(9); assertEquals(3, map.size()); assertEquals(new Integer(5), map.get(6)); assertEquals(list2, map.get("s")); assertEquals(list3, map.get(3)); }
4. RenameTypeTest#testSimilarElements11()
View license@Test public void testSimilarElements11() throws Exception { //Assure participants get notified of normal stuff (type rename //and resource changes) AND similarly named elements. ParticipantTesting.reset(); ICompilationUnit cu = createCUfromTestFile(getPackageP(), "SomeClass"); IType someClass = getType(cu, "SomeClass"); IType other = getClassFromTestFile(getPackageP(), "SomeOtherClass"); List handleList = new ArrayList(); List argumentList = new ArrayList(); List similarOldHandleList = new ArrayList(); List similarNewNameList = new ArrayList(); List similarNewHandleList = new ArrayList(); final String newName = "SomeNewClass"; // f-Field + getters/setters IField f3 = other.getField("fSomeClass"); similarOldHandleList.add(f3.getHandleIdentifier()); similarNewHandleList.add("Lp/SomeOtherClass;.fSomeNewClass"); similarNewNameList.add("fSomeNewClass"); IMethod m3 = other.getMethod("getSomeClass", new String[0]); similarOldHandleList.add(m3.getHandleIdentifier()); similarNewNameList.add("getSomeNewClass"); similarNewHandleList.add("Lp/SomeOtherClass;.getSomeNewClass()V"); IMethod m4 = other.getMethod("setSomeClass", new String[] { "QSomeClass;" }); similarOldHandleList.add(m4.getHandleIdentifier()); similarNewNameList.add("setSomeNewClass"); similarNewHandleList.add("Lp/SomeOtherClass;.setSomeNewClass(QSomeNewClass;)V"); // non-f-field + getter/setters IField f1 = someClass.getField("someClass"); similarOldHandleList.add(f1.getHandleIdentifier()); similarNewNameList.add("someNewClass"); similarNewHandleList.add("Lp/SomeNewClass;.someNewClass"); IMethod m1 = someClass.getMethod("getSomeClass", new String[0]); similarOldHandleList.add(m1.getHandleIdentifier()); similarNewNameList.add("getSomeNewClass"); similarNewHandleList.add("Lp/SomeNewClass;.getSomeNewClass()V"); IMethod m2 = someClass.getMethod("setSomeClass", new String[] { "QSomeClass;" }); similarOldHandleList.add(m2.getHandleIdentifier()); similarNewNameList.add("setSomeNewClass"); similarNewHandleList.add("Lp/SomeNewClass;.setSomeNewClass(QSomeNewClass;)V"); // fs-field IField f2 = someClass.getField("fsSomeClass"); similarOldHandleList.add(f2.getHandleIdentifier()); similarNewNameList.add("fsSomeNewClass"); similarNewHandleList.add("Lp/SomeNewClass;.fsSomeNewClass"); // Type Stuff handleList.add(someClass); argumentList.add(new RenameArguments(newName, true)); handleList.add(cu); argumentList.add(new RenameArguments(newName + ".java", true)); handleList.add(cu.getResource()); argumentList.add(new RenameArguments(newName + ".java", true)); String[] handles = ParticipantTesting.createHandles(handleList.toArray()); RenameArguments[] arguments = (RenameArguments[]) argumentList.toArray(new RenameArguments[0]); RenameJavaElementDescriptor descriptor = createRefactoringDescriptor(someClass, newName); setTheOptions(descriptor, true, false, true, null, RenamingNameSuggestor.STRATEGY_EMBEDDED); RefactoringStatus status = performRefactoring(descriptor); Assert.assertNull("was supposed to pass", status); checkResultInClass(newName); checkResultInClass("SomeOtherClass"); ParticipantTesting.testRename(handles, arguments); ParticipantTesting.testSimilarElements(similarOldHandleList, similarNewNameList, similarNewHandleList); }
5. ArrayListTest#testaddAllHarmony5839()
View license// Regression test for HARMONY-5839 public void testaddAllHarmony5839() { Collection coll = Arrays.asList(new String[] { "1", "2" }); List list = new ArrayList(); list.add("a"); list.add(0, "b"); list.add(0, "c"); list.add(0, "d"); list.add(0, "e"); list.add(0, "f"); list.add(0, "g"); list.add(0, "h"); list.add(0, "i"); list.addAll(6, coll); assertEquals(11, list.size()); assertFalse(list.contains(null)); }
6. PerformanceMeasurement#toRecord()
View licensepublic List toRecord(String statistic) { checkStatisticsNotNull(); List record = new ArrayList(); record.add(ISO8601_DATE_FORMAT.format(started)); record.add(load); record.add(durationMillis); record.add(statistics.get(statistic).getCount()); record.add(statistics.get(statistic).getMin()); record.add(statistics.get(statistic).getMax()); record.add(statistics.get(statistic).getAverage()); record.add(statistics.get(statistic).getStandardDeviation()); record.add(getTimeoutPercentage(statistic)); record.add(getThroughput(statistic)); return record; }
7. JdbcModelReader#initColumnsForColumn()
View license/** * Returns descriptors for the columns that shall be read from the result set when * reading the meta data for table columns. Note that the columns are read in the order * defined by this list.<br/> * Redefine this method if you want more columns or a different order. * * @return The map column name -> descriptor for the result set columns */ protected List initColumnsForColumn() { List result = new ArrayList(); // As suggested by Alexandre Borgoltz, we're reading the COLUMN_DEF first because Oracle // has problems otherwise (it seemingly requires a LONG column to be the first to be read) // See also DDLUTILS-29 result.add(new MetaDataColumnDescriptor("COLUMN_DEF", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("DATA_TYPE", Types.INTEGER, new Integer(java.sql.Types.OTHER))); result.add(new MetaDataColumnDescriptor("NUM_PREC_RADIX", Types.INTEGER, new Integer(10))); result.add(new MetaDataColumnDescriptor("DECIMAL_DIGITS", Types.INTEGER, new Integer(0))); result.add(new MetaDataColumnDescriptor("COLUMN_SIZE", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("IS_NULLABLE", Types.VARCHAR, "YES")); result.add(new MetaDataColumnDescriptor("REMARKS", Types.VARCHAR)); return result; }
8. JdbcModelReader#initColumnsForFK()
View license/** * Returns descriptors for the columns that shall be read from the result set when * reading the meta data for foreign keys originating from a table. Note that the * columns are read in the order defined by this list.<br/> * Redefine this method if you want more columns or a different order. * * @return The map column name -> descriptor for the result set columns */ protected List initColumnsForFK() { List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("PKTABLE_NAME", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually result.add(new MetaDataColumnDescriptor("FKTABLE_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("KEY_SEQ", Types.TINYINT, new Short((short) 0))); result.add(new MetaDataColumnDescriptor("FK_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("UPDATE_RULE", Types.TINYINT)); result.add(new MetaDataColumnDescriptor("DELETE_RULE", Types.TINYINT)); result.add(new MetaDataColumnDescriptor("PKCOLUMN_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("FKCOLUMN_NAME", Types.VARCHAR)); return result; }
9. ShadowEffect#getValues()
View licensepublic List getValues() { List values = new ArrayList(); values.add(EffectUtil.colorValue("Color", color)); values.add(EffectUtil.floatValue("Opacity", opacity, 0, 1, "This setting sets the translucency of the shadow.")); values.add(EffectUtil.floatValue("X distance", xDistance, -99, 99, "This setting is the amount of pixels to offset the " + "shadow on the x axis. The glyphs will need padding so the shadow doesn't get clipped.")); values.add(EffectUtil.floatValue("Y distance", yDistance, -99, 99, "This setting is the amount of pixels to offset the " + "shadow on the y axis. The glyphs will need padding so the shadow doesn't get clipped.")); List options = new ArrayList(); options.add(new String[] { "None", "0" }); for (int i = 2; i < NUM_KERNELS; i++) options.add(new String[] { String.valueOf(i) }); String[][] optionsArray = (String[][]) options.toArray(new String[options.size()][]); values.add(EffectUtil.optionValue("Blur kernel size", String.valueOf(blurKernelSize), optionsArray, "This setting controls how many neighboring pixels are used to blur the shadow. Set to \"None\" for no blur.")); values.add(EffectUtil.intValue("Blur passes", blurPasses, "The setting is the number of times to apply a blur to the shadow. Set to \"0\" for no blur.")); return values; }
10. ForeachTestCase#testNestedVelocityHasNextProperty()
View licensepublic void testNestedVelocityHasNextProperty() throws Exception { List list = new ArrayList(); list.add("test1"); list.add("test2"); list.add("test3"); list.add("test4"); context.put("list", list); List list2 = new ArrayList(); list2.add("a1"); list2.add("a2"); list2.add("a3"); context.put("list2", list2); assertEvalEquals("test1 (a1;a2;a3)-test2 (a1;a2;a3)-test3 (a1;a2;a3)-test4 (a1;a2;a3)", "#foreach ($value in $list)$value (#foreach ($val in $list2)$val#if( $foreach.hasNext );#end#end)#if( $foreach.hasNext )-#end#end"); }
11. TestEphemeralCache#setupMockData()
View license@SuppressWarnings("unchecked") private void setupMockData() { List parentRows = new ArrayList(); parentRows.add(createMap("id", new BigDecimal("1"), "parent_s", "one")); parentRows.add(createMap("id", new BigDecimal("2"), "parent_s", "two")); parentRows.add(createMap("id", new BigDecimal("3"), "parent_s", "three")); parentRows.add(createMap("id", new BigDecimal("4"), "parent_s", "four")); parentRows.add(createMap("id", new BigDecimal("5"), "parent_s", "five")); List child1Rows = new ArrayList(); child1Rows.add(createMap("id", new BigDecimal("6"), "child1a_mult_s", "this is the number six.")); child1Rows.add(createMap("id", new BigDecimal("5"), "child1a_mult_s", "this is the number five.")); child1Rows.add(createMap("id", new BigDecimal("6"), "child1a_mult_s", "let's sing a song of six.")); child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "three")); child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "III")); child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "3")); child1Rows.add(createMap("id", new BigDecimal("3"), "child1a_mult_s", "|||")); child1Rows.add(createMap("id", new BigDecimal("1"), "child1a_mult_s", "one")); child1Rows.add(createMap("id", new BigDecimal("1"), "child1a_mult_s", "uno")); child1Rows.add(createMap("id", new BigDecimal("2"), "child1b_s", "CHILD1B", "child1a_mult_s", "this is the number two.")); List child2Rows = new ArrayList(); child2Rows.add(createMap("id", new BigDecimal("6"), "child2a_mult_s", "Child 2 says, 'this is the number six.'")); child2Rows.add(createMap("id", new BigDecimal("5"), "child2a_mult_s", "Child 2 says, 'this is the number five.'")); child2Rows.add(createMap("id", new BigDecimal("6"), "child2a_mult_s", "Child 2 says, 'let's sing a song of six.'")); child2Rows.add(createMap("id", new BigDecimal("3"), "child2a_mult_s", "Child 2 says, 'three'")); child2Rows.add(createMap("id", new BigDecimal("3"), "child2a_mult_s", "Child 2 says, 'III'")); child2Rows.add(createMap("id", new BigDecimal("3"), "child2b_s", "CHILD2B", "child2a_mult_s", "Child 2 says, '3'")); child2Rows.add(createMap("id", new BigDecimal("3"), "child2a_mult_s", "Child 2 says, '|||'")); child2Rows.add(createMap("id", new BigDecimal("1"), "child2a_mult_s", "Child 2 says, 'one'")); child2Rows.add(createMap("id", new BigDecimal("1"), "child2a_mult_s", "Child 2 says, 'uno'")); child2Rows.add(createMap("id", new BigDecimal("2"), "child2a_mult_s", "Child 2 says, 'this is the number two.'")); MockDataSource.setIterator("SELECT * FROM PARENT", parentRows.iterator()); MockDataSource.setIterator("SELECT * FROM CHILD_1", child1Rows.iterator()); MockDataSource.setIterator("SELECT * FROM CHILD_2", child2Rows.iterator()); }
12. ProfileManagerTest#testMorePackagesInProfile()
View licensepublic void testMorePackagesInProfile() { List profileList = new ArrayList(); profileList.add(createItem("kernel-2.4.21-EL-mmccune", 500341)); profileList.add(createItem("kernel-2.4.22-EL-mmccune", 500341)); profileList.add(createItem("kernel-2.4.23-EL-mmccune", 500341)); profileList.add(createItem("other-2.4.23-EL-mmccune", 500400)); List systemList = new ArrayList(); systemList.add(createItem("kernel-2.4.23-EL-mmccune", 500341)); List diff = ProfileManager.comparePackageLists(new DataResult(profileList), new DataResult(systemList), "system"); assertEquals(3, diff.size()); }
13. ApprovalTest#shouldOverwriteExistingUsersWhileSettingNewUsers()
View license@Test public void shouldOverwriteExistingUsersWhileSettingNewUsers() { Approval approval = Approval.automaticApproval(); approval.getAuthConfig().add(new AdminUser(new CaseInsensitiveString("sachin"))); approval.getAuthConfig().add(new AdminRole(new CaseInsensitiveString("admin"))); List names = new ArrayList(); names.add(nameMap("awesome_shilpa")); names.add(nameMap("youth")); names.add(nameMap("")); List roles = new ArrayList(); roles.add(nameMap("role1")); roles.add(nameMap("role2")); roles.add(nameMap("")); approval.setOperatePermissions(names, roles); assertThat(approval.getAuthConfig().size(), is(4)); assertThat(approval.getAuthConfig(), hasItem((Admin) new AdminUser(new CaseInsensitiveString("awesome_shilpa")))); assertThat(approval.getAuthConfig(), hasItem((Admin) new AdminUser(new CaseInsensitiveString("youth")))); assertThat(approval.getAuthConfig(), hasItem((Admin) new AdminRole(new CaseInsensitiveString("role1")))); assertThat(approval.getAuthConfig(), hasItem((Admin) new AdminRole(new CaseInsensitiveString("role2")))); }
14. JXPathTestCase#list()
View licenseprotected static List list(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7) { List list = new ArrayList(); list.add(o1); list.add(o2); list.add(o3); list.add(o4); list.add(o5); list.add(o6); list.add(o7); return list; }
15. PropertyTest#testListOfListNavigationProperty()
View licensepublic void testListOfListNavigationProperty() throws Exception { List list = new ArrayList(); list.add(new DummyBean("James")); list.add(new DummyBean("Bob")); List listOfList = new ArrayList(); listOfList.add(list); List value = (List) InvokerHelper.getProperty(listOfList, "name"); Object[] objects = value.toArray(); List objectList = (List) objects[0]; assertArrayEquals(new Object[] { "James", "Bob" }, objectList.toArray()); }
16. PropertyTest#testListOfListNavigationProperty()
View licensepublic void testListOfListNavigationProperty() throws Exception { List list = new ArrayList(); list.add(new DummyBean("James")); list.add(new DummyBean("Bob")); List listOfList = new ArrayList(); listOfList.add(list); List value = (List) InvokerHelper.getProperty(listOfList, "name"); Object[] objects = value.toArray(); List objectList = (List) objects[0]; assertArrayEquals(new Object[] { "James", "Bob" }, objectList.toArray()); }
17. FromTestClass#toList()
View licensepublic List toList(final Object object1, final Object object2, final String object3, final int integer, final Map map, final List inputList) { final List list = new ArrayList(); list.add(object1); list.add(object2); list.add(object3); list.add(new Integer(integer)); list.add(map); list.add(inputList); return list; }
18. ProfileManagerTest#testMorePackagesInSystem()
View licensepublic void testMorePackagesInSystem() { List profileList = new ArrayList(); profileList.add(createItem("kernel-2.4.23-EL-mmccune", 500341)); List systemList = new ArrayList(); systemList.add(createItem("kernel-2.4.21-EL-mmccune", 500341)); systemList.add(createItem("kernel-2.4.22-EL-mmccune", 500341)); systemList.add(createItem("kernel-2.4.23-EL-mmccune", 500341)); List diff = ProfileManager.comparePackageLists(new DataResult(profileList), new DataResult(systemList), "system"); assertEquals(2, diff.size()); }
19. SystemSearchHelper#performSearch()
View licenseprotected static List performSearch(Long sessionId, String index, String query, Boolean isFineGrained) throws XmlRpcFault, MalformedURLException { log.info("Performing system search: index = " + index + ", query = " + query); XmlRpcClient client = new XmlRpcClient(ConfigDefaults.get().getSearchServerUrl(), true); List args = new ArrayList(); args.add(sessionId); args.add(index); args.add(query); args.add(isFineGrained); List results = (List) client.invoke("index.search", args); if (log.isDebugEnabled()) { log.debug("results = [" + results + "]"); } if (results.isEmpty()) { return Collections.EMPTY_LIST; } return results; }
20. TestDateTimeComparator#testListMillis()
View license// end of testListBasic /** * Test sorting with millis of second comparator. */ public void testListMillis() { // List sl = new ArrayList(); long base = 12345L * 1000L; sl.add(new DateTime(base + 999L, DateTimeZone.UTC)); sl.add(new DateTime(base + 222L, DateTimeZone.UTC)); sl.add(new DateTime(base + 456L, DateTimeZone.UTC)); sl.add(new DateTime(base + 888L, DateTimeZone.UTC)); sl.add(new DateTime(base + 123L, DateTimeZone.UTC)); sl.add(new DateTime(base + 000L, DateTimeZone.UTC)); // boolean isSorted1 = isListSorted(sl); Collections.sort(sl, cMillis); boolean isSorted2 = isListSorted(sl); assertEquals("ListLillis", !isSorted1, isSorted2); }
21. JXPathTestCase#list()
View licenseprotected static List list(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) { List list = new ArrayList(); list.add(o1); list.add(o2); list.add(o3); list.add(o4); list.add(o5); list.add(o6); return list; }
22. JdbcModelReader#initColumnsForIndex()
View license/** * Returns descriptors for the columns that shall be read from the result set when * reading the meta data for indices. Note that the columns are read in the order * defined by this list.<br/> * Redefine this method if you want more columns or a different order. * * @return The map column name -> descriptor for the result set columns */ protected List initColumnsForIndex() { List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("INDEX_NAME", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("NON_UNIQUE", Types.BIT, Boolean.TRUE)); result.add(new MetaDataColumnDescriptor("ORDINAL_POSITION", Types.TINYINT, new Short((short) 0))); result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("TYPE", Types.TINYINT)); return result; }
23. AbstractListTest#test_hashCode()
View license/** * @tests java.util.AbstractList#hashCode() */ public void test_hashCode() { List list = new ArrayList(); list.add(new Integer(3)); list.add(new Integer(15)); list.add(new Integer(5)); list.add(new Integer(1)); list.add(new Integer(7)); int hashCode = 1; Iterator i = list.iterator(); while (i.hasNext()) { Object obj = i.next(); hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); } assertTrue("Incorrect hashCode returned. Wanted: " + hashCode + " got: " + list.hashCode(), hashCode == list.hashCode()); }
24. ArrayListT#listMethods()
View license/** * ??ArrayList?????????????????next()???? */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static void listMethods() { List a1 = new ArrayList<String>(); a1.add("List01"); a1.add("List03"); a1.add("List04"); System.out.print("?????\n\t" + a1 + "\n"); a1.add(1, "List02"); System.out.print("????1???\n\t" + a1 + "\n"); a1.remove(2); System.out.print("????2???\n\t" + a1 + "\n"); System.out.print("????2???\n\t" + a1.get(2) + "\n"); Iterator i1 = a1.iterator(); System.out.println("???????????"); while (i1.hasNext()) System.out.print(i1.next() + "\t"); }
25. ClassUtilsTests#testClassNamesToString()
View licensepublic void testClassNamesToString() { List ifcs = new LinkedList(); ifcs.add(Serializable.class); ifcs.add(Runnable.class); assertEquals("[interface java.io.Serializable, interface java.lang.Runnable]", ifcs.toString()); assertEquals("[java.io.Serializable, java.lang.Runnable]", ClassUtils.classNamesToString(ifcs)); List classes = new LinkedList(); classes.add(LinkedList.class); classes.add(Integer.class); assertEquals("[class java.util.LinkedList, class java.lang.Integer]", classes.toString()); assertEquals("[java.util.LinkedList, java.lang.Integer]", ClassUtils.classNamesToString(classes)); assertEquals("[interface java.util.List]", Collections.singletonList(List.class).toString()); assertEquals("[java.util.List]", ClassUtils.classNamesToString(List.class)); assertEquals("[]", Collections.EMPTY_LIST.toString()); assertEquals("[]", ClassUtils.classNamesToString(Collections.EMPTY_LIST)); }
26. TestDynaActionForm#setupComplexProperties()
View license// ------------------------------------------------------ Protected Methods /** * Set up the complex properties that cannot be configured from the * initial value expression. */ protected void setupComplexProperties() { List listIndexed = new ArrayList(); listIndexed.add("String 0"); listIndexed.add("String 1"); listIndexed.add("String 2"); listIndexed.add("String 3"); listIndexed.add("String 4"); dynaForm.set("listIndexed", listIndexed); Map mappedProperty = new HashMap(); mappedProperty.put("First Key", "First Value"); mappedProperty.put("Second Key", "Second Value"); dynaForm.set("mappedProperty", mappedProperty); Map mappedIntProperty = new HashMap(); mappedIntProperty.put("One", new Integer(1)); mappedIntProperty.put("Two", new Integer(2)); dynaForm.set("mappedIntProperty", mappedIntProperty); }
27. JdbcModelReader#initColumnsForTable()
View license/** * Returns descriptors for the columns that shall be read from the result set when * reading the meta data for a table. Note that the columns are read in the order * defined by this list.<br/> * Redefine this method if you want more columns or a different order. * * @return The descriptors for the result set columns */ protected List initColumnsForTable() { List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("TABLE_TYPE", Types.VARCHAR, "UNKNOWN")); result.add(new MetaDataColumnDescriptor("TABLE_CAT", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("TABLE_SCHEM", Types.VARCHAR)); result.add(new MetaDataColumnDescriptor("REMARKS", Types.VARCHAR)); return result; }
28. TagtestAction#act()
View license/* * @see Action#act(Redirector, SourceResolver, Map, String, Parameters) */ public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters par) throws Exception { Request request = ObjectModelHelper.getRequest(objectModel); Session session = request.getSession(); Enumeration locales = request.getLocales(); List info = new ArrayList(); request.setAttribute("BrowserLocales", locales); info.add(request.getRemoteAddr()); info.add(request.getRemoteHost()); info.add(request.getRemoteUser()); info.add(request.getContentType()); info.add(request.getLocale()); session.setAttribute("RequestInfo", info); return null; }
29. DataObjectGetListTestCase#testUnknownPropertyOnOpenType()
View license/** * Test DataObject.getList() on open type */ public void testUnknownPropertyOnOpenType() throws IOException { String companyName = companyDataObject.getString("openCompany/company"); assertEquals(companyName, "OpenCompany"); List unknownProperty = companyDataObject.getList("openCompany/unknownProperty"); assertNotNull(unknownProperty); assertTrue(unknownProperty instanceof List); List unknownProperty2 = companyDataObject.getList("openCompany/unknownProperty"); assertNotNull(unknownProperty2); assertTrue(unknownProperty2 instanceof List); // unknownProperty and unknownProperty2 are in fact the same value for the same property unknownProperty.add("employee1"); assertTrue(unknownProperty.size() == 1); unknownProperty2.add("employee2"); assertTrue(unknownProperty2.size() == 2); unknownProperty.remove(0); assertTrue(unknownProperty.size() == 1); assertEquals(unknownProperty.get(0), "employee2"); }
30. StscChecker#checkAll()
View licensepublic static void checkAll() { // walk the tree of types StscState state = StscState.get(); List allSeenTypes = new ArrayList(); allSeenTypes.addAll(Arrays.asList(state.documentTypes())); allSeenTypes.addAll(Arrays.asList(state.attributeTypes())); allSeenTypes.addAll(Arrays.asList(state.redefinedGlobalTypes())); allSeenTypes.addAll(Arrays.asList(state.globalTypes())); for (int i = 0; i < allSeenTypes.size(); i++) { SchemaType gType = (SchemaType) allSeenTypes.get(i); if (// option to turn off particle restriction checking !state.noPvr() && // Don't check doc types for restriction. !gType.isDocumentType()) { checkRestriction((SchemaTypeImpl) gType); } checkFields((SchemaTypeImpl) gType); allSeenTypes.addAll(Arrays.asList(gType.getAnonymousTypes())); } checkSubstitutionGroups(state.globalElements()); }
31. AbstractReferenceTest#testReferencesAreWorking()
View licensepublic void testReferencesAreWorking() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String xml = xstream.toXML(list); List result = (List) xstream.fromXML(xml); assertEquals(list, result); }
32. AbstractReferenceTest#testImmutableInstancesAreNotReferenced()
View licensepublic void testImmutableInstancesAreNotReferenced() { xstream.addImmutableType(Thing.class, false); Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String xml = xstream.toXML(list); List result = (List) xstream.fromXML(xml); Thing t0 = (Thing) result.get(0); Thing t1 = (Thing) result.get(1); Thing t2 = (Thing) result.get(2); assertEquals(t0, t1); assertNotSame(t0, t1); }
33. EnumMapperTest#testEnumsAreImmutable()
View licensepublic void testEnumsAreImmutable() { List in = new ArrayList(); in.add(SimpleEnum.GREEN); in.add(SimpleEnum.GREEN); in.add(PolymorphicEnum.A); in.add(PolymorphicEnum.A); String expectedXml = "" + "<list>\n" + " <simple>GREEN</simple>\n" + " <simple>GREEN</simple>\n" + " <polymorphic>A</polymorphic>\n" + " <polymorphic>A</polymorphic>\n" + "</list>"; assertEquals(expectedXml, xstream.toXML(in)); assertEquals(in, xstream.fromXML(expectedXml)); }
34. IllegalCertiticates#main()
View licensepublic static void main(String[] args) throws Exception { List certs = new Vector(); certs.add("The 1st certificate"); certs.add("The 2nd certificate"); certs.add("The 3rd certificate"); certs.add("The 4th certificate"); try { X509CertPath cp = new X509CertPath(certs); throw new Exception("No expected CertificateException thrown"); } catch (CertificateException ce) { } catch (Exception e) { throw new Exception("No expected CertificateException thrown", e); } }
35. InlineFilterTest#multiple_context_object_can_be_refered()
View license@Test public void multiple_context_object_can_be_refered() { List all = using(conf).parse(JSON_DOCUMENT).read("store.book[ ?(@.category == @.category) ]", List.class); assertThat(all.size()).isEqualTo(bookCount); List all2 = using(conf).parse(JSON_DOCUMENT).read("store.book[ ?(@.category == @['category']) ]", List.class); assertThat(all2.size()).isEqualTo(bookCount); List all3 = using(conf).parse(JSON_DOCUMENT).read("store.book[ ?(@ == @) ]", List.class); assertThat(all3.size()).isEqualTo(bookCount); List none = using(conf).parse(JSON_DOCUMENT).read("store.book[ ?(@.category != @.category) ]", List.class); assertThat(none.size()).isEqualTo(0); List none2 = using(conf).parse(JSON_DOCUMENT).read("store.book[ ?(@.category != @) ]", List.class); assertThat(none2.size()).isEqualTo(4); }
36. DublinCoreImpl#addValue()
View license/** * @see org.apache.lenya.cms.publication.DublinCore#addValue(java.lang.String, java.lang.String) */ public void addValue(String key, String value) throws DocumentException { String[] existingValues = getElementOrTerm(key); List list = new ArrayList(Arrays.asList(existingValues)); list.add(value); String[] newValues = (String[]) list.toArray(new String[list.size()]); List elementList = Arrays.asList(ELEMENTS); List termList = Arrays.asList(TERMS); if (elementList.contains(key)) { elements.put(key, newValues); } else if (termList.contains(key)) { terms.put(key, newValues); } else { throw new DocumentException("The key [" + key + "] does not refer to a dublin core element or term!"); } }
37. DublinCoreImpl#removeValue()
View license/** * @see org.apache.lenya.cms.publication.DublinCore#removeValue(java.lang.String, java.lang.String) */ public void removeValue(String key, String value) throws DocumentException { String[] existingValues = getElementOrTerm(key); List list = new ArrayList(Arrays.asList(existingValues)); if (!list.contains(value)) { throw new DocumentException("The key [" + key + "] does not contain the value [" + value + "]!"); } list.remove(value); String[] newValues = (String[]) list.toArray(new String[list.size()]); List elementList = Arrays.asList(ELEMENTS); List termList = Arrays.asList(TERMS); if (elementList.contains(key)) { elements.put(key, newValues); } else if (termList.contains(key)) { terms.put(key, newValues); } else { throw new DocumentException("The key [" + key + "] does not refer to a dublin core element or term!"); } }
38. TemplateEngineFreemarkerAssetsAtMethod#exec()
View licensepublic TemplateModel exec(List args) throws TemplateModelException { List argsWithControllerAndMethod = new ArrayList(args.size() + 2); argsWithControllerAndMethod.add(AssetsController.class.getName()); argsWithControllerAndMethod.add("serveStatic"); argsWithControllerAndMethod.add("fileName"); argsWithControllerAndMethod.addAll(args); return templateEngineFreemarkerReverseRouteHelper.computeReverseRoute(argsWithControllerAndMethod); }
39. TemplateEngineFreemarkerWebJarsAtMethod#exec()
View licensepublic TemplateModel exec(List args) throws TemplateModelException { List argsWithControllerAndMethod = new ArrayList(); argsWithControllerAndMethod.add(AssetsController.class.getName()); argsWithControllerAndMethod.add("serveWebJars"); argsWithControllerAndMethod.add("fileName"); argsWithControllerAndMethod.addAll(args); return templateEngineFreemarkerReverseRouteHelper.computeReverseRoute(argsWithControllerAndMethod); }
40. IllegalCertiticates#main()
View licensepublic static void main(String[] args) throws Exception { List certs = new Vector(); certs.add("The 1st certificate"); certs.add("The 2nd certificate"); certs.add("The 3rd certificate"); certs.add("The 4th certificate"); try { X509CertPath cp = new X509CertPath(certs); throw new Exception("No expected CertificateException thrown"); } catch (CertificateException ce) { } catch (Exception e) { throw new Exception("No expected CertificateException thrown", e); } }
41. RexsterApplicationGraphTest#loadAllowableExtensionsValid()
View license@Test public void loadAllowableExtensionsValid() { RexsterApplicationGraph rag = new RexsterApplicationGraph("graph", null); List list = new ArrayList(); list.add("ns1:*"); list.add("ns2:go"); list.add(""); list.add("somejunkthat won't parse to a namespace"); rag.loadAllowableExtensions(list); Assert.assertNotNull(rag.getExtensionAllowables()); Assert.assertEquals(2, rag.getExtensionAllowables().size()); }
42. StringUtilTest#testDetailedListToString()
View license@Test public void testDetailedListToString() { List list = Lists.newArrayList(); list.add("zero"); list.add(null); list.add("two"); list.add(null); String actual = StringUtil.detailedListToString(list); String expected = "{\n" + "\t(java.lang.String) zero\n" + "\t(NULL) NULL\n" + "\t(java.lang.String) two\n" + "\t(NULL) NULL\n" + "}"; assertEquals(expected, actual); }
43. TranslationsTest#testListToString()
View licensepublic void testListToString() { List list = new ArrayList(); list.add(new Integer(10)); list.add("list"); String s = (String) TestTranslations.convert(list, String.class); assertNotNull(s); assertEquals("[10, list]", s); list = new LinkedList(); list.add(new Integer(20)); list.add("list"); s = (String) TestTranslations.convert(list, String.class); assertNotNull(s); assertEquals("[20, list]", s); }
44. OvalFileAggregator#buildDocument()
View licenseprivate void buildDocument() { Element defsElement = new Element("definitions"); attachChildren(defsElement, defs); Element testsElement = new Element("tests"); attachChildren(testsElement, tests); Element objectsElement = new Element("objects"); attachChildren(objectsElement, objects); Element statesElement = new Element("states"); attachChildren(statesElement, states); List children = aggregate.getRootElement().getChildren(); children.add(defsElement); children.add(testsElement); children.add(objectsElement); children.add(statesElement); }
45. CSVWriterTest#testListofDtos()
View licensepublic void testListofDtos() throws Exception { ExportWriter writer = new CSVWriter(new StringWriter()); List columns = new LinkedList(); columns.add("fieldOne"); columns.add("fieldTwo"); columns.add("fieldThree"); writer.setColumns(columns); List values = new LinkedList(); for (int i = 0; i < 10; i++) { TestCsvDto dto = new TestCsvDto(); dto.setFieldOne("f1 - " + i); dto.setFieldTwo("f2 - " + i); dto.setFieldThree("f3 - " + i); dto.setId(new Long(i)); values.add(dto); } writer.write(values); assertTrue(writer.getContents().startsWith("**fieldOne**,**fieldTwo**,**fieldThree**\n")); assertTrue(writer.getContents().endsWith("f1 - 9,f2 - 9,f3 - 9\n")); }
46. Test1#groupsOfGroupsWithIndirections()
View license@Test public void groupsOfGroupsWithIndirections() { addClass("test.sample.Sample1"); addIncludedGroup("all"); List l = new ArrayList<>(); l.add("methods"); l.add("broken"); addMetaGroup("all", l); l = new ArrayList<>(); l.add("odd"); l.add("even"); addMetaGroup("methods", l); addMetaGroup("broken", "broken"); run(); String[] passed = { "method1", "method2", "method3", "broken" }; String[] failed = {}; verifyTests("Passed", passed, getPassedTests()); verifyTests("Failed", failed, getFailedTests()); }
47. DataObjectGetListTestCase#testUnknownPropertyOnOpenType()
View license/** * Test DataObject.getList() on open type */ public void testUnknownPropertyOnOpenType() throws IOException { String companyName = companyDataObject.getString("openCompany/company"); assertEquals(companyName, "OpenCompany"); List unknownProperty = companyDataObject.getList("openCompany/unknownProperty"); assertNotNull(unknownProperty); assertTrue(unknownProperty instanceof List); List unknownProperty2 = companyDataObject.getList("openCompany/unknownProperty"); assertNotNull(unknownProperty2); assertTrue(unknownProperty2 instanceof List); // unknownProperty and unknownProperty2 are in fact the same value for the same property unknownProperty.add("employee1"); assertTrue(unknownProperty.size() == 1); unknownProperty2.add("employee2"); assertTrue(unknownProperty2.size() == 2); unknownProperty.remove(0); assertTrue(unknownProperty.size() == 1); assertEquals(unknownProperty.get(0), "employee2"); }
48. UpdateEventFactory#createUpdateOperation()
View license/** * Create an update operation. * * @return update operation */ public UpdateEvent createUpdateOperation() { NodeState n1 = createNodeState(); NodeState n2 = createNodeState(); NodeState n3 = createNodeState(); PropertyState p1 = createPropertyState(n1.getNodeId(), "{}a"); PropertyState p2 = createPropertyState(n2.getNodeId(), "{}b"); ChangeLog changes = new ChangeLog(); changes.added(n1); changes.added(p1); changes.deleted(p2); changes.modified(n2); changes.deleted(n3); List events = new ArrayList(); events.add(createEventState(n1, Event.NODE_ADDED, "{}n1", session)); events.add(createEventState(p1, n1, Event.PROPERTY_ADDED, session)); events.add(createEventState(p2, n2, Event.PROPERTY_REMOVED, session)); events.add(createEventState(n3, Event.NODE_REMOVED, "{}n3", session)); return new UpdateEvent(changes, events, System.currentTimeMillis(), "user-data"); }
49. UpdateEventFactory#createUpdateOperationWithNullUserId()
View license/** * Create an update operation. * * @return update operation */ public UpdateEvent createUpdateOperationWithNullUserId() { NodeState n1 = createNodeState(); NodeState n2 = createNodeState(); NodeState n3 = createNodeState(); PropertyState p1 = createPropertyState(n1.getNodeId(), "{}a"); PropertyState p2 = createPropertyState(n2.getNodeId(), "{}b"); ChangeLog changes = new ChangeLog(); changes.added(n1); changes.added(p1); changes.deleted(p2); changes.modified(n2); changes.deleted(n3); Session s = new ClusterSession(null); List events = new ArrayList(); events.add(createEventState(n1, Event.NODE_ADDED, "{}n1", s)); events.add(createEventState(p1, n1, Event.PROPERTY_ADDED, s)); events.add(createEventState(p2, n2, Event.PROPERTY_REMOVED, s)); events.add(createEventState(n3, Event.NODE_REMOVED, "{}n3", s)); return new UpdateEvent(changes, events, System.currentTimeMillis(), "user-data"); }
50. IterAndListIterT#iterator()
View license/** * ????????? * ???Iterator(Object obj = it.next()) ???HashMap?size? * size?????????ConcurrentModificationException? */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static void iterator() { List a1 = new ArrayList<String>(); a1.add("List01"); a1.add("List02"); a1.add("List04"); a1.add("List05"); Iterator i1 = a1.iterator(); while (i1.hasNext()) { Object obj = i1.next(); if (obj.equals("List02")) a1.add("List03"); } System.out.print("???\n\t" + a1 + "\n"); }
51. IterAndListIterT#listIterator()
View license/** * ListIterator?????????? */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static void listIterator() { List a1 = new ArrayList<String>(); a1.add("List01"); a1.add("List"); a1.add("List03"); a1.add("List04"); ListIterator l1 = a1.listIterator(); while (l1.hasNext()) { Object obj = l1.next(); if (obj.equals("List")) { l1.remove(); l1.add("List02"); } } System.out.print("???\n\t" + a1 + "\n"); }
52. PropertyTest#testNodeNavigationProperty()
View licensepublic void testNodeNavigationProperty() throws Exception { Node z = new Node(null, "z"); Node y = new Node(null, "y"); List children = new ArrayList(); children.add(y); children.add(z); Node x = new Node(null, "x", children); children = new ArrayList(); children.add(x); Node b = new Node(null, "b", children); // @todo should try with just a node as the child List value = (List) InvokerHelper.getProperty(b, "x"); assertArrayEquals(new Object[] { x }, value.toArray()); value = (List) InvokerHelper.getProperty(value, "z"); assertArrayEquals(new Object[] { z }, value.toArray()); }
53. PropertyTest#testNodeNavigationProperty()
View licensepublic void testNodeNavigationProperty() throws Exception { Node z = new Node(null, "z"); Node y = new Node(null, "y"); List children = new ArrayList(); children.add(y); children.add(z); Node x = new Node(null, "x", children); children = new ArrayList(); children.add(x); Node b = new Node(null, "b", children); // @todo should try with just a node as the child List value = (List) InvokerHelper.getProperty(b, "x"); assertArrayEquals(new Object[] { x }, value.toArray()); value = (List) InvokerHelper.getProperty(value, "z"); assertArrayEquals(new Object[] { z }, value.toArray()); }
54. ConverterUtilTest#testBigInteger()
View license/** Test conversion of Big Integer */ public void testBigInteger() { List l = new ArrayList(); l.add("23445"); l.add("23446"); l.add("23456646"); l.add("1113646"); Object convertedObj = ConverterUtil.convertToArray(BigInteger.class, l); assertTrue(convertedObj.getClass().isArray()); assertTrue(convertedObj.getClass().equals(BigInteger[].class)); }
55. ConverterUtilTest#testInt()
View license/** integer arrays */ public void testInt() { List l = new ArrayList(); l.add("23445"); l.add("23446"); l.add("23456646"); l.add("1113646"); Object convertedObj = ConverterUtil.convertToArray(int.class, l); assertTrue(convertedObj.getClass().isArray()); assertTrue(convertedObj.getClass().equals(int[].class)); }
56. ConverterUtilTest#testBool()
View license/** boolean arrays */ public void testBool() { List l = new ArrayList(); l.add("true"); l.add("false"); l.add("true"); l.add("false"); Object convertedObj = ConverterUtil.convertToArray(boolean.class, l); assertTrue(convertedObj.getClass().isArray()); assertTrue(convertedObj.getClass().equals(boolean[].class)); }
57. IDReferenceTest#testXmlContainsReferenceIds()
View licensepublic void testXmlContainsReferenceIds() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String expected = "" + "<list id=\"1\">\n" + " <thing id=\"2\">\n" + " <field>hello</field>\n" + " </thing>\n" + " <thing reference=\"2\"/>\n" + " <thing id=\"3\">\n" + " <field>hello</field>\n" + " </thing>\n" + "</list>"; assertEquals(expected, xstream.toXML(list)); }
58. RealmsAction#buildViewContext()
View license// buildEditContext /** * Build the context for the view realm mode. */ private String buildViewContext(SessionState state, Context context) { // get the realm to edit AuthzGroup realm = (AuthzGroup) state.getAttribute("realm"); context.put("realm", realm); // get the roles defined in the realm List roles = new Vector(); roles.addAll(realm.getRoles()); Collections.sort(roles); context.put("roles", roles); // get a list of the users who have individual grants in the realm List grants = new Vector(); grants.addAll(realm.getMembers()); Collections.sort(grants); context.put("grants", grants); return "_view"; }
59. ListCommand#concat_list()
View license@SuppressWarnings({ "rawtypes", "unchecked" }) private String concat_list(BufferedReader reader) throws IOException { List list1 = (List) gateway.getObject(reader.readLine()); List list2 = (List) gateway.getObject(reader.readLine()); // Read end reader.readLine(); List list3 = new ArrayList(list1); list3.addAll(list2); ReturnObject returnObject = gateway.getReturnObject(list3); return Protocol.getOutputCommand(returnObject); }
60. TestEvalString#testSUBSTRING()
View license@Test public void testSUBSTRING() throws Exception { SUBSTRING func = new SUBSTRING(); // test excution List l = new LinkedList(); l.add("Hello World!"); l.add(1); l.add(5); String expected = "ello"; Tuple input = DefaultTupleFactory.getInstance().newTuple(l); String output = func.exec(input); assertTrue(output.equals(expected)); }
61. TestEvalString#testREPLACE()
View license@Test public void testREPLACE() throws Exception { REPLACE func = new REPLACE(); // test excution List l = new LinkedList(); l.add("Hello World!"); l.add("o"); l.add("a"); String expected = "Hella Warld!"; Tuple input = DefaultTupleFactory.getInstance().newTuple(l); String output = func.exec(input); assertTrue(output.equals(expected)); }
62. PageTurnerActivity#getMenuItems()
View licenseprotected List<NavigationCallback> getMenuItems(Configuration config) { List result = new ArrayList<>(); if (new File(config.getLastOpenedFile()).exists()) { String nowReading = getString(R.string.now_reading, config.getLastReadTitle()); result.add(navigate(nowReading, ReadingActivity.class)); } result.add(navigate(getString(R.string.open_library), LibraryActivity.class)); result.add(navigate(getString(R.string.download), CatalogActivity.class)); result.add(new NavigationCallback(getString(R.string.prefs)).setOnClick(this::startPreferences)); return result; }
63. DummyDataHelper#getLabels()
View licenseprivate List getLabels() { List labels = new ArrayList(); Label l1 = new LabelImpl(); l1.setKey("group-key"); l1.setValue("group"); Label l2 = new LabelImpl(); l2.setKey("partner-key"); l2.setValue("partner"); Label l3 = new LabelImpl(); l3.setKey("alone-key"); l3.setValue("alone"); labels.add(l1); labels.add(l2); labels.add(l3); return labels; }
64. SiteEmailNotificationAnnc#getHeaders()
View license/** * @inheritDoc */ protected List getHeaders(Event event) { List rv = super.getHeaders(event); // Set the content type of the message body to HTML // rv.add("Content-Type: text/html"); // set the subject rv.add("Subject: " + getSubject(event)); // from rv.add(getFromAddress(event)); // to rv.add(getTo(event)); return rv; }
65. SiteEmailNotificationSyllabus#getHeaders()
View license/** * @inheritDoc */ protected List getHeaders(Event event) { List rv = super.getHeaders(event); // Set the content type of the message body to HTML // rv.add("Content-Type: text/html"); // set the subject rv.add("Subject: " + getSubject(event)); // from rv.add(getFrom(event)); // to rv.add(getTo(event)); return rv; }
66. UserHandlerTest#testAddAssignedSystemGroupsWithInvalidGroup()
View licensepublic void testAddAssignedSystemGroupsWithInvalidGroup() throws Exception { ServerGroup sg1 = ServerGroupTestUtils.createManaged(admin); ServerGroup sg2 = ServerGroupTestUtils.createManaged(admin); Object[] groups = handler.listAssignedSystemGroups(admin, regular.getLogin()); assertEquals(0, groups.length); List names = new LinkedList(); names.add(sg1.getName()); names.add(sg2.getName()); names.add("notarealgroup"); try { handler.addAssignedSystemGroups(admin, regular.getLogin(), names, Boolean.FALSE); fail(); } catch (InvalidServerGroupException e) { } groups = handler.listAssignedSystemGroups(admin, regular.getLogin()); assertEquals(0, groups.length); }
67. ServerGroupHandlerTest#testListActiveServersInGroup()
View licensepublic void testListActiveServersInGroup() throws Exception { ManagedServerGroup group = ServerGroupTestUtils.createManaged(admin); Server server = ServerTestUtils.createTestSystem(admin); Server server2 = ServerTestUtils.createTestSystem(admin); List test = new ArrayList(); test.add(server); test.add(server2); Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, -442); server2.getServerInfo().setCheckin(cal.getTime()); ServerGroupManager.getInstance().addServers(group, test, admin); TestUtils.saveAndFlush(server); TestUtils.saveAndFlush(group); List list = handler.listActiveSystemsInGroup(admin, group.getName()); assertEquals(1, list.size()); assertEquals(server.getId().toString(), list.get(0).toString()); }
68. ServerGroupHandlerTest#testListInactiveServersInGroup()
View licensepublic void testListInactiveServersInGroup() throws Exception { ManagedServerGroup group = ServerGroupTestUtils.createManaged(admin); Server server = ServerTestUtils.createTestSystem(admin); Server server2 = ServerTestUtils.createTestSystem(admin); List test = new ArrayList(); test.add(server); test.add(server2); ServerGroupManager.getInstance().addServers(group, test, admin); Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, -442); server.getServerInfo().setCheckin(cal.getTime()); TestUtils.saveAndFlush(server); TestUtils.saveAndFlush(group); List list = handler.listInactiveSystemsInGroup(admin, group.getName(), 1); assertEquals(1, list.size()); assertEquals(server.getId().toString(), list.get(0).toString()); }
69. JSONOpaqueSerializer#serialize()
View license@Override public byte[] serialize(OpaqueValue obj) { List toSer = new ArrayList(3); toSer.add(obj.currTxid); toSer.add(obj.curr); toSer.add(obj.prev); try { return JSONValue.toJSONString(toSer).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
70. AfterInvocationProviderManagerTests#testSupportsSecureObjectIteration()
View license@Test public void testSupportsSecureObjectIteration() throws Exception { AfterInvocationProviderManager manager = new AfterInvocationProviderManager(); List list = new Vector(); list.add(new MockAfterInvocationProvider("swap1", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP1"))); list.add(new MockAfterInvocationProvider("swap2", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP2"))); list.add(new MockAfterInvocationProvider("swap3", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP3"))); manager.setProviders(list); manager.afterPropertiesSet(); // assertFalse(manager.supports(FilterInvocation.class)); assertThat(manager.supports(MethodInvocation.class)).isTrue(); }
71. AfterInvocationProviderManagerTests#testSupportsConfigAttributeIteration()
View license@Test public void testSupportsConfigAttributeIteration() throws Exception { AfterInvocationProviderManager manager = new AfterInvocationProviderManager(); List list = new Vector(); list.add(new MockAfterInvocationProvider("swap1", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP1"))); list.add(new MockAfterInvocationProvider("swap2", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP2"))); list.add(new MockAfterInvocationProvider("swap3", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP3"))); manager.setProviders(list); manager.afterPropertiesSet(); assertThat(manager.supports(new SecurityConfig("UNKNOWN_ATTRIB"))).isFalse(); assertThat(manager.supports(new SecurityConfig("GIVE_ME_SWAP2"))).isTrue(); }
72. AfterInvocationProviderManagerTests#testRejectsNonAfterInvocationProviders()
View license@Test public void testRejectsNonAfterInvocationProviders() { AfterInvocationProviderManager manager = new AfterInvocationProviderManager(); List list = new Vector(); list.add(new MockAfterInvocationProvider("swap1", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP1"))); list.add(Integer.valueOf(45)); list.add(new MockAfterInvocationProvider("swap3", MethodInvocation.class, new SecurityConfig("GIVE_ME_SWAP3"))); try { manager.setProviders(list); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertThat(true).isTrue(); } }
73. PagedResultTest#testEquals()
View license@Test public void testEquals() throws Exception { List expectedList = new LinkedList(); expectedList.add("dummy"); List otherList = new LinkedList(); otherList.add("different"); PagedResult originalObject = new PagedResult(expectedList, new PagedResultsCookie(null)); PagedResult identicalObject = new PagedResult(expectedList, new PagedResultsCookie(null)); PagedResult differentObject = new PagedResult(otherList, new PagedResultsCookie(null)); PagedResult subclassObject = new PagedResult(expectedList, new PagedResultsCookie(null)) { }; new EqualsTester(originalObject, identicalObject, differentObject, subclassObject); }
74. ContainmentCycleTestCase#sequenceManyValueNMember()
View license/** * Create an n-member containment cycle by making updates to a Sequence. * The data member in this case is many valued. * @param dataObj1 * @param dataObj2 * @param dataObj3 */ private void sequenceManyValueNMember(final DataObject dataObj1, final DataObject dataObj2, final DataObject dataObj3) { assertTrue("DataObject is not Sequenced. Test case may not proceed.", dataObj1.getType().isSequenced()); final List addList = new ArrayList(); addList.add(dataObj2); dataObj1.setList("ContainMany", addList); addList.clear(); addList.add(dataObj3); dataObj2.setList("ContainMany", addList); final Sequence sequence = dataObj3.getSequence(); sequence.add("ContainMany", dataObj1); }
75. AlluxioInterpreterTest#testCompletion()
View license@Test public void testCompletion() { List expectedResultOne = Arrays.asList("cat", "chgrp", "chmod", "chown", "copyFromLocal", "copyToLocal", "count", "createLineage"); List expectedResultTwo = Arrays.asList("copyFromLocal", "copyToLocal", "count"); List expectedResultThree = Arrays.asList("copyFromLocal", "copyToLocal"); List expectedResultNone = new ArrayList<String>(); List<InterpreterCompletion> resultOne = alluxioInterpreter.completion("c", 0); List<InterpreterCompletion> resultTwo = alluxioInterpreter.completion("co", 0); List<InterpreterCompletion> resultThree = alluxioInterpreter.completion("copy", 0); List<InterpreterCompletion> resultNotMatch = alluxioInterpreter.completion("notMatch", 0); List<InterpreterCompletion> resultAll = alluxioInterpreter.completion("", 0); Assert.assertEquals(expectedResultOne, resultOne); Assert.assertEquals(expectedResultTwo, resultTwo); Assert.assertEquals(expectedResultThree, resultThree); Assert.assertEquals(expectedResultNone, resultNotMatch); Assert.assertEquals(alluxioInterpreter.keywords, resultAll); }
76. YamlWriterTest#testSimpleTypes()
View licensepublic void testSimpleTypes() throws Exception { String string = "simple string"; assertEquals(string, roundTrip(string)); Map map = new HashMap(); map.put("moo", "cow"); assertEquals(map, roundTrip(map)); List list = new ArrayList(); list.add("moo"); list.add("cow"); assertEquals(list, roundTrip(list)); map.put("fubar", list); assertEquals(map, roundTrip(map)); String[] stringArray = new String[] { "moo", "meow", "cow", "gato" }; List result = (List) roundTrip(stringArray); assertEquals(stringArray[0], result.get(0)); assertEquals(stringArray[1], result.get(1)); assertEquals(stringArray[2], result.get(2)); assertEquals(stringArray[3], result.get(3)); }
77. ReferenceByXPathMarshallingStrategyTest#testStoresReferencesUsingAbsoluteXPath()
View licensepublic void testStoresReferencesUsingAbsoluteXPath() { xstream.setMode(XStream.XPATH_ABSOLUTE_REFERENCES); Thing a = new Thing("a"); Thing b = new Thing("b"); Thing c = b; List list = new ArrayList(); list.add(a); list.add(b); list.add(c); String expected = "" + "<list>\n" + " <thing>\n" + " <name>a</name>\n" + " </thing>\n" + " <thing>\n" + " <name>b</name>\n" + " </thing>\n" + // xpath " <thing reference=\"/list/thing[2]\"/>\n" + "</list>"; assertBothWays(list, expected); }
78. ReferenceByXPathMarshallingStrategyTest#testStoresReferencesUsingRelativeXPath()
View licensepublic void testStoresReferencesUsingRelativeXPath() { xstream.setMode(XStream.XPATH_RELATIVE_REFERENCES); Thing a = new Thing("a"); Thing b = new Thing("b"); Thing c = b; List list = new ArrayList(); list.add(a); list.add(b); list.add(c); String expected = "" + "<list>\n" + " <thing>\n" + " <name>a</name>\n" + " </thing>\n" + " <thing>\n" + " <name>b</name>\n" + " </thing>\n" + // xpath " <thing reference=\"../thing[2]\"/>\n" + "</list>"; assertBothWays(list, expected); }
79. RelativeXPathReferenceTest#testXmlContainsReferencePaths()
View licensepublic void testXmlContainsReferencePaths() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String expected = "" + "<list>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + " <thing reference=\"../thing\"/>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + "</list>"; assertEquals(expected, xstream.toXML(list)); }
80. RelativeSingleNodeXPathReferenceTest#testXmlContainsReferencePaths()
View licensepublic void testXmlContainsReferencePaths() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String expected = "" + "<list>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + " <thing reference=\"../thing[1]\"/>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + "</list>"; assertEquals(expected, xstream.toXML(list)); }
81. NamedLocalElementsTest#testListWithNullElements()
View licensepublic void testListWithNullElements() { xstream.registerLocalConverter(Category.class, "products", new NamedCollectionConverter(xstream.getMapper(), "product", String.class)); List products = new ArrayList(); products.add("SiteMesh"); products.add(null); products.add("XStream"); Category category = new Category("Joe Walnes", "joe"); category.setProducts(products); String expected = ("" + "<category>\n" + " <name>Joe Walnes</name>\n" + " <id>joe</id>\n" + " <products>\n" + " <product>SiteMesh</product>\n" + " <product class='null'/>\n" + " <product>XStream</product>\n" + " </products>\n" + "</category>").replace('\'', '"'); assertBothWays(category, expected); }
82. AbsoluteXPathReferenceTest#testXmlContainsReferencePaths()
View licensepublic void testXmlContainsReferencePaths() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String expected = "" + "<list>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + " <thing reference=\"/list/thing\"/>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + "</list>"; assertEquals(expected, xstream.toXML(list)); }
83. AbsoluteSingleNodeXPathReferenceTest#testXmlContainsReferencePaths()
View licensepublic void testXmlContainsReferencePaths() { Thing sameThing = new Thing("hello"); Thing anotherThing = new Thing("hello"); List list = new ArrayList(); list.add(sameThing); list.add(sameThing); list.add(anotherThing); String expected = "" + "<list>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + " <thing reference=\"/list[1]/thing[1]\"/>\n" + " <thing>\n" + " <field>hello</field>\n" + " </thing>\n" + "</list>"; assertEquals(expected, xstream.toXML(list)); }
84. TestMetadata#testAddMany()
View licensepublic void testAddMany() { List counting = new Vector(); counting.add("1"); counting.add("2"); counting.add("3"); metadata.addMetadata("ManyTest", counting); assertNotNull(metadata.getAllMetadata("ManyTest")); assertEquals(3, metadata.getAllMetadata("ManyTest").size()); // test ordering assertEquals("1", (String) metadata.getAllMetadata("ManyTest").get(0)); assertEquals("2", (String) metadata.getAllMetadata("ManyTest").get(1)); assertEquals("3", (String) metadata.getAllMetadata("ManyTest").get(2)); }
85. FunctionHelperTest#testExtractString()
View licensepublic void testExtractString() throws XPathFunctionException { List inputs = new ArrayList(); final String data = " a dummy text with leading and trailing whitespaces "; // if a raw string is passed, the result must not be trimmed assertEquals(data, JaxpFunctionResolver.Helper.extractString(data)); // else, the result mut be trimmed final String expectedResult = data.trim(); Document doc = DOMUtils.newDocument(); Text textNode = doc.createTextNode(data); inputs.add(textNode); inputs.add(Arrays.asList(textNode)); DocumentWrapper dw = new DocumentWrapper(doc, "", new Configuration()); NodeWrapper nw = dw.wrap(textNode); inputs.add(nw); for (int i = 0; i < inputs.size(); i++) { assertEquals(expectedResult, JaxpFunctionResolver.Helper.extractString(inputs.get(i))); } }
86. X509CertSelector#addSubjectAlternativeName()
View license/** * Adds a name to the subjectAlternativeNames criterion. The * <code>X509Certificate</code> must contain all or at least one of the * specified subjectAlternativeNames, depending on the value of the * matchAllNames flag (see {@link #setMatchAllSubjectAltNames}).<br /> * <br /> * This method allows the caller to add a name to the set of subject * alternative names. The specified name is added to any previous value for * the subjectAlternativeNames criterion. If the specified name is a * duplicate, it may be ignored.<br /> * <br /> * The name is provided in string format. RFC 822, DNS, and URI names use * the well-established string formats for those types (subject to the * restrictions included in RFC 2459). IPv4 address names are supplied using * dotted quad notation. OID address names are represented as a series of * nonnegative integers separated by periods. And directory names * (distinguished names) are supplied in RFC 2253 format. No standard string * format is defined for otherNames, X.400 names, EDI party names, IPv6 * address names, or any other type of names. They should be specified using * the * {@link #addSubjectAlternativeName(int, byte[]) addSubjectAlternativeName(int type, byte [] name)} * method. * * @param type * the name type (0-8, as specified in RFC 2459, section 4.2.1.7) * @param name - * the name in string form (not null) * * @exception IOException * if a parsing error occurs */ public void addSubjectAlternativeName(int type, String name) throws IOException { // TODO full implementation of CertUtil.parseGeneralName byte[] encoded = CertUtil.parseGeneralName(type, name); List tmpList = new ArrayList(); tmpList.add(Integers.valueOf(type)); tmpList.add(name); subjectAltNames.add(tmpList); tmpList.set(1, encoded); subjectAltNamesByte.add(tmpList); }
87. X509CertSelector#addPathToName()
View license/** * Adds a name to the pathToNames criterion. The * <code>X509Certificate</code> must not include name constraints that * would prohibit building a path to the specified name.<br /> * <br /> * This method allows the caller to add a name to the set of names which the * <code>X509Certificates</code>'s name constraints must permit. The * specified name is added to any previous value for the pathToNames * criterion. If the name is a duplicate, it may be ignored.<br /> * <br /> * The name is provided in string format. RFC 822, DNS, and URI names use * the well-established string formats for those types (subject to the * restrictions included in RFC 2459). IPv4 address names are supplied using * dotted quad notation. OID address names are represented as a series of * nonnegative integers separated by periods. And directory names * (distinguished names) are supplied in RFC 2253 format. No standard string * format is defined for otherNames, X.400 names, EDI party names, IPv6 * address names, or any other type of names. They should be specified using * the * {@link #addPathToName(int, byte[]) addPathToName(int type, byte [] name)} * method.<br /> * <br /> * <b>TODO: implement this match check for this</b> * * @param type * the name type (0-8, as specified in RFC 2459, section 4.2.1.7) * @param name * the name in string form * * @exceptrion IOException if a parsing error occurs */ public void addPathToName(int type, String name) throws IOException { // TODO full implementation of CertUtil.parseGeneralName byte[] encoded = CertUtil.parseGeneralName(type, name); List tmpList = new ArrayList(); tmpList.add(Integers.valueOf(type)); tmpList.add(name); pathToNames.add(tmpList); tmpList.set(1, encoded); pathToNamesByte.add(tmpList); throw new UnsupportedOperationException(); }
88. TestUser#getTestUsers()
View licensepublic static List<TestUser> getTestUsers() { TestUser joelli = new TestUser("joelli"); joelli.setAge(36); joelli.setSalary(10000.01); TestUser lucy = new TestUser("lucy"); lucy.setAge(35); lucy.setSalary(6000.5); TestUser lyy = new TestUser("lyy"); lyy.setAge(37); lyy.setSalary(12000.01); List all = new ArrayList(); all.add(joelli); all.add(lucy); all.add(lyy); return all; }
89. User#getTestUsers()
View licensepublic static List<User> getTestUsers() { User joelli = new User("joelli"); joelli.setAge(36); joelli.setSalary(10000.01); User lucy = new User("lucy"); lucy.setAge(35); lucy.setSalary(6000.5); User lyy = new User("lyy"); lyy.setAge(37); lyy.setSalary(12000.01); List all = new ArrayList(); all.add(joelli); all.add(lucy); all.add(lyy); return all; }
90. User#getTestUsers()
View licensepublic static List<User> getTestUsers() { User joelli = new User("joelli"); joelli.setAge(36); joelli.setSalary(10000.01); User lucy = new User("lucy"); lucy.setAge(35); lucy.setSalary(6000.5); User lyy = new User("lyy"); lyy.setAge(37); lyy.setSalary(12000.01); List all = new ArrayList(); all.add(joelli); all.add(lucy); all.add(lyy); return all; }
91. ExampleListener#init()
View license/** * ?????,??ExampleEventType.type1?ExampleEventType.type2??????? * ?????????????????????????????? */ public void init() { List eventtypes = new ArrayList(); eventtypes.add(ExampleEventType.type1); eventtypes.add(ExampleEventType.type2); eventtypes.add(ExampleEventType.type2withtarget); //???????????????????????????????????? //?????eventtypes???????????? NotifiableFactory.getNotifiable().addListener(this, eventtypes); /** * ??????????????????? * NotifiableFactory.getNotifiable().addListener(this, eventtypes,Listener.LOCAL); * ?????????????????????????????? * NotifiableFactory.getNotifiable().addListener(this, eventtypes,Listener.LOCAL_REMOTE); * ????????????????????????? * NotifiableFactory.getNotifiable().addListener(this, eventtypes,Listener.REMOTE); */ }
92. GroovySumFilterTest#testSendMatchingMessage()
View license@Test public void testSendMatchingMessage() throws Exception { getMockEndpoint("mock:high").expectedMessageCount(1); getMockEndpoint("mock:low").expectedMessageCount(0); List orders = new ArrayList(); orders.add(new Order("Camel in Action", 50)); orders.add(new Order("ActiveMQ in Action", 40)); orders.add(new Order("Spring in Action", 60)); template.sendBody("direct:start", orders); assertMockEndpointsSatisfied(); }
93. X509CertSelector#addSubjectAlternativeName()
View license/** * Adds a name to the subjectAlternativeNames criterion. The * <code>X509Certificate</code> must contain all or at least one of the * specified subjectAlternativeNames, depending on the value of the * matchAllNames flag (see {@link #setMatchAllSubjectAltNames}).<br /> * <br /> * This method allows the caller to add a name to the set of subject * alternative names. The specified name is added to any previous value for * the subjectAlternativeNames criterion. If the specified name is a * duplicate, it may be ignored.<br /> * <br /> * The name is provided in string format. RFC 822, DNS, and URI names use * the well-established string formats for those types (subject to the * restrictions included in RFC 2459). IPv4 address names are supplied using * dotted quad notation. OID address names are represented as a series of * nonnegative integers separated by periods. And directory names * (distinguished names) are supplied in RFC 2253 format. No standard string * format is defined for otherNames, X.400 names, EDI party names, IPv6 * address names, or any other type of names. They should be specified using * the * {@link #addSubjectAlternativeName(int, byte[]) addSubjectAlternativeName(int type, byte [] name)} * method. * * @param type * the name type (0-8, as specified in RFC 2459, section 4.2.1.7) * @param name - * the name in string form (not null) * * @exception IOException * if a parsing error occurs */ public void addSubjectAlternativeName(int type, String name) throws IOException { // TODO full implementation of CertUtil.parseGeneralName byte[] encoded = CertUtil.parseGeneralName(type, name); List tmpList = new ArrayList(); tmpList.add(Integers.valueOf(type)); tmpList.add(name); subjectAltNames.add(tmpList); tmpList.set(1, encoded); subjectAltNamesByte.add(tmpList); }
94. X509CertSelector#addPathToName()
View license/** * Adds a name to the pathToNames criterion. The * <code>X509Certificate</code> must not include name constraints that * would prohibit building a path to the specified name.<br /> * <br /> * This method allows the caller to add a name to the set of names which the * <code>X509Certificates</code>'s name constraints must permit. The * specified name is added to any previous value for the pathToNames * criterion. If the name is a duplicate, it may be ignored.<br /> * <br /> * The name is provided in string format. RFC 822, DNS, and URI names use * the well-established string formats for those types (subject to the * restrictions included in RFC 2459). IPv4 address names are supplied using * dotted quad notation. OID address names are represented as a series of * nonnegative integers separated by periods. And directory names * (distinguished names) are supplied in RFC 2253 format. No standard string * format is defined for otherNames, X.400 names, EDI party names, IPv6 * address names, or any other type of names. They should be specified using * the * {@link #addPathToName(int, byte[]) addPathToName(int type, byte [] name)} * method.<br /> * <br /> * <b>TODO: implement this match check for this</b> * * @param type * the name type (0-8, as specified in RFC 2459, section 4.2.1.7) * @param name * the name in string form * * @exceptrion IOException if a parsing error occurs */ public void addPathToName(int type, String name) throws IOException { // TODO full implementation of CertUtil.parseGeneralName byte[] encoded = CertUtil.parseGeneralName(type, name); List tmpList = new ArrayList(); tmpList.add(Integers.valueOf(type)); tmpList.add(name); pathToNames.add(tmpList); tmpList.set(1, encoded); pathToNamesByte.add(tmpList); throw new UnsupportedOperationException(); }
95. PipesTest#evalIssue()
View license@Test public void evalIssue() { Pipes<String, Integer> bus = Pipes.of(); bus.register("reactor", QueueFactories.<Integer>boundedNonBlockingQueue(1000).build()); bus.publishTo("reactor", ReactiveSeq.of(10, 20, 30)); val ev = bus.nextOrNull("reactor"); List results = new ArrayList(); results.add(ev.get()); results.add(ev.get()); results.add(ev.get()); assertThat(results, equalTo(ListX.of(10, 20, 30))); //finished! }
96. PipesTest#oneOrErrorFinishes()
View license@Test public void oneOrErrorFinishes() { Pipes<String, Integer> bus = Pipes.of(); bus.register("reactor", QueueFactories.<Integer>boundedNonBlockingQueue(1000).build()); bus.publishTo("reactor", ReactiveSeq.of(10, 20, 30)); List results = new ArrayList(); results.add(bus.oneOrError("reactor").get()); results.add(bus.oneOrError("reactor").get()); results.add(bus.oneOrError("reactor").get()); assertThat(results, equalTo(ListX.of(10, 20, 30))); }
97. JdbcModelReader#initColumnsForPK()
View license/** * Returns descriptors for the columns that shall be read from the result set when * reading the meta data for primary keys. Note that the columns are read in the order * defined by this list.<br/> * Redefine this method if you want more columns or a different order. * * @return The map column name -> descriptor for the result set columns */ protected List initColumnsForPK() { List result = new ArrayList(); result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); // we're also reading the table name so that a model reader impl can filter manually result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); // the name of the primary key is currently only interesting to the pk index name resolution result.add(new MetaDataColumnDescriptor("PK_NAME", Types.VARCHAR)); return result; }
98. JSONOpaqueSerializer#serialize()
View license@Override public byte[] serialize(OpaqueValue obj) { List toSer = new ArrayList(3); toSer.add(obj.currTxid); toSer.add(obj.curr); toSer.add(obj.prev); try { return JSONValue.toJSONString(toSer).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
99. StageConfigTest#shouldRemoveStageLevelAuthorizationWhenInheritingPermissionsFromGroup()
View license@Test public void shouldRemoveStageLevelAuthorizationWhenInheritingPermissionsFromGroup() { StageConfig config = new StageConfig(); StageConfigMother.addApprovalWithRoles(config, "role1"); StageConfigMother.addApprovalWithUsers(config, "user1"); HashMap map = new HashMap(); List operateUsers = new ArrayList(); operateUsers.add(nameMap("user1")); map.put(StageConfig.OPERATE_USERS, operateUsers); List operateRoles = new ArrayList(); operateRoles.add(nameMap("role1")); map.put(StageConfig.OPERATE_ROLES, operateRoles); map.put(StageConfig.SECURITY_MODE, "inherit"); config.setConfigAttributes(map); assertThat(config.getApproval().getAuthConfig().isEmpty(), is(true)); }
100. JsonSerializerTest#testSimpleList()
View license@Test public void testSimpleList() { List list = new LinkedList(); list.add("one"); list.add(new Bar()); list.add(Double.valueOf(31E302)); JsonSerializer jsonSerializer = new JsonSerializer(); String json = jsonSerializer.serialize(list); assertEquals("[\"one\",{\"foo\":null,\"number\":0},3.1E303]", json); }