Repository: sqoop Updated Branches: refs/heads/sqoop2 f33554a19 -> 492459615
SQOOP-2645: Sqoop2: Ensure that classpath loading integration tests are run by default (Abraham Fine via Jarek Jarcec Cecho) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/49245961 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/49245961 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/49245961 Branch: refs/heads/sqoop2 Commit: 492459615ea3899f4c0f8fd701f07aaac3151471 Parents: f33554a Author: Jarek Jarcec Cecho <[email protected]> Authored: Fri Oct 30 08:01:34 2015 -0700 Committer: Jarek Jarcec Cecho <[email protected]> Committed: Fri Oct 30 08:01:34 2015 -0700 ---------------------------------------------------------------------- .../sqoop/connector/ConnectorManager.java | 21 +++++++------ test/pom.xml | 15 +++++++++ .../BlacklistedConnectorTest.java | 8 +++-- .../test/resources/classpath-tests-suite.xml | 33 -------------------- .../resources/connector-loading-tests-suite.xml | 33 ++++++++++++++++++++ 5 files changed, 66 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/49245961/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java b/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java index f606950..db626a1 100644 --- a/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java +++ b/core/src/main/java/org/apache/sqoop/connector/ConnectorManager.java @@ -75,15 +75,7 @@ public class ConnectorManager implements Reconfigurable { /** * The private constructor for the singleton class. */ - private ConnectorManager() { - String blacklistedConnectorsString = - SqoopConfiguration.getInstance().getContext().getString(ConfigurationConstants.BLACKLISTED_CONNECTORS); - if (blacklistedConnectorsString == null) { - blacklistedConnectors = Collections.EMPTY_SET; - } else { - blacklistedConnectors = ContextUtils.getUniqueStrings(blacklistedConnectorsString); - } - } + private ConnectorManager() {} /** * Return current instance. @@ -184,6 +176,16 @@ public class ConnectorManager implements Reconfigurable { if (connectorNames == null) { connectorNames = new HashSet<String>(); } + if (blacklistedConnectors == null) { + String blacklistedConnectorsString = + SqoopConfiguration.getInstance().getContext().getString(ConfigurationConstants.BLACKLISTED_CONNECTORS); + + if (blacklistedConnectorsString == null) { + blacklistedConnectors = Collections.EMPTY_SET; + } else { + blacklistedConnectors = ContextUtils.getUniqueStrings(blacklistedConnectorsString); + } + } if (LOG.isTraceEnabled()) { LOG.trace("Begin connector manager initialization"); @@ -256,6 +258,7 @@ public class ConnectorManager implements Reconfigurable { handlerMap = null; idToNameMap = null; connectorNames = null; + blacklistedConnectors = null; } @Override http://git-wip-us.apache.org/repos/asf/sqoop/blob/49245961/test/pom.xml ---------------------------------------------------------------------- diff --git a/test/pom.xml b/test/pom.xml index ad8cd11..4e1e197 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -237,6 +237,21 @@ limitations under the License. </properties> </configuration> </execution> + <execution> + <id>connector-loading-test</id> + <goals> + <goal>test</goal> + </goals> + <phase>integration-test</phase> + <configuration> + <suiteXmlFiles> + <suiteXmlFile>src/test/resources/connector-loading-tests-suite.xml</suiteXmlFile> + </suiteXmlFiles> + <properties> + <suitename>connector-loading-tests</suitename> + </properties> + </configuration> + </execution> </executions> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/sqoop/blob/49245961/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java b/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java index 2d6d37f..6228b0d 100644 --- a/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java +++ b/test/src/test/java/org/apache/sqoop/integration/connectorloading/BlacklistedConnectorTest.java @@ -21,10 +21,10 @@ import org.apache.hadoop.conf.Configuration; import org.apache.sqoop.client.SqoopClient; import org.apache.sqoop.common.SqoopException; import org.apache.sqoop.core.ConfigurationConstants; -import org.apache.sqoop.model.MLink; import org.apache.sqoop.test.minicluster.JettySqoopMiniCluster; import org.apache.sqoop.test.testcases.ConnectorTestCase; import org.apache.sqoop.test.utils.HdfsUtils; +import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; import java.util.HashMap; @@ -60,10 +60,14 @@ public class BlacklistedConnectorTest extends ConnectorTestCase { @Test(expectedExceptions = {SqoopException.class}) public void testCreateLinkWithNonexistantConnector() throws Exception { startSqoopMiniCluster(); - getClient().createLink("generic-jdbc-connector"); } + @AfterMethod + public void stopCluster() throws Exception { + getCluster().stop(); + } + @Override public void startSqoop() throws Exception { // Do nothing so that Sqoop isn't started before Suite. http://git-wip-us.apache.org/repos/asf/sqoop/blob/49245961/test/src/test/resources/classpath-tests-suite.xml ---------------------------------------------------------------------- diff --git a/test/src/test/resources/classpath-tests-suite.xml b/test/src/test/resources/classpath-tests-suite.xml deleted file mode 100644 index 02c1df3..0000000 --- a/test/src/test/resources/classpath-tests-suite.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -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. ---> - -<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > - -<suite name="ConnectorLoadingTests" verbose="2" parallel="false"> - - <listeners> - <listener class-name="org.apache.sqoop.test.testng.SqoopTestListener" /> - </listeners> - - <test name="ConnectorLoadingTests"> - <packages> - <package name="org.apache.sqoop.integration.connectorloading"/> - </packages> - </test> - -</suite> http://git-wip-us.apache.org/repos/asf/sqoop/blob/49245961/test/src/test/resources/connector-loading-tests-suite.xml ---------------------------------------------------------------------- diff --git a/test/src/test/resources/connector-loading-tests-suite.xml b/test/src/test/resources/connector-loading-tests-suite.xml new file mode 100644 index 0000000..02c1df3 --- /dev/null +++ b/test/src/test/resources/connector-loading-tests-suite.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> + +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > + +<suite name="ConnectorLoadingTests" verbose="2" parallel="false"> + + <listeners> + <listener class-name="org.apache.sqoop.test.testng.SqoopTestListener" /> + </listeners> + + <test name="ConnectorLoadingTests"> + <packages> + <package name="org.apache.sqoop.integration.connectorloading"/> + </packages> + </test> + +</suite>
