Search in sources :

Example 91 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysAppWithNotExportedPackage.

@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");
}
Also used : ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) Issue(io.qameta.allure.Issue) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 92 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class ApplicationDeploymentTestCase method deploysAppWithNotExportedPackageAndPluginWithInterceptors.

@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");
}
Also used : ArtifactPluginFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ArtifactPluginFileBuilder) ApplicationFileBuilder(org.mule.runtime.module.deployment.impl.internal.builder.ApplicationFileBuilder) FileUtils.writeStringToFile(org.apache.commons.io.FileUtils.writeStringToFile) File(java.io.File) FileUtils.copyFile(org.apache.commons.io.FileUtils.copyFile) SingleClassCompiler(org.mule.tck.util.CompilerUtils.SingleClassCompiler) Issue(io.qameta.allure.Issue) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 93 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class BytesStreamingExtensionTestCase method streamingStrategyParameterInSource.

@Test
@Description("Streaming source has a streaming strategy parameter")
public void streamingStrategyParameterInSource() throws Exception {
    ParameterModel streamingParameter = getStreamingStrategyParameterModel(() -> getConfigurationModel().getSourceModel("bytes-caster").get());
    assertStreamingStrategyParameter(streamingParameter);
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 94 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class BytesStreamingExtensionTestCase method streamingStrategyParameterInOperation.

@Test
@Description("Streaming operation has a streaming strategy parameter")
public void streamingStrategyParameterInOperation() throws Exception {
    ParameterModel streamingParameter = getStreamingStrategyParameterModel(() -> getConfigurationModel().getOperationModel("toStream").get());
    assertStreamingStrategyParameter(streamingParameter);
}
Also used : ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 95 with Description

use of io.qameta.allure.Description in project mule by mulesoft.

the class BytesStreamingExtensionTestCase method streamProviderSerialization.

@Test
@Description("A stream provider is serialized as a byte[]")
public void streamProviderSerialization() throws Exception {
    CursorStreamProvider provider = (CursorStreamProvider) flowRunner("toStream").keepStreamsOpen().withPayload(data).run().getMessage().getPayload().getValue();
    byte[] bytes = muleContext.getObjectSerializer().getInternalProtocol().serialize(provider);
    bytes = muleContext.getObjectSerializer().getInternalProtocol().deserialize(bytes);
    assertThat(new String(bytes, Charset.defaultCharset()), equalTo(data));
}
Also used : CursorStreamProvider(org.mule.runtime.api.streaming.bytes.CursorStreamProvider) Description(io.qameta.allure.Description) Test(org.junit.Test)

Aggregations

Description (io.qameta.allure.Description)117 Test (org.junit.Test)111 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)41 Matchers.containsString (org.hamcrest.Matchers.containsString)15 Message (org.mule.runtime.api.message.Message)13 TypedValue (org.mule.runtime.api.metadata.TypedValue)13 RoutingPair (org.mule.runtime.core.internal.routing.ForkJoinStrategy.RoutingPair)12 MessageProcessorChain (org.mule.runtime.core.privileged.processor.chain.MessageProcessorChain)12 OperationParameters (org.mule.runtime.extension.api.client.OperationParameters)12 Matchers.anyString (org.mockito.Matchers.anyString)8 List (java.util.List)7 MavenConfiguration (org.mule.maven.client.api.model.MavenConfiguration)7 Processor (org.mule.runtime.core.api.processor.Processor)7 RemoteRepository (org.mule.maven.client.api.model.RemoteRepository)6 Event (org.mule.runtime.api.event.Event)6 ReactiveProcessor (org.mule.runtime.core.api.processor.ReactiveProcessor)6 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)6 InternalProcessor (org.mule.runtime.core.privileged.processor.InternalProcessor)6 SmallTest (org.mule.tck.size.SmallTest)6 TestTransaction (org.mule.tck.testmodels.mule.TestTransaction)6