SLIDER-436 added accumulo-funtest profile to accumulo app package and made it configurable to run against a specified zip file
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/8b029ee4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/8b029ee4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/8b029ee4 Branch: refs/heads/feature/SLIDER-149_Support_a_YARN_service_registry Commit: 8b029ee4ee6fade3730de7a6cde2a16b15f0492c Parents: 7661f48 Author: Billie Rinaldi <billie.rina...@gmail.com> Authored: Thu Sep 18 07:55:24 2014 -0700 Committer: Billie Rinaldi <billie.rina...@gmail.com> Committed: Thu Sep 18 07:55:24 2014 -0700 ---------------------------------------------------------------------- app-packages/accumulo/pom.xml | 48 ++++++-------------- .../apache/slider/accumulo/ProviderUtil.java | 25 +--------- .../funtest/accumulo/AccumuloBasicIT.groovy | 10 +++- .../accumulo/AccumuloMonitorSSLIT.groovy | 8 ++-- .../funtest/accumulo/AccumuloSSLTestBase.groovy | 6 +-- .../framework/AgentCommandTestBase.groovy | 12 ++++- 6 files changed, 41 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8b029ee4/app-packages/accumulo/pom.xml ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/pom.xml b/app-packages/accumulo/pom.xml index fb6a5a4..07cc3c9 100644 --- a/app-packages/accumulo/pom.xml +++ b/app-packages/accumulo/pom.xml @@ -35,6 +35,9 @@ <pkg.version>${project.version}</pkg.version> <pkg.name>accumulo-${accumulo.version}-bin.tar.gz</pkg.name> <!-- the following properties are used for testing --> + <slider.bin.dir>../../slider-assembly/target/slider-${project.version}-all/slider-${project.version}</slider.bin.dir> + <test.app.pkg.dir>${project.build.directory}</test.app.pkg.dir> + <test.app.resources.dir>${project.build.directory}/test-config</test.app.resources.dir> <app.user>yarn</app.user> <app.user.group>hadoop</app.user.group> <accumulo.keytab></accumulo.keytab> @@ -84,34 +87,6 @@ </execution> </executions> </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>${maven-failsafe-plugin.version}</version> - <executions> - <execution> - <id>run-integration-tests</id> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack> - <java.awt.headless>true</java.awt.headless> - <!-- this property must be supplied--> - <slider.conf.dir>${slider.conf.dir}</slider.conf.dir> - <slider.bin.dir>../../slider-assembly/target/slider-${project.version}-all/slider-${project.version}</slider.bin.dir> - <test.app.pkg.dir>target</test.app.pkg.dir> - <test.app.pkg.file>${app.package.name}.zip</test.app.pkg.file> - <test.app.resource>target/test-config/resources.json</test.app.resource> - <test.app.template>target/test-config/appConfig.json</test.app.template> - </systemPropertyVariables> - </configuration> - </plugin> </plugins> </build> </profile> @@ -185,7 +160,13 @@ </execution> </executions> </plugin> - + </plugins> + </build> + </profile> + <profile> + <id>accumulo-funtest</id> + <build> + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> @@ -205,11 +186,10 @@ <java.awt.headless>true</java.awt.headless> <!-- this property must be supplied--> <slider.conf.dir>${slider.conf.dir}</slider.conf.dir> - <slider.bin.dir>../../slider-assembly/target/slider-${project.version}-all/slider-${project.version}</slider.bin.dir> - <test.app.pkg.dir>target</test.app.pkg.dir> + <slider.bin.dir>${slider.bin.dir}</slider.bin.dir> + <test.app.pkg.dir>${test.app.pkg.dir}</test.app.pkg.dir> <test.app.pkg.file>${app.package.name}.zip</test.app.pkg.file> - <test.app.resource>target/test-config/resources.json</test.app.resource> - <test.app.template>target/test-config/appConfig.json</test.app.template> + <test.app.resources.dir>${test.app.resources.dir}</test.app.resources.dir> </systemPropertyVariables> </configuration> </plugin> @@ -224,7 +204,7 @@ <resource> <directory>src/test/resources</directory> <filtering>true</filtering> - <targetPath>${project.build.directory}/test-config</targetPath> + <targetPath>${test.app.resources.dir}</targetPath> </resource> </resources> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8b029ee4/app-packages/accumulo/src/main/java/org/apache/slider/accumulo/ProviderUtil.java ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/main/java/org/apache/slider/accumulo/ProviderUtil.java b/app-packages/accumulo/src/main/java/org/apache/slider/accumulo/ProviderUtil.java index 8be79fb..ee5a781 100644 --- a/app-packages/accumulo/src/main/java/org/apache/slider/accumulo/ProviderUtil.java +++ b/app-packages/accumulo/src/main/java/org/apache/slider/accumulo/ProviderUtil.java @@ -26,32 +26,11 @@ import java.io.IOException; import java.util.List; public class ProviderUtil { - public static CredentialProvider getProvider(String credentialProvider) + public static char[] getPassword(String credentialProvider, String alias) throws IOException { Configuration conf = new Configuration(); conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, credentialProvider); - List<CredentialProvider> providers = - CredentialProviderFactory.getProviders(conf); - - if (providers == null || providers.size() != 1) { - throw new IOException("Found unexpected number of providers"); - } - return providers.get(0); - } - - public static char[] getPassword(String credentialProvider, String alias) - throws IOException { - return getPassword(getProvider(credentialProvider), alias); - } - - public static char[] getPassword(CredentialProvider provider, String alias) - throws IOException { - CredentialEntry entry = provider.getCredentialEntry(alias); - if (entry != null) { - return entry.getCredential(); - } - throw new IOException("Can't get key " + alias + " from " + - provider.toString()); + return conf.getPassword(alias); } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8b029ee4/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy index 81f7b58..eb260ad 100644 --- a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy +++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy @@ -47,9 +47,15 @@ class AccumuloBasicIT extends AccumuloAgentCommandTestBase { protected static final String TRUST_PASS = "trustpass" protected ConfTree tree - AccumuloBasicIT() { + protected String getAppResource() { + return sysprop("test.app.resources.dir") + "/resources.json" + } + + protected String getAppTemplate() { if (SliderUtils.isHadoopClusterSecure(SLIDER_CONFIG)) { - APP_TEMPLATE = "target/test-config/appConfig_kerberos.json" + return sysprop("test.app.resources.dir") + "/appConfig_kerberos.json" + } else { + return sysprop("test.app.resources.dir") + "/appConfig.json" } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8b029ee4/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy index 3cabfd7..3964907 100644 --- a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy +++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy @@ -32,11 +32,11 @@ import java.security.cert.X509Certificate @Slf4j class AccumuloMonitorSSLIT extends AccumuloSSLTestBase { - AccumuloMonitorSSLIT() { - if (SliderUtils.isHadoopClusterSecure(SLIDER_CONFIG)) { - APP_TEMPLATE = "target/test-config/appConfig_monitor_ssl_kerberos.json" + protected String getAppTemplate() { + if (SliderUtils.isHadoopClusterSecure(SLIDER_CONFIG)) { + return sysprop("test.app.resources.dir") + "/appConfig_monitor_ssl_kerberos.json" } else { - APP_TEMPLATE = "target/test-config/appConfig_monitor_ssl.json" + return sysprop("test.app.resources.dir") + "/appConfig_monitor_ssl.json" } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8b029ee4/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy ---------------------------------------------------------------------- diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy index eca7da3..fa1bab2 100644 --- a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy +++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloSSLTestBase.groovy @@ -30,11 +30,11 @@ class AccumuloSSLTestBase extends AccumuloBasicIT { File trustStoreFile = new File(TEST_APP_PKG_DIR, "truststore.jks") File clientKeyStoreFile = new File(TEST_APP_PKG_DIR, "keystore.jks") - AccumuloSSLTestBase() { + protected String getAppTemplate() { if (SliderUtils.isHadoopClusterSecure(SLIDER_CONFIG)) { - APP_TEMPLATE = "target/test-config/appConfig_ssl_kerberos.json" + return sysprop("test.app.resources.dir") + "/appConfig_ssl_kerberos.json" } else { - APP_TEMPLATE = "target/test-config/appConfig_ssl.json" + return sysprop("test.app.resources.dir") + "/appConfig_ssl.json" } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/8b029ee4/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy index 81d1595..b565cd1 100644 --- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy +++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy @@ -41,8 +41,8 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions { private static String TEST_APP_TEMPLATE = "test.app.template" - protected String APP_RESOURCE = sysprop(TEST_APP_RESOURCE) - protected String APP_TEMPLATE = sysprop(TEST_APP_TEMPLATE) + protected String APP_RESOURCE = getAppResource() + protected String APP_TEMPLATE = getAppTemplate() public static final String TEST_APP_PKG_DIR = sysprop(TEST_APP_PKG_DIR_PROP) public static final String TEST_APP_PKG_FILE = sysprop(TEST_APP_PKG_FILE_PROP) @@ -57,6 +57,14 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions { AGENTTESTS_ENABLED = SLIDER_CONFIG.getBoolean(KEY_TEST_AGENT_ENABLED, false) } + protected String getAppResource() { + return sysprop(TEST_APP_RESOURCE) + } + + protected String getAppTemplate() { + return sysprop(TEST_APP_TEMPLATE) + } + @Rule public TemporaryFolder folder = new TemporaryFolder();