Search in sources :

Example 1 with ClearSystemProperty

use of org.junitpioneer.jupiter.ClearSystemProperty in project ekam by testvagrant.

the class DataSetsNegativeTests method shouldThrowException.

@Test
@ClearSystemProperty(key = "datasets.env")
@SetSystemProperty(key = "datasets.dir", value = "blahblahblah")
public void shouldThrowException() {
    ListDataClient dataClient = new ListDataClient();
    Exception exception = assertThrows(RuntimeException.class, () -> dataClient.getList("package_managers"));
    String exceptionMessage = exception.getMessage();
    Assertions.assertTrue(exceptionMessage.contains("'package_managers' key not found in data_sets") && exceptionMessage.contains(String.format("Files searched under directory: '%s/%s'", ResourcePaths.TEST_RESOURCES, "blahblahblah")));
}
Also used : ListDataClient(com.testvagrant.ekam.dataclients.ListDataClient) SetSystemProperty(org.junitpioneer.jupiter.SetSystemProperty) Test(org.junit.jupiter.api.Test) ClearSystemProperty(org.junitpioneer.jupiter.ClearSystemProperty)

Example 2 with ClearSystemProperty

use of org.junitpioneer.jupiter.ClearSystemProperty in project geode-benchmarks by apache.

the class ClientServerTopologyWithSniProxyTest method configWithNoSsl.

@ParameterizedTest
@EnumSource(SniProxyImplementation.class)
@ClearSystemProperty(key = WITH_SNI_PROXY_PROPERTY)
public void configWithNoSsl(final SniProxyImplementation sniProxyImplementation) {
    System.setProperty(WITH_SNI_PROXY_PROPERTY, sniProxyImplementation.name());
    final TestConfig testConfig = new TestConfig();
    ClientServerTopologyWithSniProxy.configure(testConfig);
    assertThat(testConfig.getJvmArgs().get(CLIENT.name())).contains("-DwithSsl=true");
}
Also used : TestConfig(org.apache.geode.perftest.TestConfig) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ClearSystemProperty(org.junitpioneer.jupiter.ClearSystemProperty)

Example 3 with ClearSystemProperty

use of org.junitpioneer.jupiter.ClearSystemProperty in project kogito-runtimes by kiegroup.

the class QuarkusTopicDiscoveryTest method verifyTopicsWithPropertiesAndChannels.

@Test
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.connector")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.topic")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.connector")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.topic")
void verifyTopicsWithPropertiesAndChannels() {
    final TopicDiscovery discovery = new QuarkusTopicDiscovery();
    final List<Topic> topics = discovery.getTopics(Collections.emptyList());
    assertThat(topics).isEmpty();
}
Also used : TopicDiscovery(org.kie.kogito.event.TopicDiscovery) AbstractTopicDiscovery(org.kie.kogito.addon.cloudevents.AbstractTopicDiscovery) Topic(org.kie.kogito.event.Topic) Test(org.junit.jupiter.api.Test) ClearSystemProperty(org.junitpioneer.jupiter.ClearSystemProperty)

Example 4 with ClearSystemProperty

use of org.junitpioneer.jupiter.ClearSystemProperty in project kogito-runtimes by kiegroup.

the class QuarkusTopicDiscoveryTest method verifyTopicsWithNoPropertiesSet.

@Test
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.connector")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url")
@ClearSystemProperty(key = "mp.messaging.outgoing.processedtravellers.topic")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.connector")
@ClearSystemProperty(key = "mp.messaging.incoming.kogito_incoming_stream.topic")
void verifyTopicsWithNoPropertiesSet() {
    final List<Topic> expectedTopics = new ArrayList<>();
    expectedTopics.add(AbstractTopicDiscovery.DEFAULT_OUTGOING_CHANNEL);
    expectedTopics.add(AbstractTopicDiscovery.DEFAULT_INCOMING_CHANNEL);
    final List<CloudEventMeta> eventsMeta = new ArrayList<>();
    eventsMeta.add(new CloudEventMeta("event1", "", EventKind.CONSUMED));
    eventsMeta.add(new CloudEventMeta("event2", "", EventKind.PRODUCED));
    final TopicDiscovery discovery = new QuarkusTopicDiscovery();
    final List<Topic> topics = discovery.getTopics(eventsMeta);
    assertThat(topics).hasSize(2);
    expectedTopics.forEach(e -> assertThat(topics.stream().anyMatch(t -> t.getName().equals(e.getName()) && t.getType() == e.getType())).isTrue());
}
Also used : Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) TopicDiscovery(org.kie.kogito.event.TopicDiscovery) SetSystemProperty(org.junitpioneer.jupiter.SetSystemProperty) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test) List(java.util.List) EventKind(org.kie.kogito.event.EventKind) CloudEventMeta(org.kie.kogito.event.cloudevents.CloudEventMeta) ChannelType(org.kie.kogito.event.ChannelType) Topic(org.kie.kogito.event.Topic) AbstractTopicDiscovery(org.kie.kogito.addon.cloudevents.AbstractTopicDiscovery) ClearSystemProperty(org.junitpioneer.jupiter.ClearSystemProperty) Collections(java.util.Collections) CloudEventMeta(org.kie.kogito.event.cloudevents.CloudEventMeta) ArrayList(java.util.ArrayList) TopicDiscovery(org.kie.kogito.event.TopicDiscovery) AbstractTopicDiscovery(org.kie.kogito.addon.cloudevents.AbstractTopicDiscovery) Topic(org.kie.kogito.event.Topic) Test(org.junit.jupiter.api.Test) ClearSystemProperty(org.junitpioneer.jupiter.ClearSystemProperty)

Aggregations

ClearSystemProperty (org.junitpioneer.jupiter.ClearSystemProperty)4 Test (org.junit.jupiter.api.Test)3 SetSystemProperty (org.junitpioneer.jupiter.SetSystemProperty)2 AbstractTopicDiscovery (org.kie.kogito.addon.cloudevents.AbstractTopicDiscovery)2 Topic (org.kie.kogito.event.Topic)2 TopicDiscovery (org.kie.kogito.event.TopicDiscovery)2 ListDataClient (com.testvagrant.ekam.dataclients.ListDataClient)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 TestConfig (org.apache.geode.perftest.TestConfig)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1 ChannelType (org.kie.kogito.event.ChannelType)1 EventKind (org.kie.kogito.event.EventKind)1 CloudEventMeta (org.kie.kogito.event.cloudevents.CloudEventMeta)1