@Issue("596") @Test public void shouldParseErrorInfo() throws Exception { process( "trxdata/gh-596.trx", "sample.trx" ); final ArgumentCaptor<TestResult> captor = ArgumentCaptor.forClass(TestResult.class); verify(visitor, times(1)).visitTestResult(captor.capture()); assertThat(captor.getAllValues()) .extracting(TestResult::getStatusMessage, TestResult::getStatusTrace) .containsExactly(tuple("Some message", "Some trace")); }
public static Link createLink(final io.qameta.allure.Issue link) { return createIssueLink(link.value()); }
/** * Get {@link TmsLink} or {@link Issue} for a method. * If both are specified it will return jus the {@link TmsLink} value. * * @param method the method to check for test ID annotations. * @return Optional of the {@link TmsLink} or {@link Issue} value. */ public static Optional<String> getIssueOrTmsLinkValue(Method method) { TmsLink tcIdAnnotation = method.getAnnotation(TmsLink.class); Issue issueAnnotation = method.getAnnotation(Issue.class); if (nonNull(tcIdAnnotation)) { return Optional.of(tcIdAnnotation.value()); } else if (nonNull(issueAnnotation)) { return Optional.of(issueAnnotation.value()); } else { return Optional.empty(); } } }
@Issue("532") @Test public void shouldParseSuitesTag() throws Exception { process( "junitdata/testsuites.xml", "TEST-test.SampleTest.xml" ); final ArgumentCaptor<TestResult> captor = ArgumentCaptor.forClass(TestResult.class); verify(visitor, times(3)).visitTestResult(captor.capture()); assertThat(captor.getAllValues()) .extracting(TestResult::getName) .containsExactlyInAnyOrder( "should default path to an empty string", "should default consolidate to true", "should default useDotNotation to true" ); }
@Issue("749") @Test public void shouldParseClassNameAsSuite() throws Exception { process( "trxdata/gh-749.trx", "sample.trx" ); final ArgumentCaptor<TestResult> captor = ArgumentCaptor.forClass(TestResult.class); verify(visitor, times(1)).visitTestResult(captor.capture()); assertThat(captor.getAllValues()) .extracting(result -> result.findOneLabel(LabelName.SUITE)) .extracting(Optional::get) .containsOnly("TestClass"); }
@Issue("629") @Test public void shouldProcessEmptyLists() throws Exception { final Set<TestResult> results = process( "allure1/empty-lists.xml", generateTestSuiteXmlName() ).getResults(); assertThat(results) .hasSize(1); }
@Issue("531") @Test public void shouldProcessTestsInNestedPackages() throws Exception {
@Issue("587") @Issue("572") @Test public void shouldSortByStartTimeAsc() throws Exception { final TestResult first = new TestResult() .setName("first") .setTime(new Time().setStart(10L)); final TestResult second = new TestResult() .setName("second") .setTime(new Time().setStart(100L)); final TestResult third = new TestResult() .setName("third") .setTime(new Time().setStart(50L)); final TestResult timeless = new TestResult() .setName("timeless"); final LaunchResults results = new DefaultLaunchResults( new HashSet<>(Arrays.asList(first, second, third, timeless)), Collections.emptyMap(), Collections.emptyMap() ); final PackagesPlugin packagesPlugin = new PackagesPlugin(); final Tree<TestResult> tree = packagesPlugin.getData(singletonList(results)); assertThat(tree.getChildren()) .extracting("name") .containsExactly("timeless", "first", "third", "second"); } }
@Issue("587") @Issue("572") @Test public void shouldSortByStartTimeAsc() throws Exception { final TestResult first = new TestResult() .setName("first") .setTime(new Time().setStart(10L)); final TestResult second = new TestResult() .setName("second") .setTime(new Time().setStart(12L)); final TestResult timeless = new TestResult() .setName("timeless"); final Tree<TestResult> tree = SuitesPlugin.getData( createSingleLaunchResults(second, first, timeless) ); assertThat(tree.getChildren()) .extracting(TreeNode::getName) .containsExactly("timeless", "first", "second"); }
@Issue("587") @Issue("572") @Test public void shouldSortByStartTimeAsc() throws Exception { final Category category = new Category().setName("some"); final TestResult first = new TestResult() .setName("first") .setStatus(Status.FAILED) .setTime(new Time().setStart(10L)); first.addExtraBlock(CATEGORIES, singletonList(category)); final TestResult second = new TestResult() .setName("second") .setStatus(Status.FAILED) .setTime(new Time().setStart(12L)); second.addExtraBlock(CATEGORIES, singletonList(category)); final TestResult timeless = new TestResult() .setName("timeless") .setStatus(Status.FAILED); timeless.addExtraBlock(CATEGORIES, singletonList(category)); final Tree<TestResult> tree = CategoriesPlugin.getData( createSingleLaunchResults(second, first, timeless) ); assertThat(tree.getChildren()) .flatExtracting("children") .flatExtracting("children") .extracting("name") .containsExactly("timeless", "first", "second"); }
@Test @Ignore("MULE-7311") @Issue("MULE-7311") public void processesExpiredGroupInPrimaryNode() throws Exception { doExpiredGroupMonitoringTest(true); }
@Test @Issue("MULE-14289") @Ignore("MULE-14289: The discovered ArtifactConfigurationProcessor is not compatible with the provided mocks.") public void correctArtifactTypeForPolicies() throws InitialisationException {
@Test @Issue("MULE-13756") @Description("Tests that code called form application's Processor can access internal resources/packages of the application") public void deploysAppWithNotExportedPackage() throws Exception { ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app") .configuredWith(EXPORTED_PACKAGES, "org.bar1") .configuredWith(EXPORTED_RESOURCES, "test-resource.txt") .definedBy("app-with-loads-app-resource-plugin-config.xml") .containingClass(loadsAppResourceCallbackClassFile, "org/foo/LoadsAppResourceCallback.class") .containingClass(barUtils1ClassFile, "org/bar1/BarUtils.class") .containingClass(barUtils2ClassFile, "org/bar2/BarUtils.class") .containingResource("test-resource.txt", "test-resource.txt") .containingResource("test-resource.txt", "test-resource-not-exported.txt"); addPackedAppFromBuilder(nonExposingAppFileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId()); executeApplicationFlow("main"); }
@Test @Issue("MULE-13756") @Description("Tests that code called form plugin's Processor cannot access internal resources/packages of the application") public void deploysAppWithNotExportedPackageAndPlugin() throws Exception { ArtifactPluginFileBuilder loadsAppResourcePlugin = new ArtifactPluginFileBuilder("loadsAppResourcePlugin") .configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo") .containingClass(loadsAppResourceCallbackClassFile, "org/foo/LoadsAppResourceCallback.class"); ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app") .configuredWith(EXPORTED_PACKAGES, "org.bar1") .configuredWith(EXPORTED_RESOURCES, "test-resource.txt") .definedBy("app-with-loads-app-resource-plugin-config.xml") .containingClass(barUtils1ClassFile, "org/bar1/BarUtils.class") .containingClass(barUtils2ClassFile, "org/bar2/BarUtils.class") .containingResource("test-resource.txt", "test-resource.txt") .containingResource("test-resource.txt", "test-resource-not-exported.txt") .dependingOn(loadsAppResourcePlugin); addPackedAppFromBuilder(nonExposingAppFileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId()); executeApplicationFlow("main"); }
@Test @Issue("MULE-13756") @Description("Tests that code called form application's ProcessorInterceptor can access internal resources/packages of the application") public void deploysAppWithInterceptorsAndNotExportedPackage() throws Exception { File loadsOwnResourceInterceptorFactoryClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsOwnResourceInterceptorFactory.java")); File loadsOwnResourceInterceptorClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsOwnResourceInterceptor.java")); ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app") .configuredWith(EXPORTED_PACKAGES, "org.bar1") .configuredWith(EXPORTED_RESOURCES, "test-resource.txt") .definedBy("app-with-interceptor.xml") .containingClass(loadsOwnResourceInterceptorFactoryClassFile, "org/foo/LoadsOwnResourceInterceptorFactory.class") .containingClass(loadsOwnResourceInterceptorClassFile, "org/foo/LoadsOwnResourceInterceptor.class") .containingClass(barUtils1ClassFile, "org/bar1/BarUtils.class") .containingClass(barUtils2ClassFile, "org/bar2/BarUtils.class") .containingResource("test-resource.txt", "test-resource.txt") .containingResource("test-resource.txt", "test-resource-not-exported.txt"); addPackedAppFromBuilder(nonExposingAppFileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId()); executeApplicationFlow("main"); }
@Test @Issue("MULE-13756") @Description("Tests that code called form plugin's ProcessorInterceptor cannot access internal resources/packages of the application") public void deploysAppWithNotExportedPackageAndPluginWithInterceptors() throws Exception { File loadsAppResourceInterceptorFactoryClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsAppResourceInterceptorFactory.java")); File loadsAppResourceInterceptorClassFile = new SingleClassCompiler().compile(getResourceFile("/org/foo/LoadsAppResourceInterceptor.java")); ArtifactPluginFileBuilder loadsAppResourceInterceptorPlugin = new ArtifactPluginFileBuilder("loadsAppResourceInterceptorPlugin") .configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.lalala") .containingClass(loadsAppResourceInterceptorFactoryClassFile, "org/foo/LoadsAppResourceInterceptorFactory.class") .containingClass(loadsAppResourceInterceptorClassFile, "org/foo/LoadsAppResourceInterceptor.class") .containingResource("registry-bootstrap-loads-app-resource-pif.properties", "META-INF/org/mule/runtime/core/config/registry-bootstrap.properties"); ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app") .configuredWith(EXPORTED_PACKAGES, "org.bar1") .configuredWith(EXPORTED_RESOURCES, "test-resource.txt") .definedBy("app-with-plugin-bootstrap.xml") .containingClass(barUtils1ClassFile, "org/bar1/BarUtils.class") .containingClass(barUtils2ClassFile, "org/bar2/BarUtils.class") .containingResource("test-resource.txt", "test-resource.txt") .containingResource("test-resource.txt", "test-resource-not-exported.txt") .dependingOn(loadsAppResourceInterceptorPlugin); addPackedAppFromBuilder(nonExposingAppFileBuilder); startDeployment(); assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId()); executeApplicationFlow("main"); }
@Test @Issue("MULE-14289") @Ignore("MULE-14289: The discovered ArtifactConfigurationProcessor is not compatible with the provided mocks.") public void correctArtifactTypeForPolicies() throws InitialisationException {
@Test @Ignore("MULE-7311") @Issue("MULE-7311") public void processesExpiredGroupInPrimaryNode() throws Exception { doExpiredGroupMonitoringTest(true); }
@Ignore("MULE-6926") @Issue("MULE-6926") @Test public void testPartitionablePersistenceStore() throws ObjectStoreException, RegistrationException, InterruptedException { PartitionedPersistentObjectStore<String> partitionedStore = new PartitionedPersistentObjectStore<>(muleContext); partitionedStore.open(); getRegistry().registerObject(BASE_PERSISTENT_OBJECT_STORE_KEY, partitionedStore); ObjectStoreManager manager = getRegistry().lookupObject(OBJECT_STORE_MANAGER); ObjectStore<String> store = manager.createObjectStore("persistencePart2", unmanagedPersistent()); assertTrue(store instanceof ObjectStorePartition); ObjectStore<String> baseStore = ((ObjectStorePartition<String>) store).getBaseStore(); assertTrue(baseStore instanceof PartitionedPersistentObjectStore); assertSame(baseStore, getRegistry().lookupObject(BASE_PERSISTENT_OBJECT_STORE_KEY)); testObjectStore(store); testObjectStoreExpiry(manager, "persistenceExpPart2", ObjectStoreSettings.builder() .persistent(true) .entryTtl(1000L) .expirationInterval(200L) .build()); testObjectStoreMaxEntries(manager, "persistenceMaxPart2", ObjectStoreSettings.builder() .persistent(true) .maxEntries(10) .entryTtl(10000L) .expirationInterval(200L) .build()); }
@Test @Ignore("MULE-12338") @Issue("MULE-12338") public void truncateTable() throws Exception { flowRunner("truncateTable").run(); List<Map<String, String>> result = selectData("select * from PLANET", getDefaultDataSource()); assertThat(result.isEmpty(), is(true)); }