Search in sources :

Example 56 with Description

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

the class BytesStreamingExtensionTestCase method rewind.

@Test
@Description("Rewing a stream and consume it twice")
public void rewind() throws Exception {
    CoreEvent result = flowRunner("rewind").withPayload(data).run();
    Message firstRead = (Message) result.getVariables().get("firstRead").getValue();
    Message secondRead = (Message) result.getVariables().get("secondRead").getValue();
    assertThat(firstRead.getPayload().getValue(), equalTo(data));
    assertThat(secondRead.getPayload().getValue(), equalTo(data));
}
Also used : Message(org.mule.runtime.api.message.Message) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 57 with Description

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

the class ObjectStreamingExtensionTestCase method getObjectStreamWithTargetValue.

@Test
@Description("Stores an object stream in a variable leaving without modifying the original payload")
public void getObjectStreamWithTargetValue() throws Exception {
    CoreEvent event = flowRunner("getStreamWithTargetValue").withPayload(data).run();
    assertThat(event.getVariables().get(MY_STREAM_VAR).getValue(), is(instanceOf(String.class)));
    assertThat(event.getVariables().get(MY_STREAM_VAR).getValue(), equalTo(data.get(0)));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 58 with Description

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

the class MavenConfigTestCase method loadFromFileWithAdditionalRepoFromSystemProperty.

@Description("Loads the configuration from mule-config.json and adds an additional maven repository using system properties")
@Test
public void loadFromFileWithAdditionalRepoFromSystemProperty() throws Exception {
    String additionalRepositoryUrl = "http://localhost/host";
    testWithSystemProperty("muleRuntimeConfig.maven.repositories.customRepo.url", additionalRepositoryUrl, () -> {
        GlobalConfigLoader.reset();
        MavenConfiguration mavenConfig = getMavenConfig();
        List<RemoteRepository> mavenRemoteRepositories = mavenConfig.getMavenRemoteRepositories();
        assertThat(mavenRemoteRepositories, hasSize(2));
        assertThat(mavenRemoteRepositories.get(0).getId(), is("customRepo"));
        assertThat(mavenRemoteRepositories.get(0).getUrl(), is(new URL(additionalRepositoryUrl)));
        assertThat(mavenRemoteRepositories.get(1).getId(), is("mavenCentral"));
        assertThat(mavenRemoteRepositories.get(1).getUrl(), is(new URL(MAVEN_CENTRAL_URL)));
    });
}
Also used : MavenConfiguration(org.mule.maven.client.api.model.MavenConfiguration) RemoteRepository(org.mule.maven.client.api.model.RemoteRepository) URL(java.net.URL) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 59 with Description

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

the class MavenConfigTestCase method loadFromFileOnly.

@Description("Test a single file loaded from the classpath and verifies that the mule.conf and mule.properties json are not taken into account.")
@Test
public void loadFromFileOnly() throws MalformedURLException {
    GlobalConfigLoader.reset();
    MavenConfiguration mavenConfig = getMavenConfig();
    List<RemoteRepository> remoteRepositories = mavenConfig.getMavenRemoteRepositories();
    assertThat(remoteRepositories, hasSize(1));
    RemoteRepository remoteRepository = remoteRepositories.get(0);
    assertThat(remoteRepository.getId(), is(MAVEN_CENTRAL_REPO_ID));
    assertThat(remoteRepository.getUrl(), is(new URL(MAVEN_CENTRAL_URL)));
    assertThat(remoteRepository.getAuthentication().get().getPassword(), is("password"));
    assertThat(remoteRepository.getAuthentication().get().getUsername(), is("username"));
}
Also used : MavenConfiguration(org.mule.maven.client.api.model.MavenConfiguration) RemoteRepository(org.mule.maven.client.api.model.RemoteRepository) URL(java.net.URL) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 60 with Description

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

the class YamlConfigurationPropertiesComponentTestCase method complexListOfObjectsNotSuported.

@Description("Validates that a list of complex objects is not valid")
@Test
public void complexListOfObjectsNotSuported() throws InitialisationException {
    configurationComponent = new DefaultConfigurationPropertiesProvider("complex-list-object.yaml", externalResourceProvider);
    expectedException.expectMessage("Configuration properties does not support type a list of complex types. Complex type keys are: complex");
    expectedException.expect(ConfigurationPropertiesException.class);
    configurationComponent.initialise();
}
Also used : DefaultConfigurationPropertiesProvider(org.mule.runtime.config.api.dsl.model.properties.DefaultConfigurationPropertiesProvider) 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