You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by ro...@apache.org on 2014/11/28 14:10:47 UTC
[3/8] incubator-falcon git commit: FALCON-698 Fix checkstyle bugs in
test files in falcon-regression. Contributed by Ruslan Ostafiychuk and Raghav
Kumar Gautam
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismProcessSuspendTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismProcessSuspendTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismProcessSuspendTest.java
index 4347040..43635bf 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismProcessSuspendTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismProcessSuspendTest.java
@@ -39,15 +39,18 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.lang.reflect.Method;
+/**
+ * Suspend process tests.
+ */
public class PrismProcessSuspendTest extends BaseTestClass {
- ColoHelper cluster1 = servers.get(0);
- ColoHelper cluster2 = servers.get(1);
- OozieClient cluster1OC = serverOC.get(0);
- OozieClient cluster2OC = serverOC.get(1);
- private boolean restartRequired;
- String aggregateWorkflowDir = baseHDFSDir + "/PrismProcessSuspendTest/aggregator";
- private static final Logger logger = Logger.getLogger(PrismProcessSuspendTest.class);
+ private ColoHelper cluster1 = servers.get(0);
+ private ColoHelper cluster2 = servers.get(1);
+ private OozieClient cluster1OC = serverOC.get(0);
+ private OozieClient cluster2OC = serverOC.get(1);
+ private boolean restartRequired;
+ private String aggregateWorkflowDir = baseHDFSDir + "/PrismProcessSuspendTest/aggregator";
+ private static final Logger LOGGER = Logger.getLogger(PrismProcessSuspendTest.class);
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -56,7 +59,7 @@ public class PrismProcessSuspendTest extends BaseTestClass {
@BeforeMethod(alwaysRun = true)
public void setUp(Method method) throws Exception {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
restartRequired = false;
Bundle bundle = BundleUtil.readLateDataBundle();
for (int i = 0; i < 2; i++) {
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismSubmitTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismSubmitTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismSubmitTest.java
index b11d586..279dc56 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismSubmitTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismSubmitTest.java
@@ -40,16 +40,19 @@ import java.lang.reflect.Method;
import java.net.ConnectException;
import java.util.List;
+/**
+ * Submit tests with prism.
+ */
@Test(groups = "distributed")
public class PrismSubmitTest extends BaseTestClass {
- ColoHelper cluster1 = servers.get(0);
- ColoHelper cluster2 = servers.get(1);
- String baseTestDir = baseHDFSDir + "/PrismSubmitTest";
- String randomHDFSPath = baseTestDir + "/someRandomPath";
- String aggregateWorkflowDir = baseTestDir + "/aggregator";
- boolean restartRequired;
- private static final Logger logger = Logger.getLogger(PrismSubmitTest.class);
+ private ColoHelper cluster1 = servers.get(0);
+ private ColoHelper cluster2 = servers.get(1);
+ private String baseTestDir = baseHDFSDir + "/PrismSubmitTest";
+ private String randomHDFSPath = baseTestDir + "/someRandomPath";
+ private String aggregateWorkflowDir = baseTestDir + "/aggregator";
+ private boolean restartRequired;
+ private static final Logger LOGGER = Logger.getLogger(PrismSubmitTest.class);
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -58,7 +61,7 @@ public class PrismSubmitTest extends BaseTestClass {
@BeforeMethod(alwaysRun = true)
public void setUp(Method method) throws Exception {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
restartRequired = false;
bundles[0] = BundleUtil.readELBundle();
bundles[0] = new Bundle(bundles[0], cluster1);
@@ -77,7 +80,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_1prism1coloPrismdown() throws Exception {
+ public void submitCluster1prism1coloPrismDown() throws Exception {
restartRequired = true;
Util.shutDownService(prism.getClusterHelper());
@@ -95,14 +98,14 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_resubmitDiffContent() throws Exception {
+ public void submitClusterResubmitDiffContent() throws Exception {
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"));
List<String> beforeSubmitCluster = cluster1.getClusterHelper().getStoreInfo();
List<String> beforeSubmitPrism = cluster2.getClusterHelper().getStoreInfo();
bundles[0].setCLusterWorkingPath(bundles[0].getClusters().get(0), randomHDFSPath);
- logger.info("modified cluster Data: "
+ LOGGER.info("modified cluster Data: "
+ Util.prettyPrintXml(bundles[0].getClusters().get(0)));
r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"));
@@ -114,7 +117,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_resubmitAlreadyPARTIALWithAllUp() throws Exception {
+ public void submitClusterResubmitAlreadyPARTIALWithAllUp() throws Exception {
restartRequired = true;
Util.shutDownService(cluster1.getClusterHelper());
TimeUtil.sleepSeconds(30);
@@ -131,7 +134,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitProcess_1ColoDownAfter2FeedSubmitStartAfterProcessSubmitAnsDeleteProcess()
+ public void submitProcess1ColoDownAfter2FeedSubmitStartAfterProcessSubmitAnsDeleteProcess()
throws Exception {
restartRequired = true;
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
@@ -185,7 +188,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitProcess_ideal() throws Exception {
+ public void submitProcessIdeal() throws Exception {
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"));
@@ -228,7 +231,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_1prism1coloColoDown() throws Exception {
+ public void submitCluster1prism1coloColoDown() throws Exception {
restartRequired = true;
Util.shutDownService(cluster1.getClusterHelper());
@@ -268,7 +271,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_1prism1coloSubmitDeleted() throws Exception {
+ public void submitCluster1prism1coloSubmitDeleted() throws Exception {
prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
prism.getClusterHelper().delete(bundles[0].getClusters().get(0));
@@ -293,7 +296,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "embedded")
- public void submitProcess_woClusterSubmit() throws Exception {
+ public void submitProcessWOClusterSubmit() throws Exception {
ServiceResponse r = prism.getProcessHelper().submitEntity(bundles[0].getProcessData());
Assert.assertTrue(r.getMessage().contains("FAILED"));
@@ -301,7 +304,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "embedded")
- public void submitProcess_woFeedSubmit() throws Exception {
+ public void submitProcessWOFeedSubmit() throws Exception {
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"));
@@ -311,7 +314,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = {"prism", "0.2", "distributed"})
- public void submitCluster_resubmitAlreadyPARTIAL() throws Exception {
+ public void submitClusterResubmitAlreadyPARTIAL() throws Exception {
restartRequired = true;
bundles[1] = new Bundle(bundles[0], cluster2);
bundles[1].generateUniqueBundle();
@@ -324,7 +327,7 @@ public class PrismSubmitTest extends BaseTestClass {
Util.shutDownService(cluster1.getFeedHelper());
bundles[1].setCLusterColo(cluster2.getClusterHelper().getColoName());
- logger.info("cluster b2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0)));
+ LOGGER.info("cluster b2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0)));
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[1].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("PARTIAL"));
@@ -341,7 +344,7 @@ public class PrismSubmitTest extends BaseTestClass {
Util.restartService(cluster1.getFeedHelper());
bundles[0].setCLusterColo(cluster1.getClusterHelper().getColoName());
- logger.info("cluster b1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0)));
+ LOGGER.info("cluster b1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0)));
r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"));
@@ -356,7 +359,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_polarization() throws Exception {
+ public void submitClusterPolarization() throws Exception {
restartRequired = true;
//shutdown one colo and submit
Util.shutDownService(cluster1.getClusterHelper());
@@ -385,7 +388,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_resubmitDiffContentPARTIAL() throws Exception {
+ public void submitClusterResubmitDiffContentPARTIAL() throws Exception {
restartRequired = true;
Util.shutDownService(cluster1.getClusterHelper());
TimeUtil.sleepSeconds(30);
@@ -409,7 +412,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test
- public void submitCluster_PARTIALDeletedOfPARTIALSubmit() throws Exception {
+ public void submitClusterPARTIALDeletedOfPARTIALSubmit() throws Exception {
restartRequired = true;
Util.shutDownService(cluster1.getClusterHelper());
TimeUtil.sleepSeconds(30);
@@ -432,7 +435,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_submitPartialDeleted() throws Exception {
+ public void submitClusterSubmitPartialDeleted() throws Exception {
restartRequired = true;
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
@@ -467,7 +470,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "embedded")
- public void submitCluster_resubmitAlreadySucceeded() throws Exception {
+ public void submitClusterResubmitAlreadySucceeded() throws Exception {
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"));
@@ -483,7 +486,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "distributed")
- public void submitCluster_1prism1coloAllUp() throws Exception {
+ public void submitCluster1prism1coloAllUp() throws Exception {
List<String> beforeSubmitCluster1 = cluster1.getClusterHelper().getStoreInfo();
List<String> beforeSubmitCluster2 = cluster2.getClusterHelper().getStoreInfo();
List<String> beforeSubmitPrism = prism.getClusterHelper().getStoreInfo();
@@ -504,7 +507,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test(groups = "embedded")
- public void submitCluster_1prism1coloAlreadySubmitted() throws Exception {
+ public void submitCluster1prism1coloAlreadySubmitted() throws Exception {
prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
List<String> beforeSubmitCluster1 = cluster1.getClusterHelper().getStoreInfo();
@@ -524,7 +527,7 @@ public class PrismSubmitTest extends BaseTestClass {
}
@Test
- public void submitProcess_1ColoDownAfter1FeedSubmitStartAfter2feed() throws Exception {
+ public void submitProcess1ColoDownAfter1FeedSubmitStartAfter2feed() throws Exception {
restartRequired = true;
ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0));
Assert.assertTrue(r.getMessage().contains("SUCCEEDED"), r.getMessage());
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/ProcessPartitionExpVariableTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/ProcessPartitionExpVariableTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/ProcessPartitionExpVariableTest.java
index 1a3f82f..48459ff 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/ProcessPartitionExpVariableTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/ProcessPartitionExpVariableTest.java
@@ -47,16 +47,18 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-
+/**
+ * Tests with partitions as expression language variables.
+ */
@Test(groups = "embedded")
public class ProcessPartitionExpVariableTest extends BaseTestClass {
- private static final Logger logger = Logger.getLogger(ProcessPartitionExpVariableTest.class);
+ private static final Logger LOGGER = Logger.getLogger(ProcessPartitionExpVariableTest.class);
- ColoHelper cluster = servers.get(0);
- FileSystem clusterFS = serverFS.get(0);
- OozieClient clusterOC = serverOC.get(0);
+ private ColoHelper cluster = servers.get(0);
+ private FileSystem clusterFS = serverFS.get(0);
+ private OozieClient clusterOC = serverOC.get(0);
private String baseTestDir = baseHDFSDir + "/ProcessPartitionExpVariableTest";
- String aggregateWorkflowDir = baseTestDir + "/aggregator";
+ private String aggregateWorkflowDir = baseTestDir + "/aggregator";
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -65,7 +67,7 @@ public class ProcessPartitionExpVariableTest extends BaseTestClass {
@BeforeMethod(alwaysRun = true)
public void setUp(Method method) throws Exception {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
bundles[0] = BundleUtil.readELBundle();
bundles[0] = new Bundle(bundles[0], cluster);
bundles[0].generateUniqueBundle();
@@ -87,7 +89,7 @@ public class ProcessPartitionExpVariableTest extends BaseTestClass {
* @throws Exception
*/
@Test(enabled = true)
- public void ProcessPartitionExpVariableTest_OptionalCompulsoryPartition() throws Exception {
+ public void optionalCompulsoryPartition() throws Exception {
String startTime = TimeUtil.getTimeWrtSystemTime(-4);
String endTime = TimeUtil.getTimeWrtSystemTime(30);
@@ -100,10 +102,10 @@ public class ProcessPartitionExpVariableTest extends BaseTestClass {
bundles[0].addProcessProperty(p);
bundles[0].setProcessInputPartition("${var1}", "${fileTime}");
- for (int i = 0; i < bundles[0].getDataSets().size(); i++)
- logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i)));
-
- logger.info(Util.prettyPrintXml(bundles[0].getProcessData()));
+ for (int i = 0; i < bundles[0].getDataSets().size(); i++) {
+ LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i)));
+ }
+ LOGGER.info(Util.prettyPrintXml(bundles[0].getProcessData()));
bundles[0].submitAndScheduleBundle(prism, false);
List<String> dataDates = generateDateAndOneDayAfter(
@@ -132,8 +134,8 @@ public class ProcessPartitionExpVariableTest extends BaseTestClass {
int minuteSkip) {
final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy/MM/dd/HH/mm/");
final DateTimeFormatter formatter2 = DateTimeFormat.forPattern("yyyy-MMM-dd");
- logger.info("generating data between " + formatter.print(startDate) + " and " +
- formatter.print(endDate));
+ LOGGER.info("generating data between " + formatter.print(startDate) + " and "
+ + formatter.print(endDate));
List<String> dates = new ArrayList<String>();
while (!startDate.isAfter(endDate)) {
@@ -147,9 +149,6 @@ public class ProcessPartitionExpVariableTest extends BaseTestClass {
return dates;
}
- //TODO: ProcessPartitionExpVariableTest_OptionalPartition()
- //TODO: ProcessPartitionExpVariableTest_CompulsoryPartition()
- //TODO: ProcessPartitionExpVariableTest_moreThanOnceVariable()
@AfterClass(alwaysRun = true)
public void tearDownClass() throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
index dac4cf6..4a0c10e 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
@@ -42,12 +42,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+/**
+ * Tests with rescheduling killed process.
+ */
@Test(groups = "embedded")
public class RescheduleKilledProcessTest extends BaseTestClass {
- ColoHelper cluster = servers.get(0);
- String aggregateWorkflowDir = baseHDFSDir + "/RescheduleKilledProcessTest/aggregator";
- private static final Logger logger = Logger.getLogger(RescheduleKilledProcessTest.class);
+ private ColoHelper cluster = servers.get(0);
+ private String aggregateWorkflowDir = baseHDFSDir + "/RescheduleKilledProcessTest/aggregator";
+ private static final Logger LOGGER = Logger.getLogger(RescheduleKilledProcessTest.class);
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -56,7 +59,7 @@ public class RescheduleKilledProcessTest extends BaseTestClass {
@BeforeMethod(alwaysRun = true)
public void setUp(Method method) throws Exception {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
bundles[0] = BundleUtil.readELBundle();
bundles[0] = new Bundle(bundles[0], cluster);
bundles[0].generateUniqueBundle();
@@ -112,7 +115,7 @@ public class RescheduleKilledProcessTest extends BaseTestClass {
bundles[0].setInputFeedDataPath(baseHDFSDir + "/rawLogs" + MINUTE_DATE_PATTERN);
- logger.info("process: " + Util.prettyPrintXml(bundles[0].getProcessData()));
+ LOGGER.info("process: " + Util.prettyPrintXml(bundles[0].getProcessData()));
bundles[0].submitFeedsScheduleProcess(prism);
String processData = bundles[0].getProcessData();
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleProcessInFinalStatesTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleProcessInFinalStatesTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleProcessInFinalStatesTest.java
index e1cdab4..321fca1 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleProcessInFinalStatesTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleProcessInFinalStatesTest.java
@@ -48,19 +48,22 @@ import java.net.URISyntaxException;
import java.util.List;
+/**
+ * Tests with rescheduling process in final states.
+ */
@Test(groups = "embedded", enabled = false)
public class RescheduleProcessInFinalStatesTest extends BaseTestClass {
- ColoHelper cluster = servers.get(0);
- FileSystem clusterFS = serverFS.get(0);
- String baseTestDir = baseHDFSDir + "/RescheduleProcessInFinalStates";
- String aggregateWorkflowDir = baseTestDir + "/aggregator";
- String inputPath = baseTestDir + "/input" + MINUTE_DATE_PATTERN;
- private static final Logger logger = Logger.getLogger(RescheduleProcessInFinalStatesTest.class);
+ private ColoHelper cluster = servers.get(0);
+ private FileSystem clusterFS = serverFS.get(0);
+ private String baseTestDir = baseHDFSDir + "/RescheduleProcessInFinalStates";
+ private String aggregateWorkflowDir = baseTestDir + "/aggregator";
+ private String inputPath = baseTestDir + "/input" + MINUTE_DATE_PATTERN;
+ private static final Logger LOGGER = Logger.getLogger(RescheduleProcessInFinalStatesTest.class);
@BeforeClass(alwaysRun = true)
public void createTestData() throws Exception {
- logger.info("in @BeforeClass");
+ LOGGER.info("in @BeforeClass");
uploadDirToClusters(aggregateWorkflowDir, OSUtil.RESOURCES_OOZIE);
Bundle b = BundleUtil.readELBundle();
@@ -83,7 +86,7 @@ public class RescheduleProcessInFinalStatesTest extends BaseTestClass {
@BeforeMethod(alwaysRun = true)
public void setUp(Method method) throws Exception {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
bundles[0] = BundleUtil.readELBundle();
bundles[0] = new Bundle(bundles[0], cluster);
bundles[0].generateUniqueBundle();
@@ -190,7 +193,7 @@ public class RescheduleProcessInFinalStatesTest extends BaseTestClass {
/**
* Tries to get entity definition and checks it is absent (-get definition should return
- * process not found)
+ * process not found).
*
* @param process process entity definition
* @throws URISyntaxException
@@ -199,8 +202,8 @@ public class RescheduleProcessInFinalStatesTest extends BaseTestClass {
* @throws JAXBException
*/
private void checkNotFoundDefinition(String process)
- throws URISyntaxException, IOException, AuthenticationException, JAXBException,
- InterruptedException {
+ throws URISyntaxException, IOException, AuthenticationException, JAXBException,
+ InterruptedException {
ServiceResponse r = prism.getProcessHelper().getEntityDefinition(process);
Assert.assertTrue(r.getMessage().contains("(process) not found"));
AssertUtil.assertFailed(r);
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RetentionTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RetentionTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RetentionTest.java
index 3d471f6..8cae1e2 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RetentionTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RetentionTest.java
@@ -30,8 +30,8 @@ import org.apache.falcon.regression.core.supportClasses.JmsMessageConsumer;
import org.apache.falcon.regression.core.util.AssertUtil;
import org.apache.falcon.regression.core.util.BundleUtil;
import org.apache.falcon.regression.core.util.HadoopUtil;
+import org.apache.falcon.regression.core.util.MatrixUtil;
import org.apache.falcon.regression.core.util.OSUtil;
-import org.apache.falcon.regression.core.util.MathUtil;
import org.apache.falcon.regression.core.util.OozieUtil;
import org.apache.falcon.regression.core.util.TimeUtil;
import org.apache.falcon.regression.core.util.Util;
@@ -60,19 +60,23 @@ import java.util.Arrays;
import java.util.List;
import java.util.Random;
+/**
+ * Test with retention.
+ */
@Test(groups = "embedded")
public class RetentionTest extends BaseTestClass {
private static final String TEST_FOLDERS = "testFolders/";
- String baseTestHDFSDir = baseHDFSDir + "/RetentionTest/";
- String testHDFSDir = baseTestHDFSDir + TEST_FOLDERS;
- private static final Logger logger = Logger.getLogger(RetentionTest.class);
- ColoHelper cluster = servers.get(0);
- FileSystem clusterFS = serverFS.get(0);
- OozieClient clusterOC = serverOC.get(0);
+ private String baseTestHDFSDir = baseHDFSDir + "/RetentionTest/";
+ private String testHDFSDir = baseTestHDFSDir + TEST_FOLDERS;
+ private static final Logger LOGGER = Logger.getLogger(RetentionTest.class);
+ private ColoHelper cluster = servers.get(0);
+ private FileSystem clusterFS = serverFS.get(0);
+ private OozieClient clusterOC = serverOC.get(0);
+ private static final int[] GAPS = new int[]{2, 4, 5, 1};
@BeforeMethod(alwaysRun = true)
public void testName(Method method) throws Exception {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
Bundle bundle = BundleUtil.readRetentionBundle();
bundles[0] = new Bundle(bundle, cluster);
bundles[0].setInputFeedDataPath(testHDFSDir);
@@ -86,7 +90,7 @@ public class RetentionTest extends BaseTestClass {
}
/**
- * Particular test case for https://issues.apache.org/jira/browse/FALCON-321
+ * Particular test case for https://issues.apache.org/jira/browse/FALCON-321.
* @throws Exception
*/
@Test
@@ -136,13 +140,13 @@ public class RetentionTest extends BaseTestClass {
private void replenishData(FreqType freqType, boolean gap, boolean withData) throws Exception {
int skip = 1;
if (gap) {
- skip = gaps[new Random().nextInt(gaps.length)];
+ skip = GAPS[new Random().nextInt(GAPS.length)];
}
final DateTime today = new DateTime(DateTimeZone.UTC);
final List<DateTime> times = TimeUtil.getDatesOnEitherSide(
freqType.addTime(today, -36), freqType.addTime(today, 36), skip, freqType);
final List<String> dataDates = TimeUtil.convertDatesToString(times, freqType.getFormatter());
- logger.info("dataDates = " + dataDates);
+ LOGGER.info("dataDates = " + dataDates);
dataDates.add(HadoopUtil.SOMETHING_RANDOM);
if (withData) {
HadoopUtil.flattenAndPutDataInFolder(clusterFS, OSUtil.RESOURCES + "log_01.txt",
@@ -174,9 +178,9 @@ public class RetentionTest extends BaseTestClass {
List<String> initialData = Util.getHadoopDataFromDir(clusterFS, feed, testHDFSDir);
cluster.getFeedHelper().schedule(feed);
- logger.info(cluster.getClusterHelper().getActiveMQ());
+ LOGGER.info(cluster.getClusterHelper().getActiveMQ());
final String feedName = Util.readEntityName(feed);
- logger.info(feedName);
+ LOGGER.info(feedName);
JmsMessageConsumer messageConsumer = new JmsMessageConsumer("FALCON." + feedName,
cluster.getClusterHelper().getActiveMQ());
messageConsumer.start();
@@ -184,7 +188,7 @@ public class RetentionTest extends BaseTestClass {
String bundleId = OozieUtil.getBundles(clusterOC, feedName, EntityType.FEED).get(0);
List<String> workflows = OozieUtil.waitForRetentionWorkflowToSucceed(bundleId, clusterOC);
- logger.info("workflows: " + workflows);
+ LOGGER.info("workflows: " + workflows);
messageConsumer.interrupt();
Util.printMessageData(messageConsumer);
@@ -194,9 +198,9 @@ public class RetentionTest extends BaseTestClass {
//now see if retention value was matched to as expected
List<String> expectedOutput = filterDataOnRetention(initialData, currentTime, retentionUnit,
retentionPeriod, freqType);
- logger.info("initialData = " + initialData);
- logger.info("finalData = " + finalData);
- logger.info("expectedOutput = " + expectedOutput);
+ LOGGER.info("initialData = " + initialData);
+ LOGGER.info("finalData = " + finalData);
+ LOGGER.info("expectedOutput = " + expectedOutput);
final List<String> missingData = new ArrayList<String>(initialData);
missingData.removeAll(expectedOutput);
@@ -210,7 +214,7 @@ public class RetentionTest extends BaseTestClass {
/**
* Makes validation based on comparison of data which is expected to be removed with data
- * mentioned in messages from ActiveMQ
+ * mentioned in messages from ActiveMQ.
*
* @param feedName feed name
* @param messages messages from ActiveMQ
@@ -247,7 +251,7 @@ public class RetentionTest extends BaseTestClass {
}
/**
- * Evaluates amount of data which is expected to be retained
+ * Evaluates amount of data which is expected to be retained.
*
* @param inputData initial data on cluster
* @param currentTime current date
@@ -273,7 +277,6 @@ public class RetentionTest extends BaseTestClass {
return finalData;
}
- final static int[] gaps = new int[]{2, 4, 5, 1};
/**
* Provides different sets of parameters for retention workflow.
@@ -282,13 +285,15 @@ public class RetentionTest extends BaseTestClass {
public Object[][] getTestData(Method m) {
// a negative value like -4 should be covered in validation scenarios.
Integer[] retentionPeriods = new Integer[]{0, 10080, 60, 8, 24};
- RetentionUnit[] retentionUnits = new RetentionUnit[]{RetentionUnit.HOURS,
- RetentionUnit.DAYS};// "minutes","hours", "days",
+ RetentionUnit[] retentionUnits = new RetentionUnit[]{
+ RetentionUnit.HOURS,
+ RetentionUnit.DAYS,
+ }; // "minutes","hours", "days",
Boolean[] gaps = new Boolean[]{false, true};
FreqType[] freqTypes = new FreqType[]{FreqType.DAILY, FreqType.YEARLY, FreqType.MONTHLY};
final Boolean[] withData = new Boolean[]{true};
- return MathUtil.crossProduct(retentionPeriods, retentionUnits, gaps, freqTypes, withData);
+ return MatrixUtil.crossProduct(retentionPeriods, retentionUnits, gaps, freqTypes, withData);
}
@AfterClass(alwaysRun = true)
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/UpdateAtSpecificTimeTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/UpdateAtSpecificTimeTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/UpdateAtSpecificTimeTest.java
index a61b400..1b0a6a3 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/UpdateAtSpecificTimeTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/UpdateAtSpecificTimeTest.java
@@ -19,6 +19,7 @@
package org.apache.falcon.regression.prism;
import com.jcraft.jsch.JSchException;
+import org.apache.falcon.regression.Entities.FeedMerlin;
import org.apache.falcon.regression.core.bundle.Bundle;
import org.apache.falcon.entity.v0.EntityType;
import org.apache.falcon.entity.v0.Frequency;
@@ -58,18 +59,20 @@ import java.lang.reflect.Method;
import java.net.URISyntaxException;
import java.util.List;
-
+/**
+ * Test updating of feed with custom update time.
+ */
public class UpdateAtSpecificTimeTest extends BaseTestClass {
- private static final Logger logger = Logger.getLogger(UpdateAtSpecificTimeTest.class);
+ private static final Logger LOGGER = Logger.getLogger(UpdateAtSpecificTimeTest.class);
- Bundle processBundle;
- ColoHelper cluster1 = servers.get(0);
- ColoHelper cluster2 = servers.get(1);
- ColoHelper cluster3 = servers.get(2);
- FileSystem cluster2FS = serverFS.get(1);
+ private Bundle processBundle;
+ private ColoHelper cluster1 = servers.get(0);
+ private ColoHelper cluster2 = servers.get(1);
+ private ColoHelper cluster3 = servers.get(2);
+ private FileSystem cluster2FS = serverFS.get(1);
private final String baseTestDir = baseHDFSDir + "/UpdateAtSpecificTimeTest-data";
- String aggregateWorkflowDir = baseHDFSDir + "/aggregator";
+ private String aggregateWorkflowDir = baseHDFSDir + "/aggregator";
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -78,7 +81,7 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
@BeforeMethod(alwaysRun = true)
public void setup(Method method) throws IOException {
- logger.info("test name: " + method.getName());
+ LOGGER.info("test name: " + method.getName());
Bundle bundle = BundleUtil.readFeedReplicaltionBundle();
bundles[0] = new Bundle(bundle, cluster1);
bundles[1] = new Bundle(bundle, cluster2);
@@ -101,9 +104,9 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"singleCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void invalidChar_Process()
- throws JAXBException, IOException, URISyntaxException,
- AuthenticationException, OozieClientException, InterruptedException {
+ public void invalidCharProcess()
+ throws JAXBException, IOException, URISyntaxException,
+ AuthenticationException, OozieClientException, InterruptedException {
processBundle.setProcessValidity(TimeUtil.getTimeWrtSystemTime(0),
TimeUtil.getTimeWrtSystemTime(20));
processBundle.submitFeedsScheduleProcess(prism);
@@ -119,9 +122,9 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"singleCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void invalidChar_Feed()
- throws JAXBException, IOException, URISyntaxException, AuthenticationException,
- OozieClientException, InterruptedException {
+ public void invalidCharFeed()
+ throws JAXBException, IOException, URISyntaxException, AuthenticationException,
+ OozieClientException, InterruptedException {
String feed = submitAndScheduleFeed(processBundle);
InstanceUtil.waitTillInstancesAreCreated(cluster1, feed, 0);
@@ -135,12 +138,12 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"singleCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void updateTimeInPast_Process()
- throws JAXBException, IOException, URISyntaxException,
- OozieClientException, AuthenticationException, InterruptedException {
+ public void updateTimeInPastProcess()
+ throws JAXBException, IOException, URISyntaxException,
+ OozieClientException, AuthenticationException, InterruptedException {
processBundle.setProcessValidity(TimeUtil.getTimeWrtSystemTime(0),
- TimeUtil.getTimeWrtSystemTime(20));
+ TimeUtil.getTimeWrtSystemTime(20));
processBundle.submitFeedsScheduleProcess(prism);
//get old process details
@@ -167,14 +170,14 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"MultiCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void updateTimeInPast_Feed()
- throws JAXBException, IOException, OozieClientException,
- URISyntaxException, AuthenticationException, InterruptedException {
+ public void updateTimeInPastFeed()
+ throws JAXBException, IOException, OozieClientException,
+ URISyntaxException, AuthenticationException, InterruptedException {
- String startTimeCluster_source = TimeUtil.getTimeWrtSystemTime(-10);
- String startTimeCluster_target = TimeUtil.getTimeWrtSystemTime(10);
- String feed = getMultiClusterFeed(startTimeCluster_source, startTimeCluster_target);
- logger.info("feed: " + Util.prettyPrintXml(feed));
+ String startTimeClusterSource = TimeUtil.getTimeWrtSystemTime(-10);
+ String startTimeClusterTarget = TimeUtil.getTimeWrtSystemTime(10);
+ String feed = getMultiClusterFeed(startTimeClusterSource, startTimeClusterTarget);
+ LOGGER.info("feed: " + Util.prettyPrintXml(feed));
//submit and schedule feed
ServiceResponse r = prism.getFeedHelper().submitAndSchedule(feed);
@@ -207,9 +210,9 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"MultiCluster", "0.3.1", "distributed"}, timeOut = 1200000, enabled = true)
- public void inNextFewMinutesUpdate_RollForward_Process()
- throws JAXBException, IOException, URISyntaxException, JSchException,
- OozieClientException, SAXException, AuthenticationException, InterruptedException {
+ public void inNextFewMinutesUpdateRollForwardProcess()
+ throws JAXBException, IOException, URISyntaxException, JSchException,
+ OozieClientException, SAXException, AuthenticationException, InterruptedException {
/*
submit process on 3 clusters. Schedule on 2 clusters. Bring down one of
the scheduled cluster. Update with time 5 minutes from now. On running
@@ -240,18 +243,16 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
// save old data before update
String oldProcess = processBundle.getProcessData();
- String oldBundleID_cluster1 = InstanceUtil
+ String oldBundleIDCluster1 = InstanceUtil
.getLatestBundleID(cluster1,
Util.readEntityName(oldProcess), EntityType.PROCESS);
- String oldBundleID_cluster2 = InstanceUtil
+ String oldBundleIDCluster2 = InstanceUtil
.getLatestBundleID(cluster2,
Util.readEntityName(oldProcess), EntityType.PROCESS);
- List<String> oldNominalTimes_cluster1 = OozieUtil.getActionsNominalTime
- (cluster1,
- oldBundleID_cluster1, EntityType.PROCESS);
- List<String> oldNominalTimes_cluster2 = OozieUtil.getActionsNominalTime
- (cluster2,
- oldBundleID_cluster2, EntityType.PROCESS);
+ List<String> oldNominalTimesCluster1 = OozieUtil.getActionsNominalTime(cluster1,
+ oldBundleIDCluster1, EntityType.PROCESS);
+ List<String> oldNominalTimesCluster2 = OozieUtil.getActionsNominalTime(cluster2,
+ oldBundleIDCluster2, EntityType.PROCESS);
//update process validity
processBundle.setProcessProperty("someProp", "someValue");
@@ -265,55 +266,55 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
//verify new bundle on cluster1 and definition on cluster3
OozieUtil
- .verifyNewBundleCreation(cluster1, oldBundleID_cluster1, oldNominalTimes_cluster1,
+ .verifyNewBundleCreation(cluster1, oldBundleIDCluster1, oldNominalTimesCluster1,
oldProcess, true, false);
- OozieUtil.verifyNewBundleCreation(cluster2, oldBundleID_cluster2,
- oldNominalTimes_cluster2,
+ OozieUtil.verifyNewBundleCreation(cluster2, oldBundleIDCluster2,
+ oldNominalTimesCluster2,
oldProcess, false, false);
- String definition_cluster_3 = Util.getEntityDefinition(cluster3,
+ String definitionCluster3 = Util.getEntityDefinition(cluster3,
processBundle.getProcessData(), true);
- Assert.assertTrue(XmlUtil.isIdentical(definition_cluster_3,
+ Assert.assertTrue(XmlUtil.isIdentical(definitionCluster3,
processBundle.getProcessData()), "Process definitions should be equal");
//start the stopped cluster2
Util.startService(cluster2.getProcessHelper());
TimeUtil.sleepSeconds(40);
- String newBundleID_cluster1 = InstanceUtil.getLatestBundleID(cluster1,
+ String newBundleIdCluster1 = InstanceUtil.getLatestBundleID(cluster1,
Util.readEntityName(oldProcess), EntityType.PROCESS);
//send second update request
r = prism.getProcessHelper().update(oldProcess, processBundle.getProcessData(),
updateTime, null);
AssertUtil.assertSucceeded(r);
- String def_cluster_2 = Util.getEntityDefinition(cluster2,
+ String defCluster2 = Util.getEntityDefinition(cluster2,
processBundle.getProcessData(), true);
- logger.info("def_cluster_2 : " + Util.prettyPrintXml(def_cluster_2));
+ LOGGER.info("defCluster2 : " + Util.prettyPrintXml(defCluster2));
// verify new bundle in cluster2 and no new bundle in cluster1 and
- OozieUtil.verifyNewBundleCreation(cluster1, newBundleID_cluster1,
- oldNominalTimes_cluster1, oldProcess, false, false);
- OozieUtil.verifyNewBundleCreation(cluster2, oldBundleID_cluster2,
- oldNominalTimes_cluster2, oldProcess, true, false);
+ OozieUtil.verifyNewBundleCreation(cluster1, newBundleIdCluster1,
+ oldNominalTimesCluster1, oldProcess, false, false);
+ OozieUtil.verifyNewBundleCreation(cluster2, oldBundleIDCluster2,
+ oldNominalTimesCluster2, oldProcess, true, false);
//wait till update time is reached
TimeUtil.sleepTill(updateTime);
- OozieUtil.verifyNewBundleCreation(cluster2, oldBundleID_cluster2,
- oldNominalTimes_cluster2, oldProcess, true, true);
- OozieUtil.verifyNewBundleCreation(cluster1, oldBundleID_cluster1,
- oldNominalTimes_cluster1, oldProcess, true, true);
+ OozieUtil.verifyNewBundleCreation(cluster2, oldBundleIDCluster2,
+ oldNominalTimesCluster2, oldProcess, true, true);
+ OozieUtil.verifyNewBundleCreation(cluster1, oldBundleIDCluster1,
+ oldNominalTimesCluster1, oldProcess, true, true);
} finally {
Util.restartService(cluster2.getProcessHelper());
}
}
@Test(groups = {"MultiCluster", "0.3.1", "distributed"}, timeOut = 1200000, enabled = true)
- public void inNextFewMinutesUpdate_RollForward_Feed()
- throws JAXBException, IOException, URISyntaxException, JSchException,
- OozieClientException, SAXException, AuthenticationException, InterruptedException {
+ public void inNextFewMinutesUpdateRollForwardFeed()
+ throws JAXBException, IOException, URISyntaxException, JSchException,
+ OozieClientException, SAXException, AuthenticationException, InterruptedException {
try {
- String startTimeCluster_source = TimeUtil.getTimeWrtSystemTime(-18);
- String feed = getMultiClusterFeed(startTimeCluster_source, startTimeCluster_source);
- logger.info("feed: " + Util.prettyPrintXml(feed));
+ String startTimeClusterSource = TimeUtil.getTimeWrtSystemTime(-18);
+ String feed = getMultiClusterFeed(startTimeClusterSource, startTimeClusterSource);
+ LOGGER.info("feed: " + Util.prettyPrintXml(feed));
//submit feed on all 3 clusters
ServiceResponse r = prism.getFeedHelper().submitEntity(feed);
@@ -333,10 +334,10 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
String updatedFeed = Util.setFeedProperty(feed, "someProp", "someVal");
//save old data
- String oldBundle_cluster1 = InstanceUtil.getLatestBundleID(cluster1,
+ String oldBundleCluster1 = InstanceUtil.getLatestBundleID(cluster1,
Util.readEntityName(feed), EntityType.FEED);
- List<String> oldNominalTimes_cluster1 = OozieUtil.getActionsNominalTime
- (cluster1, oldBundle_cluster1, EntityType.FEED);
+ List<String> oldNominalTimesCluster1 = OozieUtil.getActionsNominalTime(cluster1,
+ oldBundleCluster1, EntityType.FEED);
//send update command with +5 mins in future
String updateTime = TimeUtil.getTimeWrtSystemTime(5);
@@ -344,15 +345,15 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
AssertUtil.assertPartial(r);
//verify new bundle creation on cluster1 and new definition on cluster3
- OozieUtil.verifyNewBundleCreation(cluster1, oldBundle_cluster1,
- oldNominalTimes_cluster1, feed, true, false);
+ OozieUtil.verifyNewBundleCreation(cluster1, oldBundleCluster1,
+ oldNominalTimesCluster1, feed, true, false);
String definition = Util.getEntityDefinition(cluster3, feed, true);
Diff diff = XMLUnit.compareXML(definition, processBundle.getProcessData());
- logger.info(diff);
+ LOGGER.info(diff);
//start stopped cluster2
Util.startService(cluster2.getProcessHelper());
- String newBundle_cluster1 = InstanceUtil.getLatestBundleID(cluster1,
+ String newBundleCluster1 = InstanceUtil.getLatestBundleID(cluster1,
Util.readEntityName(feed), EntityType.FEED);
//send update again
@@ -363,27 +364,27 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
Assert.assertEquals(InstanceUtil
.checkIfFeedCoordExist(cluster2.getFeedHelper(), Util.readEntityName(feed),
"RETENTION"), 2);
- OozieUtil.verifyNewBundleCreation(cluster1, newBundle_cluster1,
- oldNominalTimes_cluster1, feed, false, false);
+ OozieUtil.verifyNewBundleCreation(cluster1, newBundleCluster1,
+ oldNominalTimesCluster1, feed, false, false);
//wait till update time is reached
TimeUtil.sleepTill(TimeUtil.getTimeWrtSystemTime(5));
//verify new bundle creation with instance matching
- OozieUtil.verifyNewBundleCreation(cluster1, oldBundle_cluster1,
- oldNominalTimes_cluster1, feed, true, true);
+ OozieUtil.verifyNewBundleCreation(cluster1, oldBundleCluster1,
+ oldNominalTimesCluster1, feed, true, true);
} finally {
Util.restartService(cluster2.getProcessHelper());
}
}
@Test(groups = {"multiCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void updateTimeAfterEndTime_Process()
+ public void updateTimeAfterEndTimeProcess()
throws JAXBException, InterruptedException, IOException, URISyntaxException,
OozieClientException, AuthenticationException {
/* submit and schedule process with end time after 60 mins. Set update time
as with +60 from start mins */
- logger.info("Running test updateTimeAfterEndTime_Process");
+ LOGGER.info("Running test updateTimeAfterEndTimeProcess");
String startTime = TimeUtil.getTimeWrtSystemTime(-15);
String endTime = TimeUtil.getTimeWrtSystemTime(60);
processBundle.setProcessValidity(startTime, endTime);
@@ -404,9 +405,9 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
//update
processBundle.setProcessProperty("someProp", "someVal");
String updateTime = TimeUtil.addMinsToTime(endTime, 60);
- logger.info("Original Feed : " + Util.prettyPrintXml(oldProcess));
- logger.info("Updated Feed :" + Util.prettyPrintXml(processBundle.getProcessData()));
- logger.info("Update Time : " + updateTime);
+ LOGGER.info("Original Feed : " + Util.prettyPrintXml(oldProcess));
+ LOGGER.info("Updated Feed :" + Util.prettyPrintXml(processBundle.getProcessData()));
+ LOGGER.info("Update Time : " + updateTime);
ServiceResponse r = prism.getProcessHelper().update(oldProcess,
processBundle.getProcessData(), updateTime, null);
AssertUtil.assertSucceeded(r);
@@ -420,23 +421,23 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"multiCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void updateTimeAfterEndTime_Feed()
- throws JAXBException, IOException, OozieClientException,
- URISyntaxException, AuthenticationException, InterruptedException {
+ public void updateTimeAfterEndTimeFeed()
+ throws JAXBException, IOException, OozieClientException,
+ URISyntaxException, AuthenticationException, InterruptedException {
/* submit and schedule feed with end time 60 mins in future and update with +60 in future*/
String startTime = TimeUtil.getTimeWrtSystemTime(-15);
String endTime = TimeUtil.getTimeWrtSystemTime(60);
String feed = processBundle.getDataSets().get(0);
- feed = InstanceUtil.setFeedCluster(feed,
- XmlUtil.createValidity("2012-10-01T12:00Z", "2010-01-01T00:00Z"),
- XmlUtil.createRetention("days(100000)", ActionType.DELETE), null,
- ClusterType.SOURCE, null);
- feed = InstanceUtil.setFeedCluster(feed, XmlUtil.createValidity(startTime, endTime),
- XmlUtil.createRetention("days(100000)", ActionType.DELETE),
- Util.readEntityName(processBundle.getClusters().get(0)), ClusterType.SOURCE,
- null, baseTestDir + "/replication" + MINUTE_DATE_PATTERN);
+ feed = FeedMerlin.fromString(feed).clearFeedClusters().toString();
+ feed = FeedMerlin.fromString(feed).addFeedCluster(new FeedMerlin.FeedClusterBuilder(
+ Util.readEntityName(processBundle.getClusters().get(0)))
+ .withRetention("days(100000)", ActionType.DELETE)
+ .withValidity(startTime, endTime)
+ .withClusterType(ClusterType.SOURCE)
+ .withDataLocation(baseTestDir + "/replication" + MINUTE_DATE_PATTERN)
+ .build()).toString();
ServiceResponse r = prism.getClusterHelper().submitEntity(
processBundle.getClusters().get(0));
@@ -450,9 +451,9 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
Util.readEntityName(feed), EntityType.FEED);
String updateTime = TimeUtil.addMinsToTime(endTime, 60);
String updatedFeed = Util.setFeedProperty(feed, "someProp", "someVal");
- logger.info("Original Feed : " + Util.prettyPrintXml(feed));
- logger.info("Updated Feed :" + Util.prettyPrintXml(updatedFeed));
- logger.info("Update Time : " + updateTime);
+ LOGGER.info("Original Feed : " + Util.prettyPrintXml(feed));
+ LOGGER.info("Updated Feed :" + Util.prettyPrintXml(updatedFeed));
+ LOGGER.info("Update Time : " + updateTime);
r = prism.getFeedHelper().update(feed, updatedFeed, updateTime, null);
AssertUtil.assertSucceeded(r);
InstanceUtil.waitTillInstancesAreCreated(cluster1, feed, 1);
@@ -462,9 +463,9 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"multiCluster", "0.3.1", "embedded"}, timeOut = 1200000, enabled = true)
- public void updateTimeBeforeStartTime_Process() throws JAXBException, IOException,
- URISyntaxException, OozieClientException, AuthenticationException,
- InterruptedException {
+ public void updateTimeBeforeStartTimeProcess() throws JAXBException, IOException,
+ URISyntaxException, OozieClientException, AuthenticationException,
+ InterruptedException {
/* submit and schedule process with start time +10 mins from now. Update with start time
-4 and update time +2 mins */
@@ -492,24 +493,24 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
}
@Test(groups = {"MultiCluster", "0.3.1"}, timeOut = 1200000, enabled = true)
- public void updateDiffClusterDiffValidity_Process()
- throws JAXBException, IOException, URISyntaxException, OozieClientException,
- AuthenticationException, InterruptedException {
+ public void updateDiffClusterDiffValidityProcess()
+ throws JAXBException, IOException, URISyntaxException, OozieClientException,
+ AuthenticationException, InterruptedException {
//set start end process time for 3 clusters
- String startTime_cluster1 = TimeUtil.getTimeWrtSystemTime(-40);
- String endTime_cluster1 = TimeUtil.getTimeWrtSystemTime(3);
- String startTime_cluster2 = TimeUtil.getTimeWrtSystemTime(120);
- String endTime_cluster2 = TimeUtil.getTimeWrtSystemTime(240);
- String startTime_cluster3 = TimeUtil.getTimeWrtSystemTime(-30);
- String endTime_cluster3 = TimeUtil.getTimeWrtSystemTime(180);
+ String startTimeCluster1 = TimeUtil.getTimeWrtSystemTime(-40);
+ String endTimeCluster1 = TimeUtil.getTimeWrtSystemTime(3);
+ String startTimeCluster2 = TimeUtil.getTimeWrtSystemTime(120);
+ String endTimeCluster2 = TimeUtil.getTimeWrtSystemTime(240);
+ String startTimeCluster3 = TimeUtil.getTimeWrtSystemTime(-30);
+ String endTimeCluster3 = TimeUtil.getTimeWrtSystemTime(180);
//create multi cluster bundle
- processBundle.setProcessValidity(startTime_cluster1, endTime_cluster1);
+ processBundle.setProcessValidity(startTimeCluster1, endTimeCluster1);
processBundle.addClusterToBundle(bundles[1].getClusters().get(0),
- ClusterType.SOURCE, startTime_cluster2, endTime_cluster2);
+ ClusterType.SOURCE, startTimeCluster2, endTimeCluster2);
processBundle.addClusterToBundle(bundles[2].getClusters().get(0),
- ClusterType.SOURCE, startTime_cluster3, endTime_cluster3);
+ ClusterType.SOURCE, startTimeCluster3, endTimeCluster3);
//submit and schedule
processBundle.submitFeedsScheduleProcess(prism);
@@ -519,71 +520,73 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
InstanceUtil.waitTillInstancesAreCreated(cluster3, processBundle.getProcessData(), 0);
//save old info
- String oldBundleID_cluster1 = InstanceUtil.getLatestBundleID(cluster1,
+ String oldBundleIdCluster1 = InstanceUtil.getLatestBundleID(cluster1,
Util.readEntityName(processBundle.getProcessData()), EntityType.PROCESS);
- List<String> nominalTimes_cluster1 = OozieUtil.getActionsNominalTime(cluster1,
- oldBundleID_cluster1, EntityType.PROCESS);
- String oldBundleID_cluster2 = InstanceUtil.getLatestBundleID(cluster2,
+ List<String> nominalTimesCluster1 = OozieUtil.getActionsNominalTime(cluster1,
+ oldBundleIdCluster1, EntityType.PROCESS);
+ String oldBundleIdCluster2 = InstanceUtil.getLatestBundleID(cluster2,
Util.readEntityName(processBundle.getProcessData()), EntityType.PROCESS);
- String oldBundleID_cluster3 = InstanceUtil.getLatestBundleID(cluster3,
+ String oldBundleIdCluster3 = InstanceUtil.getLatestBundleID(cluster3,
Util.readEntityName(processBundle.getProcessData()), EntityType.PROCESS);
- List<String> nominalTimes_cluster3 = OozieUtil.getActionsNominalTime(cluster3,
- oldBundleID_cluster3, EntityType.PROCESS);
+ List<String> nominalTimesCluster3 = OozieUtil.getActionsNominalTime(cluster3,
+ oldBundleIdCluster3, EntityType.PROCESS);
//update process
- String updateTime = TimeUtil.addMinsToTime(endTime_cluster1, 3);
+ String updateTime = TimeUtil.addMinsToTime(endTimeCluster1, 3);
processBundle.setProcessProperty("someProp", "someVal");
ServiceResponse r = prism.getProcessHelper().update(processBundle.getProcessData(),
processBundle.getProcessData(), updateTime, null);
AssertUtil.assertSucceeded(r);
//check for new bundle to be created
- OozieUtil.verifyNewBundleCreation(cluster1, oldBundleID_cluster1,
- nominalTimes_cluster1, processBundle.getProcessData(), true, false);
- OozieUtil.verifyNewBundleCreation(cluster3, oldBundleID_cluster3,
- nominalTimes_cluster3, processBundle.getProcessData(), true, false);
- OozieUtil.verifyNewBundleCreation(cluster2, oldBundleID_cluster2,
- nominalTimes_cluster3, processBundle.getProcessData(), true, false);
+ OozieUtil.verifyNewBundleCreation(cluster1, oldBundleIdCluster1,
+ nominalTimesCluster1, processBundle.getProcessData(), true, false);
+ OozieUtil.verifyNewBundleCreation(cluster3, oldBundleIdCluster3,
+ nominalTimesCluster3, processBundle.getProcessData(), true, false);
+ OozieUtil.verifyNewBundleCreation(cluster2, oldBundleIdCluster2,
+ nominalTimesCluster3, processBundle.getProcessData(), true, false);
//wait till new coord are running on cluster1
InstanceUtil.waitTillInstancesAreCreated(cluster1, processBundle.getProcessData(), 1);
- OozieUtil.verifyNewBundleCreation(cluster1, oldBundleID_cluster1,
- nominalTimes_cluster1, processBundle.getProcessData(), true, true);
+ OozieUtil.verifyNewBundleCreation(cluster1, oldBundleIdCluster1,
+ nominalTimesCluster1, processBundle.getProcessData(), true, true);
//verify
- String coordStartTime_cluster3 = OozieUtil.getCoordStartTime(cluster3,
+ String coordStartTimeCluster3 = OozieUtil.getCoordStartTime(cluster3,
processBundle.getProcessData(), 1);
- String coordStartTime_cluster2 = OozieUtil.getCoordStartTime(cluster2,
+ String coordStartTimeCluster2 = OozieUtil.getCoordStartTime(cluster2,
processBundle.getProcessData(), 1);
DateTime updateTimeOozie = TimeUtil.oozieDateToDate(updateTime);
- Assert.assertTrue(TimeUtil.oozieDateToDate(coordStartTime_cluster3).isAfter(updateTimeOozie)
- || TimeUtil.oozieDateToDate(coordStartTime_cluster3).isEqual(updateTimeOozie),
+ Assert.assertTrue(TimeUtil.oozieDateToDate(coordStartTimeCluster3).isAfter(updateTimeOozie)
+ || TimeUtil.oozieDateToDate(coordStartTimeCluster3).isEqual(updateTimeOozie),
"new coord start time is not correct");
Assert.assertFalse(
- TimeUtil.oozieDateToDate(coordStartTime_cluster2).isEqual(updateTimeOozie),
+ TimeUtil.oozieDateToDate(coordStartTimeCluster2).isEqual(updateTimeOozie),
"new coord start time is not correct");
TimeUtil.sleepTill(updateTime);
InstanceUtil.waitTillInstancesAreCreated(cluster3, processBundle.getProcessData(), 1);
//verify that no instance are missing
- OozieUtil.verifyNewBundleCreation(cluster3, oldBundleID_cluster3,
- nominalTimes_cluster3, processBundle.getProcessData(), true, true);
+ OozieUtil.verifyNewBundleCreation(cluster3, oldBundleIdCluster3,
+ nominalTimesCluster3, processBundle.getProcessData(), true, true);
}
private String submitAndScheduleFeed(Bundle b)
- throws JAXBException, IOException, URISyntaxException, AuthenticationException,
- InterruptedException {
+ throws JAXBException, IOException, URISyntaxException, AuthenticationException,
+ InterruptedException {
String feed = b.getDataSets().get(0);
- feed = InstanceUtil.setFeedCluster(feed,
- XmlUtil.createValidity("2012-10-01T12:00Z", "2010-01-01T00:00Z"),
- XmlUtil.createRetention("days(1000000)", ActionType.DELETE), null,
- ClusterType.SOURCE, null);
- feed = InstanceUtil.setFeedCluster(feed, XmlUtil.createValidity
- ("2012-10-01T12:10Z", "2099-10-01T12:10Z"),
- XmlUtil.createRetention("days(1000000)", ActionType.DELETE),
- Util.readEntityName(b.getClusters().get(0)), ClusterType.SOURCE, "",
- "/someTestPath" + MINUTE_DATE_PATTERN);
+ feed = FeedMerlin.fromString(feed).clearFeedClusters().toString();
+ feed = FeedMerlin.fromString(feed)
+ .addFeedCluster(
+ new FeedMerlin.FeedClusterBuilder(Util.readEntityName(b.getClusters().get(0)))
+ .withRetention("days(1000000)", ActionType.DELETE)
+ .withValidity("2012-10-01T12:10Z", "2099-10-01T12:10Z")
+ .withClusterType(ClusterType.SOURCE)
+ .withPartition("")
+ .withDataLocation("/someTestPath" + MINUTE_DATE_PATTERN)
+ .build())
+ .toString();
ServiceResponse r = prism.getClusterHelper().submitEntity(
b.getClusters().get(0));
AssertUtil.assertSucceeded(r);
@@ -592,39 +595,43 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
return feed;
}
- private String getMultiClusterFeed(String startTimeCluster_source,
- String startTimeCluster_target)
- throws IOException, URISyntaxException, AuthenticationException, InterruptedException {
+ private String getMultiClusterFeed(String startTimeClusterSource, String startTimeClusterTarget)
+ throws IOException, URISyntaxException, AuthenticationException, InterruptedException {
String testDataDir = baseTestDir + "/replication";
//create desired feed
String feed = bundles[0].getDataSets().get(0);
//cluster1 is target, cluster2 is source and cluster3 is neutral
- feed = InstanceUtil.setFeedCluster(feed,
- XmlUtil.createValidity("2012-10-01T12:00Z", "2010-01-01T00:00Z"),
- XmlUtil.createRetention("days(100000)", ActionType.DELETE), null,
- ClusterType.SOURCE, null);
- feed = InstanceUtil.setFeedCluster(feed,
- XmlUtil.createValidity(startTimeCluster_source, "2099-10-01T12:10Z"),
- XmlUtil.createRetention("days(100000)", ActionType.DELETE),
- Util.readEntityName(bundles[2].getClusters().get(0)), null, null);
- feed = InstanceUtil.setFeedCluster(feed,
- XmlUtil.createValidity(startTimeCluster_target, "2099-10-01T12:25Z"),
- XmlUtil.createRetention("days(100000)", ActionType.DELETE),
- Util.readEntityName(bundles[0].getClusters().get(0)), ClusterType.TARGET,
- null, testDataDir + MINUTE_DATE_PATTERN);
- feed = InstanceUtil.setFeedCluster(feed,
- XmlUtil.createValidity(startTimeCluster_source, "2099-01-01T00:00Z"),
- XmlUtil.createRetention("days(100000)", ActionType.DELETE),
- Util.readEntityName(bundles[1].getClusters().get(0)), ClusterType.SOURCE,
- null, testDataDir + MINUTE_DATE_PATTERN);
+ feed = FeedMerlin.fromString(feed).clearFeedClusters().toString();
+ feed = FeedMerlin.fromString(feed).addFeedCluster(
+ new FeedMerlin.FeedClusterBuilder(Util.readEntityName(bundles[2].getClusters().get(0)))
+ .withRetention("days(100000)", ActionType.DELETE)
+ .withValidity(startTimeClusterSource, "2099-10-01T12:10Z")
+ .build())
+ .toString();
+ feed = FeedMerlin.fromString(feed).addFeedCluster(
+ new FeedMerlin.FeedClusterBuilder(Util.readEntityName(bundles[0].getClusters().get(0)))
+ .withRetention("days(100000)", ActionType.DELETE)
+ .withValidity(startTimeClusterTarget, "2099-10-01T12:25Z")
+ .withClusterType(ClusterType.TARGET)
+ .withDataLocation(testDataDir + MINUTE_DATE_PATTERN)
+ .build())
+ .toString();
+ feed = FeedMerlin.fromString(feed).addFeedCluster(
+ new FeedMerlin.FeedClusterBuilder(Util.readEntityName(bundles[1].getClusters().get(0)))
+ .withRetention("days(100000)", ActionType.DELETE)
+ .withValidity(startTimeClusterSource, "2099-01-01T00:00Z")
+ .withClusterType(ClusterType.SOURCE)
+ .withDataLocation(testDataDir + MINUTE_DATE_PATTERN)
+ .build())
+ .toString();
//submit clusters
Bundle.submitCluster(bundles[0], bundles[1], bundles[2]);
//create test data on cluster2
- List<String> dataDates = TimeUtil.getMinuteDatesOnEitherSide(startTimeCluster_source,
+ List<String> dataDates = TimeUtil.getMinuteDatesOnEitherSide(startTimeClusterSource,
TimeUtil.getTimeWrtSystemTime(60), 1);
HadoopUtil.flattenAndPutDataInFolder(cluster2FS, OSUtil.SINGLE_FILE,
testDataDir + "/", dataDates);
@@ -633,7 +640,7 @@ public class UpdateAtSpecificTimeTest extends BaseTestClass {
@AfterMethod(alwaysRun = true)
public void tearDown(Method method) {
- logger.info("tearDown " + method.getName());
+ LOGGER.info("tearDown " + method.getName());
processBundle.deleteBundle(prism);
bundles[0].deleteBundle(prism);
processBundle.deleteBundle(prism);
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/AclValidationTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/AclValidationTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/AclValidationTest.java
index 6e1855b..0a638e4 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/AclValidationTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/AclValidationTest.java
@@ -7,14 +7,13 @@
* "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
+ * 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.
+ * 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.falcon.regression.security;
@@ -45,7 +44,7 @@ import java.io.IOException;
import java.lang.reflect.Method;
/**
- * Tests if ACL info is consistent with user submitting the entity
+ * Tests if ACL info is consistent with user submitting the entity.
*/
@Test(groups = "authorization")
public class AclValidationTest extends BaseTestClass {
@@ -57,9 +56,9 @@ public class AclValidationTest extends BaseTestClass {
private String aggregateWorkflowDir = baseTestDir + "/aggregator";
private String feedInputPath = baseTestDir + "/input" + MINUTE_DATE_PATTERN;
- ClusterMerlin clusterMerlin;
- FeedMerlin feedMerlin;
- ProcessMerlin processMerlin;
+ private ClusterMerlin clusterMerlin;
+ private FeedMerlin feedMerlin;
+ private ProcessMerlin processMerlin;
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -80,14 +79,14 @@ public class AclValidationTest extends BaseTestClass {
}
/**
- * Test a cluster's acl validations for different aclOwner and aclGroup
+ * Test a cluster's acl validations for different aclOwner and aclGroup.
* @param aclOwner owner for the acl
* @param aclGroup group for the acl
* @throws Exception
*/
@Test(dataProvider = "generateUserAndGroup")
public void submitClusterBadAcl(String aclOwner, String aclGroup) throws Exception {
- clusterMerlin.setACL(aclOwner,aclGroup, "*");
+ clusterMerlin.setACL(aclOwner, aclGroup, "*");
final ServiceResponse serviceResponse =
prism.getClusterHelper().submitEntity(clusterMerlin.toString());
AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST,
@@ -95,7 +94,7 @@ public class AclValidationTest extends BaseTestClass {
}
/**
- * Test a feed's acl validations for different aclOwner and aclGroup
+ * Test a feed's acl validations for different aclOwner and aclGroup.
* @param aclOwner owner for the acl
* @param aclGroup group for the acl
* @throws Exception
@@ -111,7 +110,7 @@ public class AclValidationTest extends BaseTestClass {
}
/**
- * Test a process's acl validations for different aclOwner and aclGroup
+ * Test a process's acl validations for different aclOwner and aclGroup.
* @param aclOwner owner for the acl
* @param aclGroup group for the acl
* @throws Exception
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/ClusterAclTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/ClusterAclTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/ClusterAclTest.java
index cc6da00..7b561e5 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/ClusterAclTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/ClusterAclTest.java
@@ -7,14 +7,13 @@
* "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
+ * 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.
+ * 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.falcon.regression.security;
@@ -27,8 +26,7 @@ import org.apache.falcon.regression.core.response.ServiceResponse;
import org.apache.falcon.regression.core.util.AssertUtil;
import org.apache.falcon.regression.core.util.BundleUtil;
import org.apache.falcon.regression.core.util.HadoopUtil;
-import org.apache.falcon.regression.core.util.KerberosHelper;
-import org.apache.falcon.regression.core.util.MathUtil;
+import org.apache.falcon.regression.core.util.MatrixUtil;
import org.apache.falcon.regression.core.util.OSUtil;
import org.apache.falcon.regression.testHelper.BaseTestClass;
import org.apache.hadoop.fs.FileSystem;
@@ -43,7 +41,9 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.lang.reflect.Method;
-
+/**
+ * Tests ACL of cluster with different operations.
+ */
@Test(groups = "authorization")
public class ClusterAclTest extends BaseTestClass {
private static final Logger LOGGER = Logger.getLogger(ClusterAclTest.class);
@@ -75,7 +75,7 @@ public class ClusterAclTest extends BaseTestClass {
}
/**
- * Test cluster read operations by different users
+ * Test cluster read operations by different users.
* @param user the user that would perform operation
* @param op the operation that user would perform
* @param isAllowed is the user allowed that operation
@@ -87,30 +87,37 @@ public class ClusterAclTest extends BaseTestClass {
bundles[0].submitClusters(prism);
bundles[0].submitFeeds(prism);
final boolean executeRes = op.executeAs(user, clusterHelper, clusterString);
- Assert.assertEquals(executeRes, isAllowed, "Unexpected result user " + user + " " +
- "performing: " + op);
+ Assert.assertEquals(executeRes, isAllowed, "Unexpected result user " + user
+ + " performing: " + op);
}
@DataProvider(name = "generateUserReadOpsPermissions")
public Object[][] generateUserReadOpsPermissions() {
- final Object[][] allowedCombinations = MathUtil.crossProduct(
- new String[]{MerlinConstants.FALCON_SUPER_USER_NAME, MerlinConstants.FALCON_SUPER_USER2_NAME,
- MerlinConstants.USER2_NAME},
- new EntityOp[]{EntityOp.dependency, EntityOp.listing, EntityOp.definition},
+ final Object[][] allowedCombinations = MatrixUtil.crossProduct(
+ new String[]{
+ MerlinConstants.FALCON_SUPER_USER_NAME,
+ MerlinConstants.FALCON_SUPER_USER2_NAME,
+ MerlinConstants.USER2_NAME,
+ },
+ new EntityOp[]{
+ EntityOp.dependency,
+ EntityOp.listing,
+ EntityOp.definition,
+ },
new Boolean[]{true}
);
- final Object[][] notAllowedCombinations = MathUtil.crossProduct(
+ final Object[][] notAllowedCombinations = MatrixUtil.crossProduct(
new String[]{MerlinConstants.DIFFERENT_USER_NAME},
new EntityOp[]{EntityOp.dependency, EntityOp.listing, EntityOp.definition},
new Boolean[]{false}
);
- return MathUtil.append(allowedCombinations, notAllowedCombinations);
+ return MatrixUtil.append(allowedCombinations, notAllowedCombinations);
}
/**
- * Test cluster deletion by different users
+ * Test cluster deletion by different users.
* @param deleteUser the user that would attempt to delete
* @param deleteAllowed is delete expected to go through
* @throws Exception
@@ -120,7 +127,7 @@ public class ClusterAclTest extends BaseTestClass {
throws Exception {
bundles[0].submitClusters(prism);
final ServiceResponse response = clusterHelper.delete(clusterString, deleteUser);
- if(deleteAllowed) {
+ if (deleteAllowed) {
AssertUtil.assertSucceeded(response);
} else {
AssertUtil.assertFailedWith403(response);
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/EntityOp.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/EntityOp.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/EntityOp.java
index 5ea6266..334b51a 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/EntityOp.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/EntityOp.java
@@ -7,24 +7,21 @@
* "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
+ * 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.
+ * 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.falcon.regression.security;
-import org.apache.falcon.regression.core.enumsAndConstants.MerlinConstants;
import org.apache.falcon.regression.core.interfaces.IEntityManagerHelper;
import org.apache.falcon.regression.core.response.ServiceResponse;
import org.apache.falcon.regression.core.util.AssertUtil;
import org.apache.falcon.regression.core.util.CleanupUtil;
-import org.apache.falcon.regression.core.util.KerberosHelper;
import org.apache.falcon.regression.core.util.Util;
import org.apache.hadoop.security.authentication.client.AuthenticationException;
import org.apache.log4j.Logger;
@@ -285,8 +282,7 @@ enum EntityOp {
}
return AssertUtil.checkSucceeded(response);
}
- },
- ;
+ };
private static Logger logger = Logger.getLogger(EntityOp.class);
public abstract boolean executeAs(String user, IEntityManagerHelper helper, String data);
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/FalconClientTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/FalconClientTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/FalconClientTest.java
index a716e56..1b5750a 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/FalconClientTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/security/FalconClientTest.java
@@ -7,14 +7,13 @@
* "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
+ * 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.
+ * 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.falcon.regression.security;
@@ -26,7 +25,6 @@ import org.apache.falcon.regression.core.supportClasses.ExecResult;
import org.apache.falcon.regression.core.util.AssertUtil;
import org.apache.falcon.regression.core.util.BundleUtil;
import org.apache.falcon.regression.core.util.HadoopUtil;
-import org.apache.falcon.regression.core.util.KerberosHelper;
import org.apache.falcon.regression.core.util.OSUtil;
import org.apache.falcon.regression.testHelper.BaseTestClass;
import org.apache.hadoop.fs.FileSystem;
@@ -40,15 +38,18 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.lang.reflect.Method;
+/**
+ * Tests falcon client's working in presence of ACL errors.
+ */
@Test(groups = "authorization")
public class FalconClientTest extends BaseTestClass {
private static final Logger LOGGER = Logger.getLogger(AclValidationTest.class);
- private ColoHelper cluster = servers.get(0);
- private FileSystem clusterFS = serverFS.get(0);
- private String baseTestDir = baseHDFSDir + "/AuthorizationTest";
- private String aggregateWorkflowDir = baseTestDir + "/aggregator";
- private String feedInputPath = baseTestDir + "/input" + MINUTE_DATE_PATTERN;
+ private final ColoHelper cluster = servers.get(0);
+ private final FileSystem clusterFS = serverFS.get(0);
+ private final String baseTestDir = baseHDFSDir + "/AuthorizationTest";
+ private final String aggregateWorkflowDir = baseTestDir + "/aggregator";
+ private final String feedInputPath = baseTestDir + "/input" + MINUTE_DATE_PATTERN;
@BeforeClass(alwaysRun = true)
public void uploadWorkflow() throws Exception {
@@ -66,29 +67,29 @@ public class FalconClientTest extends BaseTestClass {
}
/**
- * Test error thrown by falcon client, when acl of the submitted cluster has bad values
+ * Test error thrown by falcon client, when acl of the submitted cluster has bad values.
* @throws Exception
*/
@Test (enabled = false)
public void badClusterSubmit() throws Exception {
bundles[0].setCLusterACL(MerlinConstants.DIFFERENT_USER_NAME,
- MerlinConstants.CURRENT_USER_GROUP, "*");
- final String cluster = bundles[0].getClusters().get(0);
- final ExecResult execResult = prism.getClusterHelper().clientSubmit(cluster);
+ MerlinConstants.CURRENT_USER_GROUP, "*");
+ final String clusterXml = bundles[0].getClusters().get(0);
+ final ExecResult execResult = prism.getClusterHelper().clientSubmit(clusterXml);
AssertUtil.assertFailed(execResult, "cluster submission failed");
}
/**
- * Test error thrown by falcon client, a user tries to delete a cluster that it should not be
+ * Test error thrown by falcon client, a user tries to delete a cluster that it should not be.
* able to delete
* @throws Exception
*/
@Test(enabled = false)
public void badClusterDelete() throws Exception {
bundles[0].submitClusters(prism);
- final String cluster = bundles[0].getClusters().get(0);
+ final String clusterXml = bundles[0].getClusters().get(0);
final ExecResult execResult =
- prism.getClusterHelper().clientDelete(cluster, MerlinConstants.DIFFERENT_USER_NAME);
+ prism.getClusterHelper().clientDelete(clusterXml, MerlinConstants.DIFFERENT_USER_NAME);
AssertUtil.assertFailed(execResult, "cluster deletion failed");
}