forked from Intel-bigdata/SSM
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from tigrulya-exe/feature/ADH-4064-sync-owner-…
…group-permissions [ADH-4064] Preserve file attributes in sync and distcp actions
- Loading branch information
Showing
17 changed files
with
563 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
smart-common/src/main/java/org/smartdata/utils/ConfigUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* 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.smartdata.utils; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
|
||
import static org.smartdata.SmartConstants.DISTRIBUTED_FILE_SYSTEM; | ||
import static org.smartdata.SmartConstants.FS_HDFS_IMPL; | ||
import static org.smartdata.SmartConstants.SMART_FILE_SYSTEM; | ||
|
||
public class ConfigUtil { | ||
public static Configuration toRemoteClusterConfig(Configuration configuration) { | ||
Configuration remoteConfig = new Configuration(configuration); | ||
if (SMART_FILE_SYSTEM.equals(remoteConfig.get(FS_HDFS_IMPL))) { | ||
remoteConfig.set(FS_HDFS_IMPL, DISTRIBUTED_FILE_SYSTEM); | ||
} | ||
|
||
return remoteConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...oop-support/smart-hadoop-common/src/test/java/org/smartdata/hdfs/MultiClusterHarness.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/** | ||
* 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.smartdata.hdfs; | ||
|
||
import java.io.IOException; | ||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.Path; | ||
import org.apache.hadoop.hdfs.DFSClient; | ||
import org.apache.hadoop.hdfs.DistributedFileSystem; | ||
import org.apache.hadoop.hdfs.MiniDFSCluster; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import static org.smartdata.hdfs.MultiClusterHarness.TestType.INTER_CLUSTER; | ||
import static org.smartdata.hdfs.MultiClusterHarness.TestType.INTRA_CLUSTER; | ||
|
||
/** | ||
* A MiniCluster for action test. | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public abstract class MultiClusterHarness extends MiniClusterHarness { | ||
|
||
public enum TestType { | ||
INTRA_CLUSTER, | ||
INTER_CLUSTER | ||
} | ||
|
||
@Rule | ||
public TemporaryFolder tmpFolder = new TemporaryFolder(); | ||
|
||
@Parameterized.Parameter() | ||
public TestType testType; | ||
|
||
protected MiniDFSCluster anotherCluster; | ||
protected DistributedFileSystem anotherDfs; | ||
protected DFSClient anotherDfsClient; | ||
|
||
@Parameterized.Parameters(name = "Test type - {0}") | ||
public static Object[] parameters() { | ||
return new Object[] {INTRA_CLUSTER, INTER_CLUSTER}; | ||
} | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
if (testType == INTRA_CLUSTER) { | ||
anotherDfs = dfs; | ||
anotherDfsClient = dfsClient; | ||
return; | ||
} | ||
Configuration clusterConfig = new Configuration(smartContext.getConf()); | ||
clusterConfig.set("hdfs.minidfs.basedir", tmpFolder.newFolder().getAbsolutePath()); | ||
anotherCluster = createCluster(clusterConfig); | ||
anotherDfs = anotherCluster.getFileSystem(); | ||
anotherDfsClient = anotherDfs.getClient(); | ||
} | ||
|
||
@After | ||
public void shutdown() throws IOException { | ||
if (anotherCluster != null) { | ||
anotherCluster.shutdown(true); | ||
} | ||
} | ||
|
||
protected Path anotherClusterPath(String parent, String child) { | ||
return anotherDfs.makeQualified(new Path(parent, child)); | ||
} | ||
|
||
protected String pathToActionArg(Path path) { | ||
return testType == TestType.INTER_CLUSTER ? path.toString() : path.toUri().getPath(); | ||
} | ||
} |
Oops, something went wrong.