Search in sources :

Example 26 with Description

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

the class ApplicationDeploymentTestCase method deploysAppWithInterceptorsAndNotExportedPackage.

@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");
}
Also used : 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 27 with Description

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

the class ExtensionsClientTestCase method executeOperationWithNullSafeParameter.

@Test
@Description("Executes an operation that has a @NullSafe annotated parameter using the client and checks the output")
public void executeOperationWithNullSafeParameter() throws Throwable {
    OperationParameters params = builder().configName("banana").build();
    Result<VeganPolicy, Object> result = doExecute(VEGAN, "applyPolicy", params);
    assertThat(result.getOutput().getMeetAllowed(), is(false));
    assertThat(result.getOutput().getIngredients().getSaltMiligrams(), is(0));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) VeganPolicy(org.mule.test.vegan.extension.VeganPolicy) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 28 with Description

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

the class ExtensionsClientTestCase method executeOperationThatReturnsAttributes.

@Test
@Description("Executes an operation that returns attributes metadata using the client and checks the output and the attributes")
public void executeOperationThatReturnsAttributes() throws Throwable {
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).build();
    Result<String, IntegerAttributes> result = doExecute(HEISENBERG_EXT_NAME, "getEnemy", params);
    assertThat(result.getOutput(), is("Gustavo Fring"));
    assertThat(result.getAttributes().isPresent(), is(true));
    assertThat(result.getAttributes().get().getValue(), is(0));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) IntegerAttributes(org.mule.test.heisenberg.extension.model.types.IntegerAttributes) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 29 with Description

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

the class ExtensionsClientTestCase method executeSimpleOperationWithExpression.

@Test
@Description("Executes a simple operation with an expression as parameter using the client and checks the output")
public void executeSimpleOperationWithExpression() throws Throwable {
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).addParameter("victim", "#[mel:'Juani']").addParameter("goodbyeMessage", "ADIOS").build();
    Result<String, Object> result = doExecute(HEISENBERG_EXT_NAME, "kill", params);
    assertThat(result.getOutput(), is("ADIOS, Juani"));
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 30 with Description

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

the class ExtensionsClientTestCase method executeFailureOperation.

@Test
@Description("Executes an operation that fails using the client and checks the throwed exception")
public void executeFailureOperation() throws Throwable {
    exception.expect(MuleException.class);
    exception.expectCause(instanceOf(ConnectionException.class));
    exception.expectMessage("You are not allowed to speak with gus.");
    OperationParameters params = builder().configName(HEISENBERG_CONFIG).build();
    doExecute(HEISENBERG_EXT_NAME, "callGusFring", params);
}
Also used : OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) ConnectionException(org.mule.runtime.api.connection.ConnectionException) Description(io.qameta.allure.Description) Test(org.junit.Test)

Aggregations

Description (io.qameta.allure.Description)123 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 Issue (io.qameta.allure.Issue)10 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 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)6 PropertyCommand (com.axibase.tsd.api.model.command.PropertyCommand)6 Property (com.axibase.tsd.api.model.property.Property)6 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