Adds hadoop2 maven profile and fixes tests
* adds "hadoop2" maven profile * switches tests depended by hadoop version Change-Id: Icd79a400b90b4cd19ac093355a9f731a2195de10 Closes-Bug: 1401027
This commit is contained in:
parent
5d58c3067e
commit
32a61dcdde
|
@ -6,7 +6,7 @@ These sources were originally published at https://issues.apache.org/jira/secure
|
|||
The sources were obtained by running "patch" command. All the files related to Hadoop-common were skiped during patching.
|
||||
|
||||
Changes were made after patching:
|
||||
* pom.xml was updated to use hadoop-core 1.1.2 dependency
|
||||
* pom.xml was updated to use hadoop-core 1.1.2 dependency and adds hadoop2 profile
|
||||
* removed dependency on 2.x hadoop in code (@Override and isDirectory() -> isDir())
|
||||
* removed Hadoop 2.X tests
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
<file.encoding>UTF-8</file.encoding>
|
||||
<downloadSources>true</downloadSources>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<hadoop.artifactid>hadoop-core</hadoop.artifactid>
|
||||
<hadoop.version>1.2.1</hadoop.version>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
|
@ -57,7 +59,13 @@
|
|||
<maven.test.skip>false</maven.test.skip>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>hadoop2</id>
|
||||
<properties>
|
||||
<hadoop.artifactid>hadoop-common</hadoop.artifactid>
|
||||
<hadoop.version>2.4.1</hadoop.version>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
|
@ -113,8 +121,8 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-core</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<artifactId>${hadoop.artifactid}</artifactId>
|
||||
<version>${hadoop.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.apache.hadoop.fs.swift.exceptions.SwiftConfigurationException;
|
||||
|
||||
import static org.apache.hadoop.fs.swift.http.SwiftProtocolConstants.DOT_AUTH_URL;
|
||||
import static org.apache.hadoop.fs.swift.http.SwiftProtocolConstants.DOT_LOCATION_AWARE;
|
||||
import static org.apache.hadoop.fs.swift.http.SwiftProtocolConstants.DOT_PASSWORD;
|
||||
|
@ -91,18 +93,34 @@ public class TestSwiftConfig extends Assert {
|
|||
mkInstance(configuration);
|
||||
}
|
||||
|
||||
@Test(expected = org.apache.hadoop.fs.swift.exceptions.SwiftConfigurationException.class)
|
||||
@Test
|
||||
public void testBadRetryCount() throws Exception {
|
||||
final Configuration configuration = createCoreConfig();
|
||||
configuration.set(SWIFT_RETRY_COUNT, "three");
|
||||
mkInstance(configuration);
|
||||
try {
|
||||
mkInstance(configuration);
|
||||
} catch (SwiftConfigurationException e) {
|
||||
if (TestUtils.isHadoop1())
|
||||
Assert.fail();
|
||||
return;
|
||||
}
|
||||
if (!TestUtils.isHadoop1())
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
@Test(expected = org.apache.hadoop.fs.swift.exceptions.SwiftConfigurationException.class)
|
||||
@Test
|
||||
public void testBadConnectTimeout() throws Exception {
|
||||
final Configuration configuration = createCoreConfig();
|
||||
configuration.set(SWIFT_CONNECTION_TIMEOUT, "three");
|
||||
mkInstance(configuration);
|
||||
try {
|
||||
mkInstance(configuration);
|
||||
} catch (SwiftConfigurationException e) {
|
||||
if (TestUtils.isHadoop1())
|
||||
Assert.fail();
|
||||
return;
|
||||
}
|
||||
if (!TestUtils.isHadoop1())
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
@Test(expected = org.apache.hadoop.fs.swift.exceptions.SwiftConfigurationException.class)
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* 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.hadoop.fs.swift;
|
||||
|
||||
import org.apache.hadoop.util.VersionInfo;
|
||||
|
||||
class TestUtils {
|
||||
|
||||
public static boolean isHadoop1() throws Exception {
|
||||
return VersionInfo.getVersion().startsWith("1.");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue