You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by hs...@apache.org on 2015/10/22 09:31:41 UTC
sqoop git commit: SQOOP-2619. Sqoop2: Provide ability to run
integration tests against real Sqoop 2 server
Repository: sqoop
Updated Branches:
refs/heads/sqoop2 42d268bc9 -> 6a10db015
SQOOP-2619. Sqoop2: Provide ability to run integration tests against real Sqoop 2 server
(Jarcec via Hari)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/6a10db01
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/6a10db01
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/6a10db01
Branch: refs/heads/sqoop2
Commit: 6a10db01531e8136e282f5d01d2d16b6d5976bc4
Parents: 42d268b
Author: Hari Shreedharan <hs...@apache.org>
Authored: Thu Oct 22 00:31:10 2015 -0700
Committer: Hari Shreedharan <hs...@apache.org>
Committed: Thu Oct 22 00:31:10 2015 -0700
----------------------------------------------------------------------
.../providers/SqoopInfrastructureProvider.java | 3 +-
.../test/minicluster/RealSqoopCluster.java | 59 ++++++++++++++++++++
.../minicluster/SqoopMiniClusterFactory.java | 38 +++++++++++++
.../sqoop/integration/server/VersionTest.java | 1 -
4 files changed, 99 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/6a10db01/test/src/main/java/org/apache/sqoop/test/infrastructure/providers/SqoopInfrastructureProvider.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/infrastructure/providers/SqoopInfrastructureProvider.java b/test/src/main/java/org/apache/sqoop/test/infrastructure/providers/SqoopInfrastructureProvider.java
index 9b0d521..2c8af9c 100644
--- a/test/src/main/java/org/apache/sqoop/test/infrastructure/providers/SqoopInfrastructureProvider.java
+++ b/test/src/main/java/org/apache/sqoop/test/infrastructure/providers/SqoopInfrastructureProvider.java
@@ -21,6 +21,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.log4j.Logger;
import org.apache.sqoop.test.minicluster.JettySqoopMiniCluster;
import org.apache.sqoop.test.minicluster.SqoopMiniCluster;
+import org.apache.sqoop.test.minicluster.SqoopMiniClusterFactory;
/**
* Sqoop infrastructure provider.
@@ -37,7 +38,7 @@ public class SqoopInfrastructureProvider extends InfrastructureProvider {
@Override
public void start() {
try {
- instance = new JettySqoopMiniCluster(rootPath, hadoopConf);
+ instance = SqoopMiniClusterFactory.getSqoopMiniCluster(System.getProperties(), JettySqoopMiniCluster.class, rootPath, hadoopConf);
instance.start();
} catch (Exception e) {
LOG.error("Could not start Sqoop mini cluster.", e);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/6a10db01/test/src/main/java/org/apache/sqoop/test/minicluster/RealSqoopCluster.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/minicluster/RealSqoopCluster.java b/test/src/main/java/org/apache/sqoop/test/minicluster/RealSqoopCluster.java
new file mode 100644
index 0000000..325a6a9
--- /dev/null
+++ b/test/src/main/java/org/apache/sqoop/test/minicluster/RealSqoopCluster.java
@@ -0,0 +1,59 @@
+/**
+ * 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.sqoop.test.minicluster;
+
+import org.apache.hadoop.conf.Configuration;
+
+/**
+ */
+public class RealSqoopCluster extends SqoopMiniCluster {
+
+ private final static String SERVER_URL_KEY = "org.apache.sqoop.minicluster.real.server_url";
+
+ private String serverUrl;
+
+ public RealSqoopCluster(String temporaryPath) throws Exception {
+ super(temporaryPath);
+
+ serverUrl = System.getProperty(SERVER_URL_KEY);
+
+ if(serverUrl == null) {
+ throw new RuntimeException("Missing URL for real Sqoop 2 server: " + SERVER_URL_KEY);
+ }
+ }
+
+ public RealSqoopCluster(String temporaryPath, Configuration configuration) throws Exception {
+ this(temporaryPath);
+ // We're ignoring Hadoop configuration as we're running against real cluster
+ }
+
+ @Override
+ public void start() throws Exception {
+ // Void operation
+ }
+
+ @Override
+ public void stop() throws Exception {
+ // Void operation
+ }
+
+ @Override
+ public String getServerUrl() {
+ return serverUrl;
+ }
+}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/6a10db01/test/src/main/java/org/apache/sqoop/test/minicluster/SqoopMiniClusterFactory.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/minicluster/SqoopMiniClusterFactory.java b/test/src/main/java/org/apache/sqoop/test/minicluster/SqoopMiniClusterFactory.java
new file mode 100644
index 0000000..544d419
--- /dev/null
+++ b/test/src/main/java/org/apache/sqoop/test/minicluster/SqoopMiniClusterFactory.java
@@ -0,0 +1,38 @@
+/**
+ * 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.sqoop.test.minicluster;
+
+import org.apache.hadoop.conf.Configuration;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Properties;
+
+/**
+ */
+public class SqoopMiniClusterFactory {
+
+ public static final String MINICLUSTER_CLASS_PROPERTY = "sqoop.minicluster.class";
+
+ public static SqoopMiniCluster getSqoopMiniCluster(Properties properties, Class<? extends SqoopMiniCluster> defaultClusterClass, String temporaryPath, Configuration configuration) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
+ String className = properties.getProperty(MINICLUSTER_CLASS_PROPERTY);
+ Class<?> klass = className == null ? defaultClusterClass : Class.forName(className);
+ Constructor konstructor = klass.getConstructor(String.class, Configuration.class);
+ return (SqoopMiniCluster)konstructor.newInstance(temporaryPath, configuration);
+ }
+}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/6a10db01/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java b/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
index ad5a2db..e86a6cc 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java
@@ -40,7 +40,6 @@ public class VersionTest extends SqoopTestCase {
VersionBean versionBean = versionRequest.read(getSqoopServerUrl());
assertEquals(versionBean.getBuildVersion(), VersionInfo.getBuildVersion());
- assertEquals(versionBean.getBuildDate(), VersionInfo.getBuildDate());
assertEquals(versionBean.getSourceRevision(), VersionInfo.getSourceRevision());
assertEquals(versionBean.getSystemUser(), VersionInfo.getUser());
assertEquals(versionBean.getSourceRevision(), VersionInfo.getSourceRevision());