diff options
Diffstat (limited to 'infra/minimal-distribution/src/test')
-rw-r--r-- | infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java | 25 | ||||
-rw-r--r-- | infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProviderTest.java (renamed from infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/ActiveModuleProviderTest.java) | 12 | ||||
-rw-r--r-- | infra/minimal-distribution/src/test/resources/activation.json | 3 | ||||
-rw-r--r-- | infra/minimal-distribution/src/test/resources/base-distro-test-modules/base-modules | 9 |
4 files changed, 19 insertions, 30 deletions
diff --git a/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java b/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java index d8e06042a..e39dba8a0 100644 --- a/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java +++ b/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java @@ -16,34 +16,22 @@ package io.fd.honeycomb.infra.distro; -import static com.google.common.collect.ImmutableSet.of; import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import com.google.common.base.Charsets; import com.google.common.io.ByteStreams; -import com.google.inject.Module; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSubsystem; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; -import io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule; -import io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule; -import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule; -import io.fd.honeycomb.infra.distro.initializer.InitializerPipelineModule; -import io.fd.honeycomb.infra.distro.netconf.NetconfModule; -import io.fd.honeycomb.infra.distro.netconf.NetconfReadersModule; -import io.fd.honeycomb.infra.distro.restconf.RestconfModule; -import io.fd.honeycomb.infra.distro.schema.SchemaModule; -import io.fd.honeycomb.infra.distro.schema.YangBindingProviderModule; import java.io.IOException; import java.io.InputStream; import java.net.Socket; import java.util.Properties; -import java.util.Set; import javax.net.ssl.SSLContext; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; @@ -69,17 +57,6 @@ public class BaseMinimalDistributionTest { private static final String NETCONF_NAMESPACE = "urn:ietf:params:xml:ns:netconf:base:1.0"; private static final int HELLO_WAIT = 2500; - public static final Set<Module> BASE_MODULES = of( - new YangBindingProviderModule(), - new SchemaModule(), - new ConfigAndOperationalPipelineModule(), - new ContextPipelineModule(), - new InitializerPipelineModule(), - new NetconfModule(), - new NetconfReadersModule(), - new RestconfModule(), - new CfgAttrsModule()); - @Before public void setUp() throws Exception { SSLContext sslcontext = SSLContexts.custom() @@ -99,7 +76,7 @@ public class BaseMinimalDistributionTest { */ @Test(timeout = 120000) public void test() throws Exception { - Main.init(BASE_MODULES); + Main.init(); LOG.info("Testing Honeycomb base distribution"); LOG.info("Testing NETCONF TCP"); diff --git a/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/ActiveModuleProviderTest.java b/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProviderTest.java index bdadc5bd8..fd2c6c860 100644 --- a/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/ActiveModuleProviderTest.java +++ b/infra/minimal-distribution/src/test/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Cisco and/or its affiliates. + * Copyright (c) 2017 Cisco and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.honeycomb.infra.distro; +package io.fd.honeycomb.infra.distro.activation; import static com.google.common.collect.ImmutableList.of; @@ -36,7 +36,7 @@ public class ActiveModuleProviderTest { @Test public void testLoadActiveModulesSuccessfull() { - final ImmutableList rawResources = of( + final ImmutableList<String> rawResources = of( "// this should be skipped", "// io.fd.honeycomb.infra.distro.Modules$ChildModule1", " io.fd.honeycomb.infra.distro.Modules$ChildModule2", @@ -44,8 +44,8 @@ public class ActiveModuleProviderTest { "io.fd.honeycomb.infra.distro.Modules$ChildModule3", "io.fd.honeycomb.infra.distro.Modules$NonModule" ); - - final Set<Module> activeModules = ActiveModuleProvider.loadActiveModules(rawResources); + // have to be without wildcard, otherwise mockito has problem with it + final Set<Module> activeModules = (Set<Module>) new ActiveModules(ActiveModuleProvider.loadActiveModules(rawResources)).createModuleInstances(); // first and second line should be ignored due to comment // second,third,and fourth are valid,but should reduce module count to 2,because of duplicity @@ -73,7 +73,7 @@ public class ActiveModuleProviderTest { @Test public void testAggregateResourcesNonEmpty() { final List<String> aggregatedResources = - ActiveModuleProvider.aggregateResources("./modules", this.getClass().getClassLoader()); + ActiveModuleProvider.aggregateResources("modules", this.getClass().getClassLoader()); assertThat(aggregatedResources, hasSize(5)); assertThat(aggregatedResources, hasItems(" Non-commented non-trimmed", "//Commented", diff --git a/infra/minimal-distribution/src/test/resources/activation.json b/infra/minimal-distribution/src/test/resources/activation.json new file mode 100644 index 000000000..7e2015123 --- /dev/null +++ b/infra/minimal-distribution/src/test/resources/activation.json @@ -0,0 +1,3 @@ +{ + "modules-resource-path": "base-distro-test-modules" +}
\ No newline at end of file diff --git a/infra/minimal-distribution/src/test/resources/base-distro-test-modules/base-modules b/infra/minimal-distribution/src/test/resources/base-distro-test-modules/base-modules new file mode 100644 index 000000000..28b28446c --- /dev/null +++ b/infra/minimal-distribution/src/test/resources/base-distro-test-modules/base-modules @@ -0,0 +1,9 @@ +io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule +io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule +io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule +io.fd.honeycomb.infra.distro.initializer.InitializerPipelineModule +io.fd.honeycomb.infra.distro.netconf.NetconfModule +io.fd.honeycomb.infra.distro.netconf.NetconfReadersModule +io.fd.honeycomb.infra.distro.restconf.RestconfModule +io.fd.honeycomb.infra.distro.schema.SchemaModule +io.fd.honeycomb.infra.distro.schema.YangBindingProviderModule
\ No newline at end of file |