org.testng.collections.Lists Java Examples
The following examples show how to use
org.testng.collections.Lists.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FullContactIT.java From streams with Apache License 2.0 | 6 votes |
@Test public void testEnrichPersonByGithubUrl() throws Exception { PersonEnrichment personEnrichment = FullContact.getInstance(config); String url = StreamsConfigurator.getConfig().getString("org.apache.streams.fullcontact.test.FullContactIT.testEnrichPersonByGithubUrl.url"); EnrichPersonRequest req = new EnrichPersonRequest() .withProfiles( Lists.newArrayList( new ProfileQuery() .withService("github") .withUrl(url) ) ); PersonSummary response = personEnrichment.enrichPerson(req); nonNull(response); nonNull(response.getFullName()); assertThat("response contains a non-empty fullName", StringUtils.isNotBlank(response.getFullName())); }
Example #2
Source File: EfficiencyBenchmark.java From concurrentlinkedhashmap with Apache License 2.0 | 6 votes |
@Test(groups = "efficiency") @Parameters({"capacity", "passes", "generatorMultipler", "workingSetMultiplier"}) public void benchmark(int capacity, int passes, int generatorMultipler, int workingSetMultiplier) { Generator generator = new ScrambledZipfianGenerator(generatorMultipler * capacity); List<List<String>> workingSets = Lists.newArrayList(); for (int i = 1; i <= passes; i++) { int size = i * workingSetMultiplier * capacity; workingSets.add(createWorkingSet(generator, size)); } Set<Policy> seen = EnumSet.noneOf(Policy.class); for (CacheType cache : CacheType.values()) { if (!seen.add(cache.policy())) { continue; } Map<String, String> map = new CacheFactory() .maximumCapacity(capacity) .makeCache(cache); System.out.println(cache.policy().toString() + ":"); for (List<String> workingSet : workingSets) { System.out.println(determineEfficiency(map, workingSet)); } } }
Example #3
Source File: TestRunner.java From qaf with MIT License | 6 votes |
private List<List<IMethodInstance>> createInstances(List<IMethodInstance> methodInstances) { Map<Object, List<IMethodInstance>> map = Maps.newHashMap(); // MapList<IMethodInstance[], Object> map = new MapList<IMethodInstance[], Object>(); for (IMethodInstance imi : methodInstances) { for (Object o : imi.getInstances()) { System.out.println(o); List<IMethodInstance> l = map.get(o); if (l == null) { l = Lists.newArrayList(); map.put(o, l); } l.add(imi); } // for (Object instance : imi.getInstances()) { // map.put(imi, instance); // } } // return map.getKeys(); // System.out.println(map); return new ArrayList<List<IMethodInstance>>(map.values()); }
Example #4
Source File: TestRunner.java From qaf with MIT License | 6 votes |
/** * Apply the method interceptor (if applicable) to the list of methods. */ private ITestNGMethod[] intercept(ITestNGMethod[] methods) { List<IMethodInstance> methodInstances = methodsToMethodInstances(Arrays.asList(methods)); // add built-in interceptor (PreserveOrderMethodInterceptor or InstanceOrderingMethodInterceptor at the end of the list m_methodInterceptors.add(builtinInterceptor); for (IMethodInterceptor m_methodInterceptor : m_methodInterceptors) { methodInstances = m_methodInterceptor.intercept(methodInstances, this); } List<ITestNGMethod> result = Lists.newArrayList(); for (IMethodInstance imi : methodInstances) { result.add(imi.getMethod()); } //Since an interceptor is involved, we would need to ensure that the ClassMethodMap object is in sync with the //output of the interceptor, else @AfterClass doesn't get executed at all when interceptors are involved. //so let's update the current classMethodMap object with the list of methods obtained from the interceptor. this.m_classMethodMap = new ClassMethodMap(result, null); return result.toArray(new ITestNGMethod[result.size()]); }
Example #5
Source File: TimeBasedSelectionPolicyTest.java From incubator-gobblin with Apache License 2.0 | 6 votes |
@Test public void testListCopyableVersions() { Properties props = new Properties(); Path dummyPath = new Path("dummy"); DateTime dt1 = new DateTime().minusDays(8); DateTime dt2 = new DateTime().minusDays(6); props.put(SelectAfterTimeBasedPolicy.TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY, "7d"); SelectAfterTimeBasedPolicy policyLookback7Days = new SelectAfterTimeBasedPolicy(props); TimestampedDatasetVersion version1 = new TimestampedDatasetVersion(dt1, dummyPath); TimestampedDatasetVersion version2 = new TimestampedDatasetVersion(dt2, dummyPath); Assert.assertEquals(policyLookback7Days.listSelectedVersions(Lists.newArrayList(version1, version2)).size(), 1); props.put(SelectAfterTimeBasedPolicy.TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY, "1h"); SelectAfterTimeBasedPolicy policyLookback1Hour = new SelectAfterTimeBasedPolicy(props); Assert.assertEquals(policyLookback1Hour.listSelectedVersions(Lists.newArrayList(version1, version2)).size(), 0); props.put(SelectAfterTimeBasedPolicy.TIME_BASED_SELECTION_LOOK_BACK_TIME_KEY, "9d"); SelectAfterTimeBasedPolicy policyLookback8Days = new SelectAfterTimeBasedPolicy(props); Assert.assertEquals(policyLookback8Days.listSelectedVersions(Lists.newArrayList(version1, version2)).size(), 2); }
Example #6
Source File: TestClass.java From qaf with MIT License | 6 votes |
/** * Create the test methods that belong to this class (rejects * all those that belong to a different class). */ private ITestNGMethod[] createTestMethods(ITestNGMethod[] methods) { List<ITestNGMethod> vResult = Lists.newArrayList(); for (ITestNGMethod tm : methods) { ConstructorOrMethod m = tm.getConstructorOrMethod(); if (m.getDeclaringClass().isAssignableFrom(m_testClass)) { for (Object o : m_iClass.getInstances(false)) { log(4, "Adding method " + tm + " on TestClass " + m_testClass); vResult.add(new TestNGScenario(/* tm.getRealClass(), */ m.getMethod(), m_annotationFinder, m_xmlTest, o)); } } else { log(4, "Rejecting method " + tm + " for TestClass " + m_testClass); } } ITestNGMethod[] result = vResult.toArray(new ITestNGMethod[vResult.size()]); return result; }
Example #7
Source File: DependencyMap.java From qaf with MIT License | 6 votes |
public List<ITestNGMethod> getMethodsThatBelongTo(String group, ITestNGMethod fromMethod) { Set<String> uniqueKeys = m_groups.keySet(); List<ITestNGMethod> result = Lists.newArrayList(); for (String k : uniqueKeys) { if (Pattern.matches(group, k)) { result.addAll(m_groups.get(k)); } } if (result.isEmpty() && !fromMethod.ignoreMissingDependencies()) { throw new TestNGException("DependencyMap::Method \"" + fromMethod + "\" depends on nonexistent group \"" + group + "\""); } else { return result; } }
Example #8
Source File: TestRunner.java From qaf with MIT License | 6 votes |
@Override public Injector getInjector(IClass iClass) { Annotation annotation = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); if (annotation == null) return null; if (iClass instanceof TestClass) { iClass = ((TestClass)iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) return null; Injector parentInjector = ((ClassImpl)iClass).getParentInjector(); Guice guice = (Guice) annotation; List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); // Reuse the previous injector, if any Injector injector = getInjector(moduleInstances); if (injector == null) { injector = parentInjector.createChildInjector(moduleInstances); addInjector(moduleInstances, injector); } return injector; }
Example #9
Source File: FileBasedSourceTest.java From incubator-gobblin with Apache License 2.0 | 6 votes |
@Test public void testFailJobWhenPreviousStateExistsButDoesNotHaveSnapshot() { try { DummyFileBasedSource source = new DummyFileBasedSource(); WorkUnitState workUnitState = new WorkUnitState(); workUnitState.setId("priorState"); List<WorkUnitState> workUnitStates = Lists.newArrayList(workUnitState); State state = new State(); state.setProp(ConfigurationKeys.EXTRACT_TABLE_TYPE_KEY, Extract.TableType.SNAPSHOT_ONLY.toString()); state.setProp(ConfigurationKeys.SOURCE_FILEBASED_FS_PRIOR_SNAPSHOT_REQUIRED, true); SourceState sourceState = new SourceState(state, workUnitStates); source.getWorkunits(sourceState); Assert.fail("Expected RuntimeException, but no exceptions were thrown."); } catch (RuntimeException e) { Assert.assertEquals("No 'source.filebased.fs.snapshot' found on state of prior job", e.getMessage()); } }
Example #10
Source File: MethodHelper.java From qaf with MIT License | 6 votes |
/** * Collects and orders test or configuration methods * @param methods methods to be worked on * @param forTests true for test methods, false for configuration methods * @param runInfo * @param finder annotation finder * @param unique true for unique methods, false otherwise * @param outExcludedMethods * @return list of ordered methods */ public static ITestNGMethod[] collectAndOrderMethods(List<ITestNGMethod> methods, boolean forTests, RunInfo runInfo, IAnnotationFinder finder, boolean unique, List<ITestNGMethod> outExcludedMethods) { List<ITestNGMethod> includedMethods = Lists.newArrayList(); MethodGroupsHelper.collectMethodsByGroup(methods.toArray(new ITestNGMethod[methods.size()]), forTests, includedMethods, outExcludedMethods, runInfo, finder, unique); return sortMethods(forTests, includedMethods, finder).toArray(new ITestNGMethod[]{}); }
Example #11
Source File: LoaderTest.java From incubator-pinot with Apache License 2.0 | 6 votes |
private void constructSegmentWithTextIndex(SegmentVersion segmentVersion) throws Exception { FileUtils.deleteQuietly(INDEX_DIR); SegmentGeneratorConfig segmentGeneratorConfig = SegmentTestUtils.getSegmentGeneratorConfigWithoutTimeColumn(_avroFile, INDEX_DIR, "testTable"); SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null); List<String> textIndexCreationColumns = Lists.newArrayList(TEXT_INDEX_COL_NAME); List<String> rawIndexCreationColumns = Lists.newArrayList(TEXT_INDEX_COL_NAME); segmentGeneratorConfig.setTextIndexCreationColumns(textIndexCreationColumns); segmentGeneratorConfig.setRawIndexCreationColumns(rawIndexCreationColumns); segmentGeneratorConfig.setSegmentVersion(segmentVersion); driver.init(segmentGeneratorConfig); driver.build(); _indexDir = new File(INDEX_DIR, driver.getSegmentName()); }
Example #12
Source File: MethodHelper.java From qaf with MIT License | 6 votes |
private static List<ITestNGMethod> sortMethods(boolean forTests, List<ITestNGMethod> allMethods, IAnnotationFinder finder) { List<ITestNGMethod> sl = Lists.newArrayList(); List<ITestNGMethod> pl = Lists.newArrayList(); ITestNGMethod[] allMethodsArray = allMethods.toArray(new ITestNGMethod[allMethods.size()]); // Fix the method inheritance if these are @Configuration methods to make // sure base classes are invoked before child classes if 'before' and the // other way around if they are 'after' if (!forTests && allMethodsArray.length > 0) { ITestNGMethod m = allMethodsArray[0]; boolean before = m.isBeforeClassConfiguration() || m.isBeforeMethodConfiguration() || m.isBeforeSuiteConfiguration() || m.isBeforeTestConfiguration(); MethodInheritance.fixMethodInheritance(allMethodsArray, before); } topologicalSort(allMethodsArray, sl, pl); List<ITestNGMethod> result = Lists.newArrayList(); result.addAll(sl); result.addAll(pl); return result; }
Example #13
Source File: PeerReplicatorTest.java From pulsar with Apache License 2.0 | 6 votes |
@Test(timeOut = 10000) public void testGetPeerClusters() throws Exception { // clean up peer-clusters admin1.clusters().updatePeerClusterNames("r1", null); admin1.clusters().updatePeerClusterNames("r2", null); admin1.clusters().updatePeerClusterNames("r3", null); final String mainClusterName = "r1"; assertNull(admin1.clusters().getPeerClusterNames(mainClusterName)); LinkedHashSet<String> peerClusters = Sets.newLinkedHashSet(Lists.newArrayList("r2", "r3")); admin1.clusters().updatePeerClusterNames(mainClusterName, peerClusters); retryStrategically((test) -> { try { return admin1.clusters().getPeerClusterNames(mainClusterName).size() == 1; } catch (PulsarAdminException e) { return false; } }, 5, 100); assertEquals(admin1.clusters().getPeerClusterNames(mainClusterName), peerClusters); }
Example #14
Source File: SearchUtilTest.java From streams with Apache License 2.0 | 6 votes |
@Test public void test4() throws Exception { ThirtyDaySearchOperator operator = new ThirtyDaySearchOperator() .withKeywords(Lists.newArrayList("a")) .withAnds(Lists.newArrayList( new ThirtyDaySearchOperator() .withKeywords(Lists.newArrayList("b")) .withOrs(Lists.newArrayList( new ThirtyDaySearchOperator() .withKeywords(Lists.newArrayList("c"))) ) )) .withOrs(Lists.newArrayList( new ThirtyDaySearchOperator() .withKeywords(Lists.newArrayList("d")) .withAnds(Lists.newArrayList( new ThirtyDaySearchOperator() .withKeywords(Lists.newArrayList("e")) ) ) )) .withNot(true); String query = SearchUtil.toString(operator); Assert.assertEquals( "- ( a AND ( b OR ( c ) ) OR ( d AND ( e ) ) )", query); }
Example #15
Source File: PeopleDataLabsIT.java From streams with Apache License 2.0 | 6 votes |
@Test public void testBulkEnrichment() throws Exception { PersonEnrichment personEnrichment = PeopleDataLabs.getInstance(config); List<String> emails = testsconfig.getStringList("testBulkEnrichment.emails"); BulkEnrichPersonRequestItem item1 = new BulkEnrichPersonRequestItem() .withParams(new Params().withEmail(Lists.newArrayList(emails.get(0)))); BulkEnrichPersonRequestItem item2 = new BulkEnrichPersonRequestItem() .withParams(new Params().withEmail(Lists.newArrayList(emails.get(1)))); BulkEnrichPersonRequestItem item3 = new BulkEnrichPersonRequestItem() .withParams(new Params().withEmail(Lists.newArrayList(emails.get(2)))); List<BulkEnrichPersonRequestItem> reqList = Lists.newArrayList(item1, item2, item3); BulkEnrichPersonRequest bulkRequest = new BulkEnrichPersonRequest().withRequests(reqList); List<BulkEnrichPersonResponseItem> response = personEnrichment.bulkEnrichPerson(bulkRequest); nonNull(response); assertThat("response contains three response items", response.size() == 3); }
Example #16
Source File: FullContactIT.java From streams with Apache License 2.0 | 6 votes |
@Test public void testEnrichPersonByTwitterUsername() throws Exception { PersonEnrichment personEnrichment = FullContact.getInstance(config); String username = StreamsConfigurator.getConfig().getString("org.apache.streams.fullcontact.test.FullContactIT.testEnrichPersonByTwitterUsername.username"); EnrichPersonRequest req = new EnrichPersonRequest() .withProfiles( Lists.newArrayList( new ProfileQuery() .withService("twitter") .withUsername(username) ) ); PersonSummary response = personEnrichment.enrichPerson(req); nonNull(response); nonNull(response.getFullName()); assertThat("response contains a non-empty fullName", StringUtils.isNotBlank(response.getFullName())); }
Example #17
Source File: FullContactIT.java From streams with Apache License 2.0 | 6 votes |
@Test(enabled = false) public void testEnrichPersonByTwitterUserid() throws Exception { PersonEnrichment personEnrichment = FullContact.getInstance(config); String userid = StreamsConfigurator.getConfig().getString("org.apache.streams.fullcontact.test.FullContactIT.testEnrichPersonByTwitterUserid.userid"); EnrichPersonRequest req = new EnrichPersonRequest() .withProfiles( Lists.newArrayList( new ProfileQuery() .withService("twitter") .withUserid(userid) ) ); PersonSummary response = personEnrichment.enrichPerson(req); nonNull(response); nonNull(response.getFullName()); assertThat("response contains a non-empty fullName", StringUtils.isNotBlank(response.getFullName())); }
Example #18
Source File: IntegrationJobTagSuite.java From incubator-gobblin with Apache License 2.0 | 5 votes |
@Override public Collection<Config> getWorkerConfigs() { Config parent = super.getWorkerConfigs().iterator().next(); Config worker_1 = addInstanceTags(parent, WORKER_INSTANCE_1, WORKER_TAG_ASSOCIATION.get(WORKER_INSTANCE_1)); Config worker_2 = addInstanceTags(parent, WORKER_INSTANCE_2, WORKER_TAG_ASSOCIATION.get(WORKER_INSTANCE_2)); Config worker_3 = addInstanceTags(parent, WORKER_INSTANCE_3, WORKER_TAG_ASSOCIATION.get(WORKER_INSTANCE_3)); worker_1 = addTaskRunnerSuiteBuilder(worker_1); worker_2 = addTaskRunnerSuiteBuilder(worker_2); worker_3 = addTaskRunnerSuiteBuilder(worker_3); return Lists.newArrayList(worker_1, worker_2, worker_3); }
Example #19
Source File: GATKAnnotationPluginDescriptorUnitTest.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test // Note: this test takes advantage of the fact that InbreedingCoefficient does not compute for pedigrees with fewer than 10 founders. public void testToolDefaultAnnotationArgumentsOverridingFromCommandLine() { String argName = "--founder-id"; String[] goodArguments = new String[]{"s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10"}; CommandLineParser clp1 = new CommandLineArgumentParser( new Object(), Collections.singletonList(new GATKAnnotationPluginDescriptor( Collections.singletonList(new InbreedingCoeff(Collections.emptySet())), null)), Collections.emptySet()); CommandLineParser clp2 = new CommandLineArgumentParser( new Object(), // Adding a default value which should result in different annotations Collections.singletonList(new GATKAnnotationPluginDescriptor( Collections.singletonList(new InbreedingCoeff(new HashSet<>(Arrays.asList(goodArguments)))), null)), Collections.emptySet()); List<String> completeArguments = Lists.newArrayList("--annotation", InbreedingCoeff.class.getSimpleName()); List<String> incompleteArguments = Lists.newArrayList("--annotation", InbreedingCoeff.class.getSimpleName(), argName, "s1"); // These arguments are "incomplete" because InbreedingCoefficient Arrays.asList(goodArguments).forEach(arg -> {completeArguments.addAll(Arrays.asList(argName, arg));}); clp1.parseArguments(nullMessageStream, completeArguments.toArray(new String[completeArguments.size()])); List<Annotation> goodArgumentsOverridingincompleteArguments = instantiateAnnotations(clp1); clp2.parseArguments(nullMessageStream, incompleteArguments.toArray(new String[incompleteArguments.size()])); List<Annotation> incompleteArgumentsOverridingGoodArguments = instantiateAnnotations(clp2); Assert.assertEquals(goodArgumentsOverridingincompleteArguments.size(), 1); Assert.assertEquals(incompleteArgumentsOverridingGoodArguments.size(), 1); // assert that with good arguments overriding that the inbreeding coefficient is computed correctly Assert.assertEquals(Double.valueOf((String) ((InbreedingCoeff) goodArgumentsOverridingincompleteArguments.get(0)) .annotate(null, inbreedingCoefficientVC, null) .get(GATKVCFConstants.INBREEDING_COEFFICIENT_KEY)), -0.3333333, 0.001, "InbreedingCoefficientScores"); // assert that with incomplete arguments overriding that the inbreeding coefficient is not calculated Assert.assertEquals(((InbreedingCoeff) incompleteArgumentsOverridingGoodArguments.get(0)).annotate(null, inbreedingCoefficientVC, null), Collections.emptyMap()); }
Example #20
Source File: CleanerTimerTest.java From oxAuth with MIT License | 5 votes |
@Test public void umaRpt_whichIsExpiredAndDeletable_MustBeRemoved() throws StringEncrypter.EncryptionException { final Client client = createClient(); clientService.persist(client); // 1. create RPT final UmaRPT rpt = umaRptService.createRPTAndPersist(client, Lists.newArrayList()); // 2. RPT exists assertNotNull(umaRptService.getRPTByCode(rpt.getNotHashedCode())); // 3. clean up cleanerTimer.processImpl(); cacheService.clear(); // 4. RPT exists assertNotNull(umaRptService.getRPTByCode(rpt.getNotHashedCode())); final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); calendar.add(Calendar.MINUTE, -10); rpt.setExpirationDate(calendar.getTime()); umaRptService.merge(rpt); // 5. clean up cleanerTimer.processImpl(); cacheService.clear(); // 6. no RPT in persistence assertNull(umaRptService.getRPTByCode(rpt.getNotHashedCode())); }
Example #21
Source File: FeedbackQuestionAttributesTest.java From teammates with GNU General Public License v2.0 | 5 votes |
@Test public void testUpdateOptionsBuilder_withNullDescriptionInput_shouldUpdateAttributeCorrectly() { FeedbackQuestionAttributes.UpdateOptions updateOptions = FeedbackQuestionAttributes.updateOptionsBuilder("questionId") .withQuestionDescription(null) .build(); FeedbackQuestionAttributes questionAttributes = FeedbackQuestionAttributes.builder() .withCourseId("courseId") .withFeedbackSessionName("session") .withGiverType(FeedbackParticipantType.INSTRUCTORS) .withRecipientType(FeedbackParticipantType.SELF) .withNumberOfEntitiesToGiveFeedbackTo(3) .withQuestionNumber(1) .withQuestionDetails(new FeedbackTextQuestionDetails("question text")) .withShowGiverNameTo(new ArrayList<>()) .withShowRecipientNameTo(new ArrayList<>()) .withShowResponsesTo(new ArrayList<>()) .build(); questionAttributes.update(updateOptions); assertNull(questionAttributes.getQuestionDescription()); assertEquals("courseId", questionAttributes.getCourseId()); assertEquals("session", questionAttributes.getFeedbackSessionName()); assertEquals(FeedbackQuestionType.TEXT, questionAttributes.getQuestionType()); assertEquals("question text", questionAttributes.getQuestionDetails().getQuestionText()); assertEquals(1, questionAttributes.getQuestionNumber()); assertEquals(FeedbackParticipantType.INSTRUCTORS, questionAttributes.getGiverType()); assertEquals(FeedbackParticipantType.SELF, questionAttributes.getRecipientType()); assertEquals(3, questionAttributes.getNumberOfEntitiesToGiveFeedbackTo()); assertEquals(Lists.newArrayList(), questionAttributes.getShowResponsesTo()); assertEquals(Lists.newArrayList(), questionAttributes.getShowGiverNameTo()); assertEquals(Lists.newArrayList(), questionAttributes.getShowRecipientNameTo()); }
Example #22
Source File: SearchUtilTest.java From streams with Apache License 2.0 | 5 votes |
@Test public void test1() throws Exception { ThirtyDaySearchOperator operator = new ThirtyDaySearchOperator() .withBios(Lists.newArrayList( "steve", "matthew", "ate", "suneel" )); String query = SearchUtil.toString(operator); Assert.assertEquals( 4, StringUtils.countMatches(query, "bio:")); Assert.assertTrue( query.contains("steve")); Assert.assertTrue( query.contains("suneel")); }
Example #23
Source File: UmaResourceServiceTest.java From oxAuth with MIT License | 5 votes |
@Test public void umaResource_independentFromDeletableFlag_shouldBeSearchable() throws StringEncrypter.EncryptionException { final Client client = createClient(); clientService.persist(client); // 1. create resource UmaResource resource = new UmaResource(); resource.setName("Test resource"); resource.setScopes(Lists.newArrayList("view")); resource.setId(UUID.randomUUID().toString()); resource.setDn(umaResourceService.getDnForResource(resource.getId())); resource.setDeletable(false); final Calendar calendar = Calendar.getInstance(); resource.setCreationDate(calendar.getTime()); umaResourceService.addResource(resource); // 2. resource exists assertNotNull(umaResourceService.getResourceById(resource.getId())); // 4. resource exists assertNotNull(umaResourceService.getResourceById(resource.getId())); calendar.add(Calendar.MINUTE, -10); resource.setExpirationDate(calendar.getTime()); resource.setDeletable(true); umaResourceService.updateResource(resource, true); // resource exists assertNotNull(umaResourceService.getResourceById(resource.getId())); // remove it umaResourceService.remove(resource); }
Example #24
Source File: MyTestExecutor.java From AppiumTestDistribution with GNU General Public License v3.0 | 5 votes |
public boolean runMethodParallel() { TestNG testNG = new TestNG(); List<String> suites = Lists.newArrayList(); suites.add(getProperty("user.dir") + PARALLEL_XML_LOCATION); testNG.setTestSuites(suites); testNG.run(); return testNG.hasFailure(); }
Example #25
Source File: DefaultStaticTestData.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider static Object[][] testCasesAll() { List<Object[]> result = Lists.newArrayList(); result.addAll(Arrays.asList(testClasses())); result.addAll(Arrays.asList(testInterfaces())); return result.toArray(new Object[result.size()][]); }
Example #26
Source File: RemoteUserFederationProviderFactoryTest.java From keycloak-user-migration-provider with Apache License 2.0 | 5 votes |
@Test public void testGetConfigurationOptions() throws Exception { Set<String> options = factory.getConfigurationOptions(); assertNotNull(options); assertEquals(1, options.size()); assertEquals(RemoteUserFederationProviderFactory.PROP_USER_VALIDATION_URL, Lists.newArrayList(options).get(0)); }
Example #27
Source File: BlockAwareSegmentInputStreamTest.java From pulsar with Apache License 2.0 | 5 votes |
MockLedgerEntries(int ledgerId, int startEntryId, int count, int entrySize, Supplier<Byte> dataSupplier) { this.ledgerId = ledgerId; this.startEntryId = startEntryId; this.count = count; this.entrySize = entrySize; this.entries = Lists.newArrayList(count); IntStream.range(startEntryId, startEntryId + count).forEach(i -> entries.add(new MockLedgerEntry(ledgerId, i, entrySize, dataSupplier))); }
Example #28
Source File: ReplicatorTlsTest.java From pulsar with Apache License 2.0 | 5 votes |
@Test public void testReplicationClient() throws Exception { log.info("--- Starting ReplicatorTlsTest::testReplicationClient ---"); for (BrokerService ns : Lists.newArrayList(ns1, ns2, ns3)) { ns.getReplicationClients().forEach((cluster, client) -> { assertTrue(((PulsarClientImpl) client).getConfiguration().isUseTls()); assertEquals(((PulsarClientImpl) client).getConfiguration().getTlsTrustCertsFilePath(), TLS_SERVER_CERT_FILE_PATH); }); } }
Example #29
Source File: GroovyFunctionEvaluatorTest.java From incubator-pinot with Apache License 2.0 | 5 votes |
@DataProvider(name = "groovyFunctionEvaluationDataProvider") public Object[][] groovyFunctionEvaluationDataProvider() { List<Object[]> entries = new ArrayList<>(); GenericRow genericRow1 = new GenericRow(); genericRow1.putValue("userID", 101); entries.add(new Object[]{"Groovy({userID}, userID)", Lists.newArrayList("userID"), genericRow1, 101}); GenericRow genericRow2 = new GenericRow(); Map<String, Integer> map1 = new HashMap<>(); map1.put("def", 10); map1.put("xyz", 30); map1.put("abc", 40); genericRow2.putValue("map1", map1); entries.add(new Object[]{"Groovy({map1.sort()*.value}, map1)", Lists.newArrayList("map1"), genericRow2, Lists.newArrayList(40, 10, 30)}); GenericRow genericRow3 = new GenericRow(); genericRow3.putValue("campaigns", new Object[]{3, 2}); entries.add(new Object[]{"Groovy({campaigns.max{ it.toBigDecimal() }}, campaigns)", Lists.newArrayList("campaigns"), genericRow3, 3}); GenericRow genericRow4 = new GenericRow(); genericRow4.putValue("millis", "1584040201500"); entries.add(new Object[]{"Groovy({(long)(Long.parseLong(millis)/(1000*60*60))}, millis)", Lists.newArrayList("millis"), genericRow4, 440011L}); GenericRow genericRow5 = new GenericRow(); genericRow5.putValue("firstName", "John"); genericRow5.putValue("lastName", "Doe"); entries.add(new Object[]{"Groovy({firstName + ' ' + lastName}, firstName, lastName)", Lists.newArrayList("firstName", "lastName"), genericRow5, "John Doe"}); GenericRow genericRow6 = new GenericRow(); genericRow6.putValue("eventType", "IMPRESSION"); entries.add(new Object[]{"Groovy({eventType == 'IMPRESSION' ? 1: 0}, eventType)", Lists.newArrayList("eventType"), genericRow6, 1}); GenericRow genericRow7 = new GenericRow(); genericRow7.putValue("eventType", "CLICK"); entries.add(new Object[]{"Groovy({eventType == 'IMPRESSION' ? 1: 0}, eventType)", Lists.newArrayList("eventType"), genericRow7, 0}); return entries.toArray(new Object[entries.size()][]); }
Example #30
Source File: DefaultStaticTestData.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider static Object[][] testCasesAll() { List<Object[]> result = Lists.newArrayList(); result.addAll(Arrays.asList(testClasses())); result.addAll(Arrays.asList(testInterfaces())); return result.toArray(new Object[result.size()][]); }