You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/07/11 06:17:49 UTC
[09/50] [abbrv] git commit: SLIDER-178 created basic functional tests
for accumulo app package
SLIDER-178 created basic functional tests for accumulo app package
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/f94e1039
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/f94e1039
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/f94e1039
Branch: refs/heads/master
Commit: f94e10393eb76888ad2b40dae838cfa8cfb308f2
Parents: 7823d3a
Author: Billie Rinaldi <bi...@gmail.com>
Authored: Wed Jul 2 14:16:39 2014 -0700
Committer: Billie Rinaldi <bi...@gmail.com>
Committed: Wed Jul 2 14:16:39 2014 -0700
----------------------------------------------------------------------
app-packages/accumulo/appConfig.json | 4 +-
app-packages/accumulo/pom.xml | 107 ++++++++-
app-packages/accumulo/resources.json | 15 +-
app-packages/accumulo/src/assembly/accumulo.xml | 1 +
.../AccumuloAgentCommandTestBase.groovy | 52 ++++
.../funtest/accumulo/AccumuloBasicIT.groovy | 117 +++++++++
.../accumulo/AccumuloMonitorSSLIT.groovy | 73 ++++++
.../funtest/accumulo/AccumuloReadWriteIT.groovy | 116 +++++++++
.../StubToForceGroovyTestsToCompile.java | 22 ++
.../test/resources/appConfig_monitor_ssl.json | 62 +++++
.../accumulo/src/test/resources/resources.json | 36 +++
.../slider/test/YarnMiniClusterTestBase.groovy | 2 +-
slider-funtest/pom.xml | 5 +-
.../framework/AgentCommandTestBase.groovy | 237 +++++++++++++++++++
.../accumulo/StubToForceGroovySrcToCompile.java | 22 ++
.../lifecycle/AgentCommandTestBase.groovy | 233 ------------------
.../lifecycle/TestAgentClusterLifecycle.groovy | 1 +
.../funtest/lifecycle/TestAgentFailures.groovy | 1 +
.../funtest/lifecycle/TestAgentFailures2.groovy | 1 +
.../lifecycle/TestAppsThroughAgent.groovy | 1 +
.../lifecycle/TestClusterBuildDestroy.groovy | 1 +
.../accumulo/AccumuloProviderService.java | 4 +
22 files changed, 870 insertions(+), 243 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/appConfig.json
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/appConfig.json b/app-packages/accumulo/appConfig.json
index b8d80d1..6a22336 100644
--- a/app-packages/accumulo/appConfig.json
+++ b/app-packages/accumulo/appConfig.json
@@ -3,8 +3,8 @@
"metadata": {
},
"global": {
- "agent.conf": "/slider/agent/conf/agent.ini",
- "application.def": "/slider/${app.package.name}.zip",
+ "agent.conf": "agent.ini",
+ "application.def": "${app.package.name}.zip",
"config_types": "accumulo-site",
"java_home": "/usr/jdk64/jdk1.7.0_45",
"package_list": "files/accumulo-${accumulo.version}-bin.tar.gz",
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/pom.xml
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/pom.xml b/app-packages/accumulo/pom.xml
index 9a474e3..d23933b 100644
--- a/app-packages/accumulo/pom.xml
+++ b/app-packages/accumulo/pom.xml
@@ -24,9 +24,10 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>slider-accumulo-app-package</artifactId>
- <packaging>pom</packaging>
+ <packaging>jar</packaging>
<name>Slider Accumulo App Package</name>
<description>Slider Accumulo App Package</description>
+
<properties>
<work.dir>package-tmp</work.dir>
<app.package.name>apache-slider-accumulo-${accumulo.version}-app-package-${project.version}</app.package.name>
@@ -70,16 +71,90 @@
<configuration>
<includeArtifactIds>accumulo</includeArtifactIds>
<includeTypes>tar.gz</includeTypes>
+ <excludeTransitive>true</excludeTransitive>
<outputDirectory>${project.build.directory}/${work.dir}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <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/${app.package.name}/appConfig.json</test.app.template>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
</profiles>
+ <build>
+ <!-- resources are filtered for dynamic updates. This gets build info in-->
+ <resources>
+ <resource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ <targetPath>${project.build.directory}/test-config</targetPath>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ <!-- set verbose to be true if you want lots of uninteresting messages -->
+ <!-- <verbose>true</verbose> -->
+ <source>${project.java.src.version}</source>
+ <target>${project.java.src.version}</target>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>${groovy-eclipse-compiler.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>${groovy-eclipse-batch.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- can't figure out how to get the surefire plugin not to pick up the ITs, so skip it entirely -->
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.accumulo</groupId>
@@ -88,6 +163,36 @@
<classifier>bin</classifier>
<type>tar.gz</type>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.slider</groupId>
+ <artifactId>slider-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.slider</groupId>
+ <artifactId>slider-funtest</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/resources.json
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/resources.json b/app-packages/accumulo/resources.json
index 54d054b..f876901 100644
--- a/app-packages/accumulo/resources.json
+++ b/app-packages/accumulo/resources.json
@@ -7,25 +7,30 @@
"components": {
"ACCUMULO_MASTER": {
"yarn.role.priority": "1",
- "yarn.component.instances": "1"
+ "yarn.component.instances": "1",
+ "yarn.memory": "256"
},
"slider-appmaster": {
},
"ACCUMULO_TSERVER": {
"yarn.role.priority": "2",
- "yarn.component.instances": "1"
+ "yarn.component.instances": "1",
+ "yarn.memory": "256"
},
"ACCUMULO_MONITOR": {
"yarn.role.priority": "3",
- "yarn.component.instances": "1"
+ "yarn.component.instances": "1",
+ "yarn.memory": "128"
},
"ACCUMULO_GC": {
"yarn.role.priority": "4",
- "yarn.component.instances": "1"
+ "yarn.component.instances": "1",
+ "yarn.memory": "128"
},
"ACCUMULO_TRACER": {
"yarn.role.priority": "5",
- "yarn.component.instances": "1"
+ "yarn.component.instances": "1",
+ "yarn.memory": "256"
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/src/assembly/accumulo.xml
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/assembly/accumulo.xml b/app-packages/accumulo/src/assembly/accumulo.xml
index 67e0cbb..a8f9578 100644
--- a/app-packages/accumulo/src/assembly/accumulo.xml
+++ b/app-packages/accumulo/src/assembly/accumulo.xml
@@ -24,6 +24,7 @@
<id>accumulo_v${accumulo.version}</id>
<formats>
<format>zip</format>
+ <format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloAgentCommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloAgentCommandTestBase.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloAgentCommandTestBase.groovy
new file mode 100644
index 0000000..50ecfcd
--- /dev/null
+++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloAgentCommandTestBase.groovy
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.slider.funtest.accumulo
+
+import groovy.util.logging.Slf4j
+import org.apache.slider.funtest.framework.AgentCommandTestBase
+import org.junit.After
+import org.junit.Before
+
+@Slf4j
+abstract class AccumuloAgentCommandTestBase extends AgentCommandTestBase {
+ protected static final int ACCUMULO_LAUNCH_WAIT_TIME
+ protected static final int ACCUMULO_GO_LIVE_TIME = 60000
+
+ // parameters must match those found in the default appConfig.json
+ protected static final String INSTANCE_NAME = "instancename"
+ protected static final String USER = "root"
+ protected static final String PASSWORD = "secret"
+
+ static {
+ ACCUMULO_LAUNCH_WAIT_TIME = getTimeOptionMillis(SLIDER_CONFIG,
+ KEY_ACCUMULO_LAUNCH_TIME,
+ 1000 * DEFAULT_ACCUMULO_LAUNCH_TIME_SECONDS)
+ }
+
+ abstract public String getClusterName();
+
+ @Before
+ public void prepareCluster() {
+ setupCluster(getClusterName())
+ }
+
+ @After
+ public void destroyCluster() {
+ cleanup(getClusterName())
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/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
new file mode 100644
index 0000000..bcb952b
--- /dev/null
+++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloBasicIT.groovy
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.slider.funtest.accumulo
+
+import groovy.util.logging.Slf4j
+import org.apache.slider.api.ClusterDescription
+import org.apache.slider.client.SliderClient
+import org.apache.slider.common.SliderKeys
+import org.apache.slider.core.registry.docstore.PublishedConfiguration
+import org.apache.slider.core.registry.info.ServiceInstanceData
+import org.apache.slider.core.registry.retrieve.RegistryRetriever
+import org.apache.slider.funtest.framework.SliderShell
+import org.apache.slider.server.services.curator.CuratorServiceInstance
+import org.junit.Test
+
+@Slf4j
+class AccumuloBasicIT extends AccumuloAgentCommandTestBase {
+
+ @Override
+ public String getClusterName() {
+ return "test_accumulo_basic"
+ }
+
+ @Test
+ public void testAccumuloClusterCreate() throws Throwable {
+
+ describe getDescription()
+
+ def path = buildClusterPath(getClusterName())
+ assert !clusterFS.exists(path)
+
+ SliderShell shell = slider(EXIT_SUCCESS,
+ [
+ ACTION_CREATE, getClusterName(),
+ ARG_IMAGE, agentTarballPath.toString(),
+ ARG_TEMPLATE, APP_TEMPLATE,
+ ARG_RESOURCES, APP_RESOURCE
+ ])
+
+ logShell(shell)
+
+ ensureApplicationIsUp(getClusterName())
+
+ // must match the values in src/test/resources/resources.json
+ Map<String, Integer> roleMap = [
+ "ACCUMULO_MASTER" : 1,
+ "ACCUMULO_TSERVER" : 2,
+ "ACCUMULO_MONITOR": 1,
+ "ACCUMULO_GC": 0,
+ "ACCUMULO_TRACER" : 0
+ ];
+
+ //get a slider client against the cluster
+ SliderClient sliderClient = bondToCluster(SLIDER_CONFIG, getClusterName())
+ ClusterDescription cd = sliderClient.clusterDescription
+ assert getClusterName() == cd.name
+
+ log.info("Connected via Client {}", sliderClient.toString())
+
+ //wait for the role counts to be reached
+ waitForRoleCount(sliderClient, roleMap, ACCUMULO_LAUNCH_WAIT_TIME)
+
+ sleep(ACCUMULO_GO_LIVE_TIME)
+
+ clusterLoadOperations(cd, sliderClient)
+ }
+
+
+ public String getDescription() {
+ return "Create a working Accumulo cluster $clusterName"
+ }
+
+ public static String getMonitorUrl(SliderClient sliderClient, String clusterName) {
+ CuratorServiceInstance<ServiceInstanceData> instance =
+ sliderClient.getRegistry().queryForInstance(SliderKeys.APP_TYPE, clusterName)
+ ServiceInstanceData serviceInstanceData = instance.payload
+ RegistryRetriever retriever = new RegistryRetriever(serviceInstanceData)
+ PublishedConfiguration configuration = retriever.retrieveConfiguration(
+ retriever.getConfigurations(true), "quicklinks", true)
+
+ // must match name set in metainfo.xml
+ String monitorUrl = configuration.entries.get("org.apache.slider.monitor")
+
+ assertNotNull monitorUrl
+ return monitorUrl
+ }
+
+ public static void checkMonitorPage(String monitorUrl) {
+ String monitor = fetchWebPageWithoutError(monitorUrl);
+ assume monitor != null, "Monitor page null"
+ assume monitor.length() > 100, "Monitor page too short"
+ assume monitor.contains("Accumulo Overview"), "Monitor page didn't contain expected text"
+ }
+
+ /**
+ * Override point for any cluster load operations
+ */
+ public void clusterLoadOperations(ClusterDescription cd, SliderClient sliderClient) {
+ String monitorUrl = getMonitorUrl(sliderClient, getClusterName())
+ assert monitorUrl.startsWith("http://"), "Monitor URL didn't have expected protocol"
+ checkMonitorPage(monitorUrl)
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/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
new file mode 100644
index 0000000..6f68e13
--- /dev/null
+++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloMonitorSSLIT.groovy
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.slider.funtest.accumulo
+
+import groovy.util.logging.Slf4j
+import org.apache.slider.api.ClusterDescription
+import org.apache.slider.client.SliderClient
+
+import javax.net.ssl.KeyManager
+import javax.net.ssl.SSLContext
+import javax.net.ssl.TrustManager
+import javax.net.ssl.X509TrustManager
+import java.security.SecureRandom
+import java.security.cert.CertificateException
+import java.security.cert.X509Certificate
+
+@Slf4j
+class AccumuloMonitorSSLIT extends AccumuloBasicIT {
+ AccumuloMonitorSSLIT() {
+ APP_TEMPLATE = "target/test-config/appConfig_monitor_ssl.json"
+ }
+
+ @Override
+ public String getClusterName() {
+ return "test_monitor_ssl";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Test enable monitor SSL $clusterName"
+ }
+
+ @Override
+ public void clusterLoadOperations(ClusterDescription cd, SliderClient sliderClient) {
+ String monitorUrl = getMonitorUrl(sliderClient, getClusterName())
+ assert monitorUrl.startsWith("https://"), "Monitor URL didn't have expected protocol"
+
+ SSLContext ctx = SSLContext.getInstance("SSL");
+ TrustManager[] t = new TrustManager[1];
+ t[0] = new DefaultTrustManager();
+ ctx.init(new KeyManager[0], t, new SecureRandom());
+ SSLContext.setDefault(ctx);
+ checkMonitorPage(monitorUrl)
+ }
+
+ private static class DefaultTrustManager implements X509TrustManager {
+ @Override
+ public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
new file mode 100644
index 0000000..cdbbcce
--- /dev/null
+++ b/app-packages/accumulo/src/test/groovy/org/apache/slider/funtest/accumulo/AccumuloReadWriteIT.groovy
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.slider.funtest.accumulo
+
+import groovy.util.logging.Slf4j
+import org.apache.accumulo.core.cli.BatchWriterOpts
+import org.apache.accumulo.core.cli.ScannerOpts
+import org.apache.accumulo.core.client.Connector
+import org.apache.accumulo.core.client.ZooKeeperInstance
+import org.apache.accumulo.core.client.security.tokens.PasswordToken
+import org.apache.accumulo.test.TestIngest
+import org.apache.accumulo.test.VerifyIngest
+import org.apache.slider.api.ClusterDescription
+import org.apache.slider.client.SliderClient
+import org.apache.slider.common.SliderXmlConfKeys
+import org.apache.slider.funtest.framework.FuntestProperties
+
+import java.util.concurrent.atomic.AtomicBoolean
+
+@Slf4j
+class AccumuloReadWriteIT extends AccumuloBasicIT {
+
+ @Override
+ public String getClusterName() {
+ return "test_read_write";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Test reading and writing to Accumulo cluster $clusterName"
+ }
+
+ @Override
+ public void clusterLoadOperations(ClusterDescription cd, SliderClient sliderClient) {
+ try {
+ String zookeepers = SLIDER_CONFIG.get(SliderXmlConfKeys.REGISTRY_ZK_QUORUM,
+ FuntestProperties.DEFAULT_SLIDER_ZK_HOSTS)
+
+ ZooKeeperInstance instance = new ZooKeeperInstance(INSTANCE_NAME, zookeepers)
+ Connector connector = instance.getConnector(USER, new PasswordToken(PASSWORD))
+
+ ingest(connector, 200000, 1, 50, 0);
+ verify(connector, 200000, 1, 50, 0);
+
+ ingest(connector, 2, 1, 500000, 0);
+ verify(connector, 2, 1, 500000, 0);
+
+ interleaveTest(connector);
+ } catch (Exception e) {
+ fail("Got exception connecting/reading/writing "+e)
+ }
+ }
+
+ public static void ingest(Connector connector, int rows, int cols, int width, int offset) throws Exception {
+ TestIngest.Opts opts = new TestIngest.Opts();
+ opts.rows = rows;
+ opts.cols = cols;
+ opts.dataSize = width;
+ opts.startRow = offset;
+ opts.columnFamily = "colf";
+ opts.createTable = true;
+ TestIngest.ingest(connector, opts, new BatchWriterOpts());
+ }
+
+ private static void verify(Connector connector, int rows, int cols, int width, int offset) throws Exception {
+ ScannerOpts scannerOpts = new ScannerOpts();
+ VerifyIngest.Opts opts = new VerifyIngest.Opts();
+ opts.rows = rows;
+ opts.cols = cols;
+ opts.dataSize = width;
+ opts.startRow = offset;
+ opts.columnFamily = "colf";
+ VerifyIngest.verifyIngest(connector, opts, scannerOpts);
+ }
+
+ static void interleaveTest(final Connector connector) throws Exception {
+ final int ROWS = 200000;
+ final AtomicBoolean fail = new AtomicBoolean(false);
+ final int CHUNKSIZE = ROWS / 10;
+ ingest(connector, CHUNKSIZE, 1, 50, 0);
+ int i;
+ for (i = 0; i < ROWS; i += CHUNKSIZE) {
+ final int start = i;
+ Thread verify = new Thread() {
+ @Override
+ public void run() {
+ try {
+ verify(connector, CHUNKSIZE, 1, 50, start);
+ } catch (Exception ex) {
+ fail.set(true);
+ }
+ }
+ };
+ ingest(connector, CHUNKSIZE, 1, 50, i + CHUNKSIZE);
+ verify.join();
+ assertFalse(fail.get());
+ }
+ verify(connector, CHUNKSIZE, 1, 50, i);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/src/test/java/org/apache/slider/funtest/accumulo/StubToForceGroovyTestsToCompile.java
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/test/java/org/apache/slider/funtest/accumulo/StubToForceGroovyTestsToCompile.java b/app-packages/accumulo/src/test/java/org/apache/slider/funtest/accumulo/StubToForceGroovyTestsToCompile.java
new file mode 100644
index 0000000..7d289e0
--- /dev/null
+++ b/app-packages/accumulo/src/test/java/org/apache/slider/funtest/accumulo/StubToForceGroovyTestsToCompile.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.accumulo;
+
+public class StubToForceGroovyTestsToCompile {
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/src/test/resources/appConfig_monitor_ssl.json
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/test/resources/appConfig_monitor_ssl.json b/app-packages/accumulo/src/test/resources/appConfig_monitor_ssl.json
new file mode 100644
index 0000000..8b63d06
--- /dev/null
+++ b/app-packages/accumulo/src/test/resources/appConfig_monitor_ssl.json
@@ -0,0 +1,62 @@
+{
+ "schema": "http://example.org/specification/v2.0.0",
+ "metadata": {
+ },
+ "global": {
+ "agent.conf": "agent.ini",
+ "application.def": "${app.package.name}.zip",
+ "config_types": "accumulo-site",
+ "java_home": "/usr/jdk64/jdk1.7.0_45",
+ "package_list": "files/accumulo-${accumulo.version}-bin.tar.gz",
+ "site.global.app_user": "yarn",
+ "site.global.app_log_dir": "${AGENT_LOG_ROOT}/app/log",
+ "site.global.app_pid_dir": "${AGENT_WORK_ROOT}/app/run",
+ "site.global.app_root": "${AGENT_WORK_ROOT}/app/install/accumulo-${accumulo.version}",
+ "site.global.app_install_dir": "${AGENT_WORK_ROOT}/app/install",
+ "site.global.tserver_heapsize": "128m",
+ "site.global.master_heapsize": "128m",
+ "site.global.monitor_heapsize": "64m",
+ "site.global.gc_heapsize": "64m",
+ "site.global.other_heapsize": "128m",
+ "site.global.hadoop_prefix": "/usr/lib/hadoop",
+ "site.global.hadoop_conf_dir": "/etc/hadoop/conf",
+ "site.global.zookeeper_home": "/usr/lib/zookeeper",
+ "site.global.accumulo_instance_name": "instancename",
+ "site.global.accumulo_root_password": "secret",
+ "site.global.user_group": "hadoop",
+ "site.global.security_enabled": "false",
+ "site.global.monitor_protocol": "https",
+ "site.accumulo-site.instance.volumes": "${DEFAULT_DATA_DIR}/data",
+ "site.accumulo-site.instance.zookeeper.host": "${ZK_HOST}",
+ "site.accumulo-site.instance.secret": "DEFAULT",
+ "site.accumulo-site.tserver.memory.maps.max": "80M",
+ "site.accumulo-site.tserver.cache.data.size": "7M",
+ "site.accumulo-site.tserver.cache.index.size": "20M",
+ "site.accumulo-site.trace.token.property.password": "secret",
+ "site.accumulo-site.trace.user": "root",
+ "site.accumulo-site.tserver.sort.buffer.size": "50M",
+ "site.accumulo-site.tserver.walog.max.size": "100M",
+ "site.accumulo-site.master.port.client": "0",
+ "site.accumulo-site.trace.port.client": "0",
+ "site.accumulo-site.tserver.port.client": "0",
+ "site.accumulo-site.gc.port.client": "0",
+ "site.accumulo-site.monitor.port.client": "${ACCUMULO_MONITOR.ALLOCATED_PORT}",
+ "site.accumulo-site.monitor.port.log4j": "0",
+ "site.accumulo-site.general.classpaths": "$ACCUMULO_HOME/lib/accumulo-server.jar,\n$ACCUMULO_HOME/lib/accumulo-core.jar,\n$ACCUMULO_HOME/lib/accumulo-start.jar,\n$ACCUMULO_HOME/lib/accumulo-fate.jar,\n$ACCUMULO_HOME/lib/accumulo-proxy.jar,\n$ACCUMULO_HOME/lib/[^.].*.jar,\n$ZOOKEEPER_HOME/zookeeper[^.].*.jar,\n$HADOOP_CONF_DIR,\n$HADOOP_PREFIX/[^.].*.jar,\n$HADOOP_PREFIX/lib/[^.].*.jar,\n$HADOOP_PREFIX/share/hadoop/common/.*.jar,\n$HADOOP_PREFIX/share/hadoop/common/lib/.*.jar,\n$HADOOP_PREFIX/share/hadoop/hdfs/.*.jar,\n$HADOOP_PREFIX/share/hadoop/mapreduce/.*.jar,\n$HADOOP_PREFIX/share/hadoop/yarn/.*.jar,\n/usr/lib/hadoop/.*.jar,\n/usr/lib/hadoop/lib/.*.jar,\n/usr/lib/hadoop-hdfs/.*.jar,\n/usr/lib/hadoop-mapreduce/.*.jar,\n/usr/lib/hadoop-yarn/.*.jar,"
+ },
+ "components": {
+ "ACCUMULO_MASTER": {
+ },
+ "slider-appmaster": {
+ "jvm.heapsize": "256M"
+ },
+ "ACCUMULO_TSERVER": {
+ },
+ "ACCUMULO_MONITOR": {
+ },
+ "ACCUMULO_GC": {
+ },
+ "ACCUMULO_TRACER": {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/app-packages/accumulo/src/test/resources/resources.json
----------------------------------------------------------------------
diff --git a/app-packages/accumulo/src/test/resources/resources.json b/app-packages/accumulo/src/test/resources/resources.json
new file mode 100644
index 0000000..0d536aa
--- /dev/null
+++ b/app-packages/accumulo/src/test/resources/resources.json
@@ -0,0 +1,36 @@
+{
+ "schema": "http://example.org/specification/v2.0.0",
+ "metadata": {
+ },
+ "global": {
+ },
+ "components": {
+ "ACCUMULO_MASTER": {
+ "yarn.role.priority": "1",
+ "yarn.component.instances": "1",
+ "yarn.memory": "256"
+ },
+ "slider-appmaster": {
+ },
+ "ACCUMULO_TSERVER": {
+ "yarn.role.priority": "2",
+ "yarn.component.instances": "2",
+ "yarn.memory": "256"
+ },
+ "ACCUMULO_MONITOR": {
+ "yarn.role.priority": "3",
+ "yarn.component.instances": "1",
+ "yarn.memory": "128"
+ },
+ "ACCUMULO_GC": {
+ "yarn.role.priority": "4",
+ "yarn.component.instances": "0",
+ "yarn.memory": "128"
+ },
+ "ACCUMULO_TRACER": {
+ "yarn.role.priority": "5",
+ "yarn.component.instances": "0",
+ "yarn.memory": "256"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
index 80a83a4..2c1b270 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
@@ -183,7 +183,7 @@ public abstract class YarnMiniClusterTestBase extends ServiceLauncherBaseTest {
hbaseLaunchWaitTime)
accumuloTestsEnabled =
- testConf.getBoolean(KEY_TEST_ACCUMULO_ENABLED, hbaseTestsEnabled)
+ testConf.getBoolean(KEY_TEST_ACCUMULO_ENABLED, accumuloTestsEnabled)
accumuloLaunchWaitTime = getTimeOptionMillis(testConf,
KEY_ACCUMULO_LAUNCH_TIME,
accumuloLaunchWaitTime)
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/pom.xml
----------------------------------------------------------------------
diff --git a/slider-funtest/pom.xml b/slider-funtest/pom.xml
index 76785a0..4b2edc5 100644
--- a/slider-funtest/pom.xml
+++ b/slider-funtest/pom.xml
@@ -116,7 +116,10 @@
<!-- 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>target/package-tmp/apache-slider-command-logger.zip</test.app.pkg>
+ <test.app.pkg.dir>../app-packages/command-logger/slider-pkg/target</test.app.pkg.dir>
+ <test.app.pkg.file>apache-slider-command-logger.zip</test.app.pkg.file>
+ <test.app.resource>../slider-core/src/test/app_packages/test_command_log/resources.json</test.app.resource>
+ <test.app.template>../slider-core/src/test/app_packages/test_command_log/appConfig.json</test.app.template>
</systemPropertyVariables>
<includes>
<include>**/Test*.java</include>
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/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
new file mode 100644
index 0000000..26ae2bb
--- /dev/null
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.framework
+
+import groovy.util.logging.Slf4j
+import org.apache.hadoop.fs.Path
+import org.apache.slider.common.SliderExitCodes
+import org.apache.slider.common.params.Arguments
+import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentUploads
+import org.apache.slider.funtest.framework.CommandTestBase
+import org.apache.slider.funtest.framework.FuntestProperties
+import org.apache.slider.funtest.framework.SliderShell
+import org.apache.tools.zip.ZipEntry
+import org.apache.tools.zip.ZipOutputStream
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Rule
+import org.junit.rules.TemporaryFolder
+
+@Slf4j
+class AgentCommandTestBase extends CommandTestBase
+implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
+
+ public static final boolean AGENTTESTS_ENABLED
+ private static String TEST_APP_PKG_DIR_PROP = "test.app.pkg.dir"
+ private static String TEST_APP_PKG_FILE_PROP = "test.app.pkg.file"
+ private static String TEST_APP_RESOURCE = "test.app.resource"
+ 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)
+ 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)
+
+
+ protected static Path agentTarballPath;
+ protected static Path appPkgPath;
+ protected static Path agtIniPath;
+
+ protected static boolean setup_failed
+
+ static {
+ AGENTTESTS_ENABLED = SLIDER_CONFIG.getBoolean(KEY_TEST_AGENT_ENABLED, false)
+ }
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ public static void assumeAgentTestsEnabled() {
+ assumeFunctionalTestsEnabled()
+ assume(AGENTTESTS_ENABLED, "Agent tests disabled")
+ }
+
+ @BeforeClass
+ public static void setupAgent() {
+ assumeAgentTestsEnabled()
+
+ }
+
+ @Before
+ public void uploadAgentTarball() {
+ def agentUploads = new AgentUploads(SLIDER_CONFIG)
+ (agentTarballPath, agtIniPath) =
+ agentUploads.uploadAgentFiles(SLIDER_TAR_DIRECTORY, false)
+ }
+
+
+ @Before
+ public void setupApplicationPackage() {
+ try {
+ AgentUploads agentUploads = new AgentUploads(SLIDER_CONFIG)
+ agentUploads.uploader.mkHomeDir()
+
+ appPkgPath = new Path(clusterFS.homeDirectory, TEST_APP_PKG_FILE)
+ if (clusterFS.exists(appPkgPath)) {
+ clusterFS.delete(appPkgPath, false)
+ log.info "Existing app pkg deleted from $appPkgPath"
+ }
+
+ File zipFileName = new File(TEST_APP_PKG_DIR, TEST_APP_PKG_FILE).canonicalFile
+ agentUploads.uploader.copyIfOutOfDate(zipFileName, appPkgPath, false)
+ assume(clusterFS.exists(appPkgPath), "App pkg not uploaded to $appPkgPath")
+ log.info "App pkg uploaded at $appPkgPath"
+ } catch (Exception e) {
+ setup_failed = true
+ fail("Setup failed "+e)
+ }
+ }
+
+ public static void logShell(SliderShell shell) {
+ for (String str in shell.out) {
+ log.info str
+ }
+ }
+
+ public static void assertComponentCount(String component, int count, SliderShell shell) {
+ log.info("Asserting component count.")
+ String entry = findLineEntry(shell, ["instances", component] as String[])
+ log.info(entry)
+ assert entry != null
+ int instanceCount = 0
+ int index = entry.indexOf("container_")
+ while (index != -1) {
+ instanceCount++;
+ index = entry.indexOf("container_", index + 1)
+ }
+
+ assert instanceCount == count, 'Instance count for component did not match expected. Parsed: ' + entry
+ }
+
+ public static String findLineEntry(SliderShell shell, String[] locaters) {
+ int index = 0;
+ for (String str in shell.out) {
+ if (str.contains("\"" + locaters[index] + "\"")) {
+ if (locaters.size() == index + 1) {
+ return str;
+ } else {
+ index++;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static String findLineEntryValue(SliderShell shell, String[] locaters) {
+ String line = findLineEntry(shell, locaters);
+
+ if (line != null) {
+ log.info("Parsing {} for value.", line)
+ int dividerIndex = line.indexOf(":");
+ if (dividerIndex > 0) {
+ String value = line.substring(dividerIndex + 1).trim()
+ if (value.endsWith(",")) {
+ value = value.subSequence(0, value.length() - 1)
+ }
+ return value;
+ }
+ }
+ return null;
+ }
+
+ public static boolean isApplicationInState(String text, String applicationName) {
+ boolean exists = false
+ SliderShell shell = slider(EXIT_SUCCESS,
+ [
+ ACTION_LIST,
+ applicationName])
+ for (String str in shell.out) {
+ if (str.contains(text)) {
+ exists = true
+ }
+ }
+
+ return exists
+ }
+
+ protected void ensureApplicationIsUp(String clusterName) {
+ repeatUntilTrue(this.&isApplicationUp, 15, 1000 * 3, ['arg1': clusterName],
+ true, 'Application did not start, aborting test.')
+ }
+
+ boolean isApplicationUp(Map<String, String> args) {
+ String applicationName = args['arg1'];
+ return isApplicationInState("RUNNING", applicationName);
+ }
+
+ public static void addDir(File dirObj, ZipOutputStream zipFile, String prefix) {
+ dirObj.eachFile() { file ->
+ if (file.directory) {
+ addDir(file, zipFile, prefix + file.name + File.separator)
+ } else {
+ log.info("Adding to zip - " + prefix + file.getName())
+ zipFile.putNextEntry(new ZipEntry(prefix + file.getName()))
+ file.eachByte(1024) { buffer, len -> zipFile.write(buffer, 0, len) }
+ zipFile.closeEntry()
+ }
+ }
+ }
+
+ protected void repeatUntilTrue(Closure c, int maxAttempts, int sleepDur, Map args,
+ boolean failIfUnsuccessful = false, String message = "") {
+ int attemptCount = 0
+ while (attemptCount < maxAttempts) {
+ if (c(args)) {
+ break
+ };
+ attemptCount++;
+
+ if (failIfUnsuccessful) {
+ assert attemptCount != maxAttempts, message
+ }
+
+ sleep(sleepDur)
+ }
+ }
+
+ protected void cleanup(String applicationName) throws Throwable {
+ if (setup_failed) {
+ // cleanup probably won't work if setup failed
+ return
+ }
+
+ log.info "Cleaning app instance, if exists, by name " + applicationName
+ teardown(applicationName)
+
+ // sleep till the instance is frozen
+ sleep(1000 * 3)
+
+ SliderShell shell = slider([
+ ACTION_DESTROY,
+ applicationName])
+
+ if (shell.ret != 0 && shell.ret != EXIT_UNKNOWN_INSTANCE) {
+ logShell(shell)
+ assert fail("Old cluster either should not exist or should get destroyed.")
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/main/java/org/apache/slider/funtest/accumulo/StubToForceGroovySrcToCompile.java
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/java/org/apache/slider/funtest/accumulo/StubToForceGroovySrcToCompile.java b/slider-funtest/src/main/java/org/apache/slider/funtest/accumulo/StubToForceGroovySrcToCompile.java
new file mode 100644
index 0000000..eefccbb
--- /dev/null
+++ b/slider-funtest/src/main/java/org/apache/slider/funtest/accumulo/StubToForceGroovySrcToCompile.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.accumulo;
+
+class StubToForceGroovySrcToCompile {
+}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentCommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentCommandTestBase.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentCommandTestBase.groovy
deleted file mode 100644
index daf102a..0000000
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentCommandTestBase.groovy
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.funtest.lifecycle
-
-import groovy.util.logging.Slf4j
-import org.apache.hadoop.fs.Path
-import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.common.params.Arguments
-import org.apache.slider.common.params.SliderActions
-import org.apache.slider.funtest.framework.AgentUploads
-import org.apache.slider.funtest.framework.CommandTestBase
-import org.apache.slider.funtest.framework.FuntestProperties
-import org.apache.slider.funtest.framework.SliderShell
-import org.apache.tools.zip.ZipEntry
-import org.apache.tools.zip.ZipOutputStream
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-
-@Slf4j
-class AgentCommandTestBase extends CommandTestBase
-implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
-
- public static final boolean AGENTTESTS_ENABLED
- private static String TEST_APP_PKG_PROP = "test.app.pkg"
-
-
- protected static String APP_RESOURCE = "../slider-core/src/test/app_packages/test_command_log/resources.json"
- protected static String APP_TEMPLATE = "../slider-core/src/test/app_packages/test_command_log/appConfig.json"
- protected static String AGENT_CONF = "../slider-agent/conf/agent.ini"
- protected static final File LOCAL_AGENT_CONF
- public static final String TEST_APP_PKG = sysprop(TEST_APP_PKG_PROP)
-
-
- protected static Path agentTarballPath;
- protected static Path appPkgPath;
- protected static Path agtIniPath;
-
- static {
- AGENTTESTS_ENABLED = SLIDER_CONFIG.getBoolean(KEY_TEST_AGENT_ENABLED, false)
- LOCAL_AGENT_CONF = new File(AGENT_CONF).canonicalFile
- }
-
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- public static void assumeAgentTestsEnabled() {
- assumeFunctionalTestsEnabled()
- assume(AGENTTESTS_ENABLED, "Agent tests disabled")
- }
-
- @BeforeClass
- public static void setupAgent() {
- assumeAgentTestsEnabled()
-
- }
-
- @Before
- public void uploadAgentTarball() {
- def agentUploads = new AgentUploads(SLIDER_CONFIG)
- (agentTarballPath, agtIniPath) =
- agentUploads.uploadAgentFiles(SLIDER_TAR_DIRECTORY, false)
- }
-
-
- @Before
- public void setupApplicationPackage() {
- AgentUploads agentUploads = new AgentUploads(SLIDER_CONFIG)
- agentUploads.uploader.mkHomeDir()
-
- appPkgPath = new Path(clusterFS.homeDirectory, "apache-slider-command-logger.zip")
- if (!clusterFS.exists(appPkgPath)) {
- clusterFS.delete(appPkgPath, false)
- }
-
- File zipFileName = new File(TEST_APP_PKG).canonicalFile
- agentUploads.uploader.copyIfOutOfDate(zipFileName, appPkgPath, false)
- }
-
- public static void logShell(SliderShell shell) {
- for (String str in shell.out) {
- log.info str
- }
- }
-
- public static void assertComponentCount(String component, int count, SliderShell shell) {
- log.info("Asserting component count.")
- String entry = findLineEntry(shell, ["instances", component] as String[])
- log.info(entry)
- assert entry != null
- int instanceCount = 0
- int index = entry.indexOf("container_")
- while (index != -1) {
- instanceCount++;
- index = entry.indexOf("container_", index + 1)
- }
-
- assert instanceCount == count, 'Instance count for component did not match expected. Parsed: ' + entry
- }
-
- public static String findLineEntry(SliderShell shell, String[] locaters) {
- int index = 0;
- for (String str in shell.out) {
- if (str.contains("\"" + locaters[index] + "\"")) {
- if (locaters.size() == index + 1) {
- return str;
- } else {
- index++;
- }
- }
- }
-
- return null;
- }
-
- public static String findLineEntryValue(SliderShell shell, String[] locaters) {
- String line = findLineEntry(shell, locaters);
-
- if (line != null) {
- log.info("Parsing {} for value.", line)
- int dividerIndex = line.indexOf(":");
- if (dividerIndex > 0) {
- String value = line.substring(dividerIndex + 1).trim()
- if (value.endsWith(",")) {
- value = value.subSequence(0, value.length() - 1)
- }
- return value;
- }
- }
- return null;
- }
-
- public static boolean isApplicationInState(String text, String applicationName) {
- boolean exists = false
- SliderShell shell = slider(EXIT_SUCCESS,
- [
- ACTION_LIST,
- applicationName])
- for (String str in shell.out) {
- if (str.contains(text)) {
- exists = true
- }
- }
-
- return exists
- }
-
- protected void ensureApplicationIsUp(String clusterName) {
- repeatUntilTrue(this.&isApplicationUp, 15, 1000 * 3, ['arg1': clusterName],
- true, 'Application did not start, aborting test.')
- }
-
- boolean isApplicationUp(Map<String, String> args) {
- String applicationName = args['arg1'];
- return isApplicationInState("RUNNING", applicationName);
- }
-
- public static void addDir(File dirObj, ZipOutputStream zipFile, String prefix) {
- dirObj.eachFile() { file ->
- if (file.directory) {
- addDir(file, zipFile, prefix + file.name + File.separator)
- } else {
- log.info("Adding to zip - " + prefix + file.getName())
- zipFile.putNextEntry(new ZipEntry(prefix + file.getName()))
- file.eachByte(1024) { buffer, len -> zipFile.write(buffer, 0, len) }
- zipFile.closeEntry()
- }
- }
- }
-
- public static void zipDir(String zipFile, String dir) {
- File dirObj = new File(dir);
- ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
- log.info("Creating : " + zipFile);
- try {
- addDir(dirObj, out, "");
- }
- finally {
- out.close();
- }
- }
-
- protected void repeatUntilTrue(Closure c, int maxAttempts, int sleepDur, Map args,
- boolean failIfUnsuccessful = false, String message = "") {
- int attemptCount = 0
- while (attemptCount < maxAttempts) {
- if (c(args)) {
- break
- };
- attemptCount++;
-
- if (failIfUnsuccessful) {
- assert attemptCount != maxAttempts, message
- }
-
- sleep(sleepDur)
- }
- }
-
- protected void cleanup(String applicationName) throws Throwable {
- log.info "Cleaning app instance, if exists, by name " + applicationName
- teardown(applicationName)
-
- // sleep till the instance is frozen
- sleep(1000 * 3)
-
- SliderShell shell = slider([
- ACTION_DESTROY,
- applicationName])
-
- if (shell.ret != 0 && shell.ret != EXIT_UNKNOWN_INSTANCE) {
- logShell(shell)
- assert fail("Old cluster either should not exist or should get destroyed.")
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentClusterLifecycle.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentClusterLifecycle.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentClusterLifecycle.groovy
index 25a4134..0d643ca 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentClusterLifecycle.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentClusterLifecycle.groovy
@@ -27,6 +27,7 @@ import org.apache.slider.common.SliderExitCodes
import org.apache.slider.common.SliderXmlConfKeys
import org.apache.slider.common.params.Arguments
import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentCommandTestBase
import org.apache.slider.funtest.framework.FuntestProperties
import org.apache.slider.funtest.framework.SliderShell
import org.junit.After
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures.groovy
index 96a99ad..ea58d5f 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures.groovy
@@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j
import org.apache.slider.common.SliderExitCodes
import org.apache.slider.common.params.Arguments
import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentCommandTestBase
import org.apache.slider.funtest.framework.FuntestProperties
import org.apache.slider.funtest.framework.SliderShell
import org.junit.After
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures2.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures2.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures2.groovy
index 644fa4f..7804042 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures2.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAgentFailures2.groovy
@@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j
import org.apache.slider.common.SliderExitCodes
import org.apache.slider.common.params.Arguments
import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentCommandTestBase
import org.apache.slider.funtest.framework.FuntestProperties
import org.apache.slider.funtest.framework.SliderShell
import org.junit.After
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAppsThroughAgent.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAppsThroughAgent.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAppsThroughAgent.groovy
index 793a323..6b0f678 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAppsThroughAgent.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestAppsThroughAgent.groovy
@@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j
import org.apache.slider.common.SliderExitCodes
import org.apache.slider.common.params.Arguments
import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentCommandTestBase
import org.apache.slider.funtest.framework.FuntestProperties
import org.apache.slider.funtest.framework.SliderShell
import org.junit.After
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestClusterBuildDestroy.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestClusterBuildDestroy.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestClusterBuildDestroy.groovy
index 1907a2c..ead1601 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestClusterBuildDestroy.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestClusterBuildDestroy.groovy
@@ -26,6 +26,7 @@ import org.apache.slider.common.SliderKeys
import org.apache.slider.common.SliderXmlConfKeys
import org.apache.slider.common.params.Arguments
import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentCommandTestBase
import org.apache.slider.funtest.framework.FuntestProperties
import org.junit.AfterClass
import org.junit.BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f94e1039/slider-providers/accumulo/slider-accumulo-provider/src/main/java/org/apache/slider/providers/accumulo/AccumuloProviderService.java
----------------------------------------------------------------------
diff --git a/slider-providers/accumulo/slider-accumulo-provider/src/main/java/org/apache/slider/providers/accumulo/AccumuloProviderService.java b/slider-providers/accumulo/slider-accumulo-provider/src/main/java/org/apache/slider/providers/accumulo/AccumuloProviderService.java
index 4f5f2fa..c511efb 100644
--- a/slider-providers/accumulo/slider-accumulo-provider/src/main/java/org/apache/slider/providers/accumulo/AccumuloProviderService.java
+++ b/slider-providers/accumulo/slider-accumulo-provider/src/main/java/org/apache/slider/providers/accumulo/AccumuloProviderService.java
@@ -410,9 +410,13 @@ public class AccumuloProviderService extends AbstractProviderService implements
String monitorKey = "Active Accumulo Monitor: ";
String monitorAddr = getInfoAvoidingNull(clusterDesc, AccumuloKeys.MONITOR_ADDRESS);
if (!StringUtils.isBlank(monitorAddr)) {
+ try {
HostAndPort hostPort = HostAndPort.fromString(monitorAddr);
details.put(monitorKey,
String.format("http://%s:%d", hostPort.getHostText(), hostPort.getPort()));
+ } catch (Exception e) {
+ details.put(monitorKey + "N/A", null);
+ }
} else {
details.put(monitorKey + "N/A", null);
}