http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java index 6e02822..cfe1119 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java @@ -54,26 +54,29 @@ import java.util.Map; import java.util.Random; import java.util.TreeMap; +/** + * Tests for Lineage API. + */ @Test(groups = "lineage-rest") public class LineageApiTest extends BaseTestClass { - private static final Logger logger = Logger.getLogger(LineageApiTest.class); - private static final String testName = "LineageApiTest"; - private static final String testTag = - Edge.LEBEL_TYPE.TESTNAME.toString().toLowerCase() + "=" + testName; + private static final Logger LOGGER = Logger.getLogger(LineageApiTest.class); + private static final String TEST_NAME = "LineageApiTest"; + private static final String TEST_TAG = + Edge.LEBEL_TYPE.TESTNAME.toString().toLowerCase() + "=" + TEST_NAME; private static final String VERTEX_NOT_FOUND_REGEX = ".*Vertex.*%d.*not.*found.*\n?"; - private static final String inValidArgumentStr = "Invalid argument"; - LineageHelper lineageHelper; - final ColoHelper cluster = servers.get(0); - final String baseTestHDFSDir = baseHDFSDir + "/LineageApiTest"; - final String feedInputPath = baseTestHDFSDir + "/input"; - final String feedOutputPath = baseTestHDFSDir + "/output"; + private static final String INVALID_ARGUMENT_STR = "Invalid argument"; + private LineageHelper lineageHelper; + private final ColoHelper cluster = servers.get(0); + private final String baseTestHDFSDir = baseHDFSDir + '/' + TEST_NAME; + private final String feedInputPath = baseTestHDFSDir + "/input"; + private final String feedOutputPath = baseTestHDFSDir + "/output"; // use 5 <= x < 10 input feeds - final int numInputFeeds = 5 + new Random().nextInt(5); + private final int numInputFeeds = 5 + new Random().nextInt(5); // use 5 <= x < 10 output feeds - final int numOutputFeeds = 5 + new Random().nextInt(5); - ClusterMerlin clusterMerlin; - FeedMerlin[] inputFeeds; - FeedMerlin[] outputFeeds; + private final int numOutputFeeds = 5 + new Random().nextInt(5); + private ClusterMerlin clusterMerlin; + private FeedMerlin[] inputFeeds; + private FeedMerlin[] outputFeeds; @BeforeClass(alwaysRun = true) public void init() { @@ -89,12 +92,12 @@ public class LineageApiTest extends BaseTestClass { final List<String> clusterStrings = bundles[0].getClusters(); Assert.assertEquals(clusterStrings.size(), 1, "Expecting only 1 clusterMerlin."); clusterMerlin = new ClusterMerlin(clusterStrings.get(0)); - clusterMerlin.setTags(testTag); + clusterMerlin.setTags(TEST_TAG); AssertUtil.assertSucceeded(prism.getClusterHelper().submitEntity(clusterMerlin.toString())); - logger.info("numInputFeeds = " + numInputFeeds); - logger.info("numOutputFeeds = " + numOutputFeeds); + LOGGER.info("numInputFeeds = " + numInputFeeds); + LOGGER.info("numOutputFeeds = " + numOutputFeeds); final FeedMerlin inputMerlin = new FeedMerlin(bundles[0].getInputFeedFromBundle()); - inputMerlin.setTags(testTag); + inputMerlin.setTags(TEST_TAG); inputFeeds = generateFeeds(numInputFeeds, inputMerlin, Generator.getNameGenerator("infeed", inputMerlin.getName()), Generator.getHadoopPathGenerator(feedInputPath, MINUTE_DATE_PATTERN)); @@ -103,7 +106,7 @@ public class LineageApiTest extends BaseTestClass { } FeedMerlin outputMerlin = new FeedMerlin(bundles[0].getOutputFeedFromBundle()); - outputMerlin.setTags(testTag); + outputMerlin.setTags(TEST_TAG); outputFeeds = generateFeeds(numOutputFeeds, outputMerlin, Generator.getNameGenerator("outfeed", outputMerlin.getName()), Generator.getHadoopPathGenerator(feedOutputPath, MINUTE_DATE_PATTERN)); @@ -139,13 +142,13 @@ public class LineageApiTest extends BaseTestClass { } /** - * Get all vertices from falcon and check that they are sane + * Get all vertices from falcon and check that they are sane. * @throws Exception */ @Test public void testAllVertices() throws Exception { final VerticesResult verticesResult = lineageHelper.getAllVertices(); - logger.info(verticesResult); + LOGGER.info(verticesResult); GraphAssert.assertVertexSanity(verticesResult); GraphAssert.assertUserVertexPresence(verticesResult); GraphAssert.assertVerticesPresenceMinOccur(verticesResult, Vertex.VERTEX_TYPE.COLO, 1); @@ -156,7 +159,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Get a vertex by id and check results + * Get a vertex by id and check results. * @throws Exception */ @Test @@ -172,7 +175,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Negative test - get a vertex without specifying id, we should not get internal server error + * Negative test - get a vertex without specifying id, we should not get internal server error. * @throws Exception */ @Test @@ -180,15 +183,16 @@ public class LineageApiTest extends BaseTestClass { HttpResponse response = lineageHelper.runGetRequest( lineageHelper.getUrl(LineageHelper.URL.VERTICES, "")); String responseString = lineageHelper.getResponseString(response); - logger.info("response: " + response); - logger.info("responseString: " + responseString); + LOGGER.info("response: " + response); + LOGGER.info("responseString: " + responseString); Assert.assertNotEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_INTERNAL_SERVER_ERROR, "We should not get internal server error"); } /** - * Negative test - get a vertex specifying an invalid id, we should not get http non-found error + * Negative test - get a vertex specifying an invalid id, we should not get http non-found + * error. * @throws Exception */ @Test @@ -198,7 +202,7 @@ public class LineageApiTest extends BaseTestClass { GraphAssert.assertVertexSanity(allVerticesResult); int invalidVertexId = -1; for (Vertex vertex : allVerticesResult.getResults()) { - if(invalidVertexId <= vertex.getId()) { + if (invalidVertexId <= vertex.getId()) { invalidVertexId = vertex.getId() + 1; } } @@ -206,8 +210,8 @@ public class LineageApiTest extends BaseTestClass { HttpResponse response = lineageHelper.runGetRequest( lineageHelper.getUrl(LineageHelper.URL.VERTICES, "" + invalidVertexId)); String responseString = lineageHelper.getResponseString(response); - logger.info("response: " + response); - logger.info("responseString: " + responseString); + LOGGER.info("response: " + response); + LOGGER.info("responseString: " + responseString); Assert.assertTrue( responseString.matches(String.format(VERTEX_NOT_FOUND_REGEX, invalidVertexId)), "Unexpected responseString: " + responseString); @@ -217,7 +221,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Get properties of one type of vertex and check those properties + * Get properties of one type of vertex and check those properties. * @param vertexType type of the vertex that we want to check */ private void checkVertexOneProperty(Vertex.VERTEX_TYPE vertexType) { @@ -235,7 +239,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Test vertex properties for different types of vertices + * Test vertex properties for different types of vertices. * @throws Exception */ @Test @@ -254,7 +258,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Test vertex properties supplying a blank id, expecting http not found error + * Test vertex properties supplying a blank id, expecting http not found error. * @throws Exception */ @Test @@ -263,14 +267,14 @@ public class LineageApiTest extends BaseTestClass { HttpResponse response = lineageHelper.runGetRequest(lineageHelper .getUrl(LineageHelper.URL.VERTICES_PROPERTIES, lineageHelper.getUrlPath(""))); String responseString = lineageHelper.getResponseString(response); - logger.info("response: " + response); - logger.info("responseString: " + responseString); + LOGGER.info("response: " + response); + LOGGER.info("responseString: " + responseString); Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_NOT_FOUND, "We should get http not found error"); } /** - * Test vertex properties supplying an invalid id, expecting http not found error + * Test vertex properties supplying an invalid id, expecting http not found error. * @throws Exception */ @Test @@ -281,7 +285,7 @@ public class LineageApiTest extends BaseTestClass { int invalidVertexId = -1; for (Vertex vertex : allVerticesResult.getResults()) { - if(invalidVertexId <= vertex.getId()) { + if (invalidVertexId <= vertex.getId()) { invalidVertexId = vertex.getId() + 1; } } @@ -289,8 +293,8 @@ public class LineageApiTest extends BaseTestClass { HttpResponse response = lineageHelper.runGetRequest( lineageHelper.getUrl(LineageHelper.URL.VERTICES_PROPERTIES, "" + invalidVertexId)); String responseString = lineageHelper.getResponseString(response); - logger.info("response: " + response); - logger.info("responseString: " + responseString); + LOGGER.info("response: " + response); + LOGGER.info("responseString: " + responseString); Assert.assertTrue( responseString.matches(String.format(VERTEX_NOT_FOUND_REGEX, invalidVertexId)), "Unexpected responseString: " + responseString); @@ -300,7 +304,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Test filtering vertices by name + * Test filtering vertices by name. * @throws Exception */ @Test @@ -331,7 +335,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Test filtering vertices by type + * Test filtering vertices by type. * @throws Exception */ @Test @@ -356,7 +360,7 @@ public class LineageApiTest extends BaseTestClass { } /** - * Test filtering vertices when no output is produced + * Test filtering vertices when no output is produced. * @throws Exception */ @Test @@ -376,11 +380,11 @@ public class LineageApiTest extends BaseTestClass { HttpResponse response = lineageHelper .runGetRequest(lineageHelper.getUrl(LineageHelper.URL.VERTICES, params)); String responseString = lineageHelper.getResponseString(response); - logger.info(responseString); + LOGGER.info(responseString); Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_BAD_REQUEST, "The get request was a bad request"); - Assert.assertTrue(responseString.contains(inValidArgumentStr), + Assert.assertTrue(responseString.contains(INVALID_ARGUMENT_STR), "Result should contain string Invalid argument"); } @@ -392,11 +396,11 @@ public class LineageApiTest extends BaseTestClass { HttpResponse response = lineageHelper.runGetRequest( lineageHelper.getUrl(LineageHelper.URL.VERTICES, params)); String responseString = lineageHelper.getResponseString(response); - logger.info(responseString); + LOGGER.info(responseString); Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_BAD_REQUEST, "The get request was a bad request"); - Assert.assertTrue(responseString.contains(inValidArgumentStr), + Assert.assertTrue(responseString.contains(INVALID_ARGUMENT_STR), "Result should contain string Invalid argument"); } @@ -413,8 +417,8 @@ public class LineageApiTest extends BaseTestClass { Assert.assertEquals(bothEdges.filterByType(Edge.LEBEL_TYPE.CLUSTER_COLO).size(), 1, "There should be an edge from the cluster to colo"); Assert.assertEquals(bothEdges.getTotalSize(), inputFeeds.length + outputFeeds.length + 2, - "There should be edge from the cluster to inputFeeds & outputFeeds," + - " one between cluster and colo, one between cluster and classification"); + "There should be edge from the cluster to inputFeeds & outputFeeds," + + " one between cluster and colo, one between cluster and classification"); final EdgesResult inComingEdges = lineageHelper.getEdgesByDirection(clusterVertexId, Direction.inComingEdges); @@ -451,8 +455,8 @@ public class LineageApiTest extends BaseTestClass { "The should be one edge between cluster and colo"); Assert.assertEquals(bothVertices.getTotalSize(), inputFeeds.length + outputFeeds.length + 2, - "There should be edge from the cluster to inputFeeds & outputFeeds," + - " one between cluster and colo, one between cluster and classification"); + "There should be edge from the cluster to inputFeeds & outputFeeds," + + " one between cluster and colo, one between cluster and classification"); final VerticesResult inComingVertices = lineageHelper.getVerticesByDirection(clusterVertexId, Direction.inComingVertices); @@ -462,15 +466,15 @@ public class LineageApiTest extends BaseTestClass { "There should be edge from the cluster to inputFeeds & outputFeeds"); Assert.assertEquals(inComingVertices.getTotalSize(), inputFeeds.length + outputFeeds.length, - "There should be edge from the cluster to inputFeeds & outputFeeds and one " + - "between cluster and colo"); + "There should be edge from the cluster to inputFeeds & outputFeeds and one " + + "between cluster and colo"); final VerticesResult outgoingVertices = lineageHelper.getVerticesByDirection(clusterVertexId, Direction.outgoingVertices); GraphAssert.assertVertexSanity(outgoingVertices); Assert.assertEquals(outgoingVertices.filterByType(Vertex.VERTEX_TYPE.COLO).size(), 1, "The should be one edge between cluster and colo"); - Assert.assertEquals(outgoingVertices.filterByName(testName).size(), + Assert.assertEquals(outgoingVertices.filterByName(TEST_NAME).size(), 1, "There should be an edge from the cluster to classification"); Assert.assertEquals(outgoingVertices.getTotalSize(), 2, "There should be an edge from the cluster to colo"); @@ -484,15 +488,15 @@ public class LineageApiTest extends BaseTestClass { lineageHelper.getVerticesByDirection(clusterVertexId, Direction.bothCount); Assert.assertEquals(bothCount.getTotalSize(), inputFeeds.length + outputFeeds.length + 2, - "There should be edge from the cluster to inputFeeds & outputFeeds," + - " one between cluster and colo, one between cluster and classification"); + "There should be edge from the cluster to inputFeeds & outputFeeds," + + " one between cluster and colo, one between cluster and classification"); final VerticesResult inCount = lineageHelper.getVerticesByDirection(clusterVertexId, Direction.inCount); Assert.assertEquals(inCount.getTotalSize(), inputFeeds.length + outputFeeds.length, - "There should be edge from the cluster to inputFeeds & outputFeeds and one " + - "between cluster and colo"); + "There should be edge from the cluster to inputFeeds & outputFeeds and one " + + "between cluster and colo"); final VerticesResult outCount = lineageHelper.getVerticesByDirection(clusterVertexId, Direction.outCount); @@ -511,8 +515,8 @@ public class LineageApiTest extends BaseTestClass { } Assert.assertEquals(bothVerticesIds.getTotalSize(), inputFeeds.length + outputFeeds.length + 2, - "There should be edge from the cluster to inputFeeds & outputFeeds," + - " one between cluster and colo, one between cluster and classification"); + "There should be edge from the cluster to inputFeeds & outputFeeds," + + " one between cluster and colo, one between cluster and classification"); final VertexIdsResult incomingVerticesIds = lineageHelper.getVertexIdsByDirection(clusterVertexId, Direction.incomingVerticesIds); @@ -521,8 +525,8 @@ public class LineageApiTest extends BaseTestClass { } Assert.assertEquals(incomingVerticesIds.getTotalSize(), inputFeeds.length + outputFeeds.length, - "There should be edge from the cluster to inputFeeds & outputFeeds and one " + - "between cluster and colo"); + "There should be edge from the cluster to inputFeeds & outputFeeds and one " + + "between cluster and colo"); final VertexIdsResult outgoingVerticesIds = lineageHelper.getVertexIdsByDirection(clusterVertexId, Direction.outgoingVerticesIds); @@ -530,8 +534,8 @@ public class LineageApiTest extends BaseTestClass { Assert.assertTrue(vertexId > 0, "Vertex id should be valid."); } Assert.assertEquals(outgoingVerticesIds.getTotalSize(), 2, - "There should be an edge from the cluster to colo and one from cluster to " + - "classification"); + "There should be an edge from the cluster to colo and one from cluster to " + + "classification"); } @Test @@ -542,8 +546,8 @@ public class LineageApiTest extends BaseTestClass { .runGetRequest(lineageHelper.getUrl(LineageHelper.URL.VERTICES, lineageHelper.getUrlPath(clusterVertexId, "badDirection"))); final String responseString = lineageHelper.getResponseString(response); - logger.info("response: " + response); - logger.info("responseString: " + responseString); + LOGGER.info("response: " + response); + LOGGER.info("responseString: " + responseString); Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_BAD_REQUEST, "We should not get internal server error"); @@ -552,9 +556,9 @@ public class LineageApiTest extends BaseTestClass { @Test public void testAllEdges() throws Exception { final EdgesResult edgesResult = lineageHelper.getAllEdges(); - logger.info(edgesResult); - Assert.assertTrue(edgesResult.getTotalSize() > 0, "Total number of edges should be" + - " greater that zero but is: " + edgesResult.getTotalSize()); + LOGGER.info(edgesResult); + Assert.assertTrue(edgesResult.getTotalSize() > 0, "Total number of edges should be" + + " greater that zero but is: " + edgesResult.getTotalSize()); GraphAssert.assertEdgeSanity(edgesResult); GraphAssert.assertEdgePresenceMinOccur(edgesResult, Edge.LEBEL_TYPE.CLUSTER_COLO, 1); GraphAssert.assertEdgePresenceMinOccur(edgesResult, Edge.LEBEL_TYPE.STORED_IN, @@ -583,8 +587,8 @@ public class LineageApiTest extends BaseTestClass { public void testEdgeBlankId() throws Exception { final HttpResponse httpResponse = lineageHelper.runGetRequest( lineageHelper.getUrl(LineageHelper.URL.EDGES, lineageHelper.getUrlPath(""))); - logger.info(httpResponse.toString()); - logger.info(lineageHelper.getResponseString(httpResponse)); + LOGGER.info(httpResponse.toString()); + LOGGER.info(lineageHelper.getResponseString(httpResponse)); Assert.assertEquals(httpResponse.getStatusLine().getStatusCode(), HttpStatus.SC_NOT_FOUND, "Expecting not-found error."); @@ -594,8 +598,8 @@ public class LineageApiTest extends BaseTestClass { public void testEdgeInvalidId() throws Exception { final HttpResponse response = lineageHelper.runGetRequest( lineageHelper.getUrl(LineageHelper.URL.EDGES, lineageHelper.getUrlPath("invalid-id"))); - logger.info(response.toString()); - logger.info(lineageHelper.getResponseString(response)); + LOGGER.info(response.toString()); + LOGGER.info(lineageHelper.getResponseString(response)); Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_NOT_FOUND, "Expecting not-found error."); @@ -611,7 +615,7 @@ public class LineageApiTest extends BaseTestClass { final List<Vertex> colo1Vertex = verticesResult.filterByName(clusterMerlin.getColo()); AssertUtil.checkForListSize(colo1Vertex, 1); Vertex coloVertex = colo1Vertex.get(0); - logger.info("coloVertex: " + coloVertex); + LOGGER.info("coloVertex: " + coloVertex); final VerticesResult verticesByDirection = lineageHelper.getVerticesByDirection(coloVertex.getId(), Direction.inComingVertices); AssertUtil.checkForListSize(
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ListFeedInstancesTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ListFeedInstancesTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ListFeedInstancesTest.java index 6d29f77..b585665 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ListFeedInstancesTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ListFeedInstancesTest.java @@ -72,8 +72,8 @@ public class ListFeedInstancesTest extends BaseTestClass { @BeforeClass(alwaysRun = true) public void setUp() - throws IOException, OozieClientException, JAXBException, AuthenticationException, - URISyntaxException, InterruptedException { + throws IOException, OozieClientException, JAXBException, AuthenticationException, + URISyntaxException, InterruptedException { uploadDirToClusters(aggregateWorkflowDir, OSUtil.RESOURCES_OOZIE); startTime = TimeUtil.getTimeWrtSystemTime(-55); endTime = TimeUtil.getTimeWrtSystemTime(5); @@ -174,8 +174,8 @@ public class ListFeedInstancesTest extends BaseTestClass { */ @Test public void testFeedOrderBy() - throws URISyntaxException, OozieClientException, JAXBException, AuthenticationException, - IOException, InterruptedException { + throws URISyntaxException, OozieClientException, JAXBException, AuthenticationException, + IOException, InterruptedException { SoftAssert softAssert = new SoftAssert(); //orderBy start time InstancesResult r = prism.getFeedHelper().listInstances(feedName, @@ -223,8 +223,8 @@ public class ListFeedInstancesTest extends BaseTestClass { */ @Test public void testFeedStartEnd() - throws URISyntaxException, OozieClientException, JAXBException, AuthenticationException, - IOException, InterruptedException { + throws URISyntaxException, OozieClientException, JAXBException, AuthenticationException, + IOException, InterruptedException { //actual start/end values. InstancesResult r = prism.getFeedHelper().listInstances(feedName, "start=" + startTime + "&end=" + endTime, null); @@ -290,7 +290,7 @@ public class ListFeedInstancesTest extends BaseTestClass { */ @Test public void testFeedOffsetNumResults() - throws URISyntaxException, IOException, AuthenticationException, InterruptedException { + throws URISyntaxException, IOException, AuthenticationException, InterruptedException { //check the default value of the numResults param. Expecting 10 instances. InstancesResult r = prism.getFeedHelper().listInstances(feedName, null, null); InstanceUtil.validateResponse(r, 10, 1, 1, 4, 4); @@ -347,8 +347,8 @@ public class ListFeedInstancesTest extends BaseTestClass { */ @Test public void testFeedFilterBy() - throws OozieClientException, AuthenticationException, IOException, URISyntaxException, - InterruptedException { + throws OozieClientException, AuthenticationException, IOException, URISyntaxException, + InterruptedException { //test with the filterBy status. InstancesResult r = prism.getFeedHelper().listInstances(feedName, "filterBy=STATUS:RUNNING", null); @@ -395,7 +395,7 @@ public class ListFeedInstancesTest extends BaseTestClass { */ @Test public void testFeedCustomFilter() - throws URISyntaxException, IOException, AuthenticationException, InterruptedException { + throws URISyntaxException, IOException, AuthenticationException, InterruptedException { String params = "start=" + startTime + "&filterBy=status:RUNNING"; InstancesResult r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 1, 1, 0, 0, 0); http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java index c964210..4bc1806 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java @@ -82,8 +82,8 @@ public class ProcessPipelineTest extends BaseTestClass{ */ @Test public void listPipeline() - throws URISyntaxException, IOException, AuthenticationException, JAXBException, - InterruptedException { + throws URISyntaxException, IOException, AuthenticationException, JAXBException, + InterruptedException { //match processes to pipelines HashMap<String, List<String>> map = new HashMap<String, List<String>>(); //index for few different pipelines @@ -127,8 +127,8 @@ public class ProcessPipelineTest extends BaseTestClass{ */ @Test public void testProcessWithPipeline() - throws URISyntaxException, IOException, AuthenticationException, JAXBException, - SAXException, InterruptedException { + throws URISyntaxException, IOException, AuthenticationException, JAXBException, + SAXException, InterruptedException { String pipeline = "samplePipeline"; bundles[0].setProcessPipeline(pipeline); bundles[0].submitProcess(true); @@ -151,8 +151,8 @@ public class ProcessPipelineTest extends BaseTestClass{ */ @Test(dataProvider = "data") public void testPipelines(String pipeline, String action, boolean shouldSucceed) - throws URISyntaxException, IOException, AuthenticationException, JAXBException, - InterruptedException { + throws URISyntaxException, IOException, AuthenticationException, JAXBException, + InterruptedException { bundles[0].setProcessPipeline(pipeline); if (action.equals("list")){ if (shouldSucceed){ @@ -177,7 +177,9 @@ public class ProcessPipelineTest extends BaseTestClass{ //{specialName, "submit", false}, {utf8Name, "submit", false}, {longName, "submit", true}, {"pipeline0,pipeline1,pipeline2,pipeline3,pipeline4,pipeline5,pipeline6,pipeline7," - +"pipeline8,pipeline9,pipeline10,pipeline11", "submit", true}}; + + "pipeline8,pipeline9,pipeline10,pipeline11", "submit", true, + }, + }; } @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/EntityDryRunTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/EntityDryRunTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/EntityDryRunTest.java index 991732b..ec05166 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/EntityDryRunTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/EntityDryRunTest.java @@ -44,8 +44,8 @@ import javax.xml.bind.JAXBException; import java.io.IOException; import java.lang.reflect.Method; -/* -test cases for https://issues.apache.org/jira/browse/FALCON-353 +/** + * test cases for https://issues.apache.org/jira/browse/FALCON-353. */ public class EntityDryRunTest extends BaseTestClass { @@ -85,7 +85,7 @@ public class EntityDryRunTest extends BaseTestClass { } /** - * tries to submit process with invalid el exp + * tries to submit process with invalid el exp. */ @Test(groups = {"singleCluster"}) public void testDryRunFailureScheduleProcess() throws Exception { @@ -96,7 +96,7 @@ public class EntityDryRunTest extends BaseTestClass { } /** - * tries to update process with invalid EL exp + * tries to update process with invalid EL exp. */ @Test(groups = {"singleCluster"}) public void testDryRunFailureUpdateProcess() throws Exception { @@ -113,7 +113,7 @@ public class EntityDryRunTest extends BaseTestClass { } /** - * tries to submit feed with invalied EL exp + * tries to submit feed with invalied EL exp. */ @Test(groups = {"singleCluster"}) public void testDryRunFailureScheduleFeed() throws Exception { @@ -125,7 +125,7 @@ public class EntityDryRunTest extends BaseTestClass { } /** - * tries to update feed with invalid el exp + * tries to update feed with invalid el exp. */ @Test(groups = {"singleCluster"}) public void testDryRunFailureUpdateFeed() throws Exception { @@ -143,9 +143,9 @@ public class EntityDryRunTest extends BaseTestClass { private void validate(ServiceResponse response) throws JAXBException { AssertUtil.assertFailed(response); - Assert.assertTrue(response.getMessage().contains("org.apache.falcon.FalconException: " + - "AUTHENTICATION : E1004 : Expression language evaluation error, Unable to evaluate " + - ":${coord:someEL(1)"), "Correct response was not present in process / feed schedule"); + Assert.assertTrue(response.getMessage().contains("org.apache.falcon.FalconException: " + + "AUTHENTICATION : E1004 : Expression language evaluation error, Unable to evaluate :" + + "${coord:someEL(1)"), "Correct response was not present in process / feed schedule"); } @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/FeedDelayParallelTimeoutTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/FeedDelayParallelTimeoutTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/FeedDelayParallelTimeoutTest.java index a0cd014..c35cbac 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/FeedDelayParallelTimeoutTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/FeedDelayParallelTimeoutTest.java @@ -38,16 +38,19 @@ import org.testng.annotations.Test; import java.io.IOException; import java.lang.reflect.Method; +/** + * Test delays in feed. + */ @Test(groups = "distributed") public class FeedDelayParallelTimeoutTest extends BaseTestClass { - ColoHelper cluster1 = servers.get(0); - ColoHelper cluster2 = servers.get(1); + private ColoHelper cluster1 = servers.get(0); + private ColoHelper cluster2 = servers.get(1); - String baseTestDir = baseHDFSDir + "/FeedDelayParallelTimeoutTest"; - String feedInputPath = baseTestDir + MINUTE_DATE_PATTERN; - String aggregateWorkflowDir = baseTestDir + "/aggregator"; - private static final Logger logger = Logger.getLogger(FeedDelayParallelTimeoutTest.class); + private String baseTestDir = baseHDFSDir + "/FeedDelayParallelTimeoutTest"; + private String feedInputPath = baseTestDir + MINUTE_DATE_PATTERN; + private String aggregateWorkflowDir = baseTestDir + "/aggregator"; + private static final Logger LOGGER = Logger.getLogger(FeedDelayParallelTimeoutTest.class); @BeforeClass(alwaysRun = true) public void uploadWorkflow() throws Exception { @@ -56,7 +59,7 @@ public class FeedDelayParallelTimeoutTest extends BaseTestClass { @BeforeMethod(alwaysRun = true) public void setup(Method method) throws Exception { - logger.info("test name: " + method.getName()); + LOGGER.info("test name: " + method.getName()); Bundle bundle = BundleUtil.readELBundle(); bundles[0] = new Bundle(bundle, cluster1); bundles[1] = new Bundle(bundle, cluster2); @@ -115,7 +118,7 @@ public class FeedDelayParallelTimeoutTest extends BaseTestClass { feedOutput01 = Util.setFeedProperty(feedOutput01, "timeout", "minutes(35)"); feedOutput01 = Util.setFeedProperty(feedOutput01, "parallel", "3"); - logger.info("feedOutput01: " + Util.prettyPrintXml(feedOutput01)); + LOGGER.info("feedOutput01: " + Util.prettyPrintXml(feedOutput01)); prism.getFeedHelper().submitAndSchedule(feedOutput01); } http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/OptionalInputTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/OptionalInputTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/OptionalInputTest.java index 5c04e20..9e802d3 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/OptionalInputTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/OptionalInputTest.java @@ -44,16 +44,19 @@ import java.lang.reflect.Method; import java.util.List; +/** + * Tests with optional input. + */ @Test(groups = "embedded") public class OptionalInputTest extends BaseTestClass { - ColoHelper cluster = servers.get(0); - FileSystem clusterFS = serverFS.get(0); - OozieClient oozieClient = serverOC.get(0); - String baseTestDir = baseHDFSDir + "/OptionalInputTest"; - String inputPath = baseTestDir + "/input"; - String aggregateWorkflowDir = baseTestDir + "/aggregator"; - private static final Logger logger = Logger.getLogger(OptionalInputTest.class); + private ColoHelper cluster = servers.get(0); + private FileSystem clusterFS = serverFS.get(0); + private OozieClient oozieClient = serverOC.get(0); + private String baseTestDir = baseHDFSDir + "/OptionalInputTest"; + private String inputPath = baseTestDir + "/input"; + private String aggregateWorkflowDir = baseTestDir + "/aggregator"; + private static final Logger LOGGER = Logger.getLogger(OptionalInputTest.class); @BeforeClass(alwaysRun = true) public void uploadWorkflow() throws Exception { @@ -62,7 +65,7 @@ public class OptionalInputTest 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(); @@ -82,18 +85,20 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_1optional_1compulsary() throws Exception { + public void optionalTest1optional1compulsary() throws Exception { bundles[0].generateRequiredBundle(1, 2, 1, inputPath, 1, "2010-01-02T01:00Z", "2010-01-02T01:12Z"); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); bundles[0].setProcessConcurrency(2); String process = bundles[0].getProcessData(); - logger.info(Util.prettyPrintXml(process)); + LOGGER.info(Util.prettyPrintXml(process)); bundles[0].submitAndScheduleBundle(prism, false); List<String> dataDates = TimeUtil.getMinuteDatesOnEitherSide("2010-01-02T00:50Z", @@ -112,21 +117,23 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_1optional_2compulsary() throws Exception { + public void optionalTest1optional2compulsary() throws Exception { bundles[0].generateRequiredBundle(1, 3, 1, inputPath, 1, "2010-01-02T01:00Z", "2010-01-02T01:12Z"); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); bundles[0].setProcessConcurrency(2); String processName = Util.readEntityName(bundles[0].getProcessData()); - logger.info(Util.prettyPrintXml(bundles[0].getProcessData())); + LOGGER.info(Util.prettyPrintXml(bundles[0].getProcessData())); bundles[0].submitAndScheduleBundle(prism, false); - logger.info("instanceShouldStillBeInWaitingState"); + LOGGER.info("instanceShouldStillBeInWaitingState"); InstanceUtil.waitTillInstanceReachState(oozieClient, processName, 2, CoordinatorAction.Status.WAITING, EntityType.PROCESS); @@ -148,18 +155,20 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_2optional_1compulsary() throws Exception { + public void optionalTest2optional1compulsary() throws Exception { bundles[0].generateRequiredBundle(1, 3, 2, inputPath, 1, "2010-01-02T01:00Z", "2010-01-02T01:12Z"); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); bundles[0].setProcessConcurrency(2); String processName = Util.readEntityName(bundles[0].getProcessData()); - logger.info(Util.prettyPrintXml(bundles[0].getProcessData())); + LOGGER.info(Util.prettyPrintXml(bundles[0].getProcessData())); bundles[0].submitAndScheduleBundle(prism, false); InstanceUtil.waitTillInstanceReachState(oozieClient, processName, @@ -180,19 +189,21 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_optionalInputWithEmptyDir() throws Exception { + public void optionalTestOptionalInputWithEmptyDir() throws Exception { String startTime = TimeUtil.getTimeWrtSystemTime(-4); String endTime = TimeUtil.getTimeWrtSystemTime(10); bundles[0].generateRequiredBundle(1, 2, 1, inputPath, 1, startTime, endTime); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); bundles[0].setProcessConcurrency(2); String process = bundles[0].getProcessData(); - logger.info(Util.prettyPrintXml(process)); + LOGGER.info(Util.prettyPrintXml(process)); List<String> dataDates = TimeUtil.getMinuteDatesOnEitherSide( TimeUtil.addMinsToTime(startTime, -10), endTime, 5); @@ -214,17 +225,19 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_allInputOptional() throws Exception { + public void optionalTestAllInputOptional() throws Exception { bundles[0].generateRequiredBundle(1, 2, 2, inputPath, 1, "2010-01-02T01:00Z", "2010-01-02T01:12Z"); bundles[0].setProcessInputNames("inputData"); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } String process = bundles[0].getProcessData(); - logger.info(Util.prettyPrintXml(process)); + LOGGER.info(Util.prettyPrintXml(process)); bundles[0].submitAndScheduleBundle(prism, false); InstanceUtil.waitTillInstanceReachState(oozieClient, Util.getProcessName(process), @@ -240,20 +253,22 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_updateProcessMakeOptionalCompulsory() throws Exception { + public void optionalTestUpdateProcessMakeOptionalCompulsory() throws Exception { String startTime = TimeUtil.getTimeWrtSystemTime(-4); String endTime = TimeUtil.getTimeWrtSystemTime(30); bundles[0].generateRequiredBundle(1, 2, 1, inputPath, 1, startTime, endTime); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); bundles[0].setProcessConcurrency(2); String process = bundles[0].getProcessData(); String processName = Util.getProcessName(process); - logger.info(Util.prettyPrintXml(process)); + LOGGER.info(Util.prettyPrintXml(process)); bundles[0].submitAndScheduleBundle(prism, true); InstanceUtil.waitTillInstanceReachState(oozieClient, processName, @@ -264,14 +279,14 @@ public class OptionalInputTest extends BaseTestClass { inputPath + "/input1/", dataDates); InstanceUtil.waitTillInstanceReachState(oozieClient, processName, - 1, CoordinatorAction.Status.SUCCEEDED, EntityType.PROCESS); + 1, CoordinatorAction.Status.SUCCEEDED, EntityType.PROCESS); final ProcessMerlin processMerlin = new ProcessMerlin(process); processMerlin.setProcessFeeds(bundles[0].getDataSets(), 2, 0, 1); bundles[0].setProcessData(processMerlin.toString()); bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); process = bundles[0].getProcessData(); - logger.info("modified process:" + Util.prettyPrintXml(process)); + LOGGER.info("modified process:" + Util.prettyPrintXml(process)); prism.getProcessHelper().update(process, process); @@ -294,20 +309,22 @@ public class OptionalInputTest extends BaseTestClass { * @throws Exception */ @Test(enabled = true, groups = {"singleCluster"}) - public void optionalTest_updateProcessMakeCompulsoryOptional() throws Exception { + public void optionalTestUpdateProcessMakeCompulsoryOptional() throws Exception { String startTime = TimeUtil.getTimeWrtSystemTime(-4); String endTime = TimeUtil.getTimeWrtSystemTime(30); bundles[0].generateRequiredBundle(1, 2, 1, inputPath, 1, startTime, endTime); - for (int i = 0; i < bundles[0].getClusters().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); - for (int i = 0; i < bundles[0].getDataSets().size(); i++) - logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + for (int i = 0; i < bundles[0].getClusters().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getClusters().get(i))); + } + for (int i = 0; i < bundles[0].getDataSets().size(); i++) { + LOGGER.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); + } bundles[0].setProcessInputStartEnd("now(0,-10)", "now(0,0)"); bundles[0].setProcessConcurrency(4); String process = bundles[0].getProcessData(); String processName = Util.getProcessName(process); - logger.info(Util.prettyPrintXml(process)); + LOGGER.info(Util.prettyPrintXml(process)); bundles[0].submitAndScheduleBundle(prism, true); InstanceUtil.waitTillInstanceReachState(oozieClient, processName, @@ -318,7 +335,7 @@ public class OptionalInputTest extends BaseTestClass { HadoopUtil.flattenAndPutDataInFolder(clusterFS, OSUtil.SINGLE_FILE, inputPath + "/input1/", dataDates); InstanceUtil.waitTillInstanceReachState(oozieClient, processName, - 1, CoordinatorAction.Status.SUCCEEDED, EntityType.PROCESS); + 1, CoordinatorAction.Status.SUCCEEDED, EntityType.PROCESS); final ProcessMerlin processMerlin = new ProcessMerlin(process); processMerlin.setProcessFeeds(bundles[0].getDataSets(), 2, 2, 1); @@ -328,7 +345,7 @@ public class OptionalInputTest extends BaseTestClass { //delete all input data HadoopUtil.deleteDirIfExists(inputPath + "/", clusterFS); bundles[0].setProcessInputNames("inputData0", "inputData"); - logger.info("modified process:" + Util.prettyPrintXml(process)); + LOGGER.info("modified process:" + Util.prettyPrintXml(process)); prism.getProcessHelper().update(process, process); http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismClusterDeleteTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismClusterDeleteTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismClusterDeleteTest.java index c601345..6f0743c 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismClusterDeleteTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismClusterDeleteTest.java @@ -39,14 +39,17 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; +/** + * Delete cluster via prism tests. + */ @Test(groups = "distributed") public class PrismClusterDeleteTest extends BaseTestClass { private boolean restartRequired; - ColoHelper cluster1 = servers.get(0); - ColoHelper cluster2 = servers.get(1); - String aggregateWorkflowDir = baseHDFSDir + "/PrismClusterDeleteTest/aggregator"; - private static final Logger logger = Logger.getLogger(PrismClusterDeleteTest.class); + private ColoHelper cluster1 = servers.get(0); + private ColoHelper cluster2 = servers.get(1); + private String aggregateWorkflowDir = baseHDFSDir + "/PrismClusterDeleteTest/aggregator"; + private static final Logger LOGGER = Logger.getLogger(PrismClusterDeleteTest.class); @BeforeClass(alwaysRun = true) public void uploadWorkflow() throws Exception { @@ -55,7 +58,7 @@ public class PrismClusterDeleteTest 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(); bundles[0] = new Bundle(bundle, cluster1); http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismConcurrentRequestTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismConcurrentRequestTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismConcurrentRequestTest.java index c767649..fe3a425 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismConcurrentRequestTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismConcurrentRequestTest.java @@ -42,16 +42,19 @@ import java.io.IOException; import java.lang.reflect.Method; +/** + * Tests with concurrent request to prism. + */ @Test(groups = "embedded") public class PrismConcurrentRequestTest extends BaseTestClass { - ColoHelper cluster = servers.get(0); - OozieClient clusterOC = serverOC.get(0); + private ColoHelper cluster = servers.get(0); + private OozieClient clusterOC = serverOC.get(0); private ThreadGroup brotherGrimm = null; - private Brother brothers[] = null; - String aggregateWorkflowDir = baseHDFSDir + "/PrismConcurrentRequest/aggregator"; - private static final Logger logger = Logger.getLogger(PrismConcurrentRequestTest.class); - String feed; + private Brother[] brothers = null; + private String aggregateWorkflowDir = baseHDFSDir + "/PrismConcurrentRequest/aggregator"; + private static final Logger LOGGER = Logger.getLogger(PrismConcurrentRequestTest.class); + private String feed; @BeforeClass(alwaysRun = true) public void uploadWorkflow() throws Exception { @@ -60,7 +63,7 @@ public class PrismConcurrentRequestTest 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].generateUniqueBundle(); bundles[0] = new Bundle(bundles[0], cluster); @@ -93,8 +96,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } @@ -119,8 +122,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } @@ -143,8 +146,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } @@ -168,8 +171,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } @@ -204,8 +207,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } @@ -240,8 +243,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } @@ -263,8 +266,8 @@ public class PrismConcurrentRequestTest extends BaseTestClass { brother.join(); } for (Brother brother : brothers) { - logger.info(brother.getName() + " output: \n" + - Util.prettyPrintXml(brother.getOutput().getMessage())); + LOGGER.info(brother.getName() + " output: \n" + + Util.prettyPrintXml(brother.getOutput().getMessage())); AssertUtil.assertSucceeded(brother.getOutput()); } } http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/387604d1/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedDeleteTest.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedDeleteTest.java b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedDeleteTest.java index 3bbeca1..1d3f88d 100644 --- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedDeleteTest.java +++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedDeleteTest.java @@ -49,16 +49,19 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; +/** + * Delete feed via prism tests. + */ @Test(groups = "distributed") public class PrismFeedDeleteTest extends BaseTestClass { private boolean restartRequired; - ColoHelper cluster1 = servers.get(0); - ColoHelper cluster2 = servers.get(1); + private ColoHelper cluster1 = servers.get(0); + private ColoHelper cluster2 = servers.get(1); private String cluster1Colo = cluster1.getClusterHelper().getColoName(); private String cluster2Colo = cluster2.getClusterHelper().getColoName(); - String aggregateWorkflowDir = baseHDFSDir + "/PrismFeedDeleteTest/aggregator"; - private static final Logger logger = Logger.getLogger(PrismFeedDeleteTest.class); + private String aggregateWorkflowDir = baseHDFSDir + "/PrismFeedDeleteTest/aggregator"; + private static final Logger LOGGER = Logger.getLogger(PrismFeedDeleteTest.class); @BeforeClass(alwaysRun = true) public void uploadWorkflow() throws Exception { @@ -67,7 +70,7 @@ public class PrismFeedDeleteTest 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.readELBundle(); bundles[0] = new Bundle(bundle, cluster1); @@ -88,7 +91,7 @@ public class PrismFeedDeleteTest extends BaseTestClass { } /** - * NOTE: All test cases assume that there are two entities scheduled in each colo + * NOTE: All test cases assume that there are two entities scheduled in each colo. */ @Test(groups = {"multiCluster"}) @@ -191,11 +194,11 @@ public class PrismFeedDeleteTest extends BaseTestClass { AssertUtil.assertSucceeded(prism.getFeedHelper().delete(bundles[0].getDataSets().get(0))); - List<String> Server2ArchivePostUp = cluster2.getFeedHelper().getArchiveInfo(); - List<String> Server2StorePostUp = cluster2.getFeedHelper().getStoreInfo(); + List<String> server2ArchivePostUp = cluster2.getFeedHelper().getArchiveInfo(); + List<String> server2StorePostUp = cluster2.getFeedHelper().getStoreInfo(); - List<String> Server1ArchivePostUp = cluster1.getFeedHelper().getArchiveInfo(); - List<String> Server1StorePostUp = cluster1.getFeedHelper().getStoreInfo(); + List<String> server1ArchivePostUp = cluster1.getFeedHelper().getArchiveInfo(); + List<String> server1StorePostUp = cluster1.getFeedHelper().getStoreInfo(); List<String> prismHelperArchivePostUp = prism.getFeedHelper().getArchiveInfo(); List<String> prismHelperStorePostUp = prism.getFeedHelper().getStoreInfo(); @@ -203,11 +206,11 @@ public class PrismFeedDeleteTest extends BaseTestClass { compareDataStoreStates(finalPrismStore, prismHelperStorePostUp, clusterName); compareDataStoreStates(prismHelperArchivePostUp, finalPrismArchiveStore, clusterName); - compareDataStoreStates(initialServer1Store, Server1StorePostUp, clusterName); - compareDataStoreStates(Server1ArchivePostUp, finalServer1ArchiveStore, clusterName); + compareDataStoreStates(initialServer1Store, server1StorePostUp, clusterName); + compareDataStoreStates(server1ArchivePostUp, finalServer1ArchiveStore, clusterName); - compareDataStoresForEquality(finalServer2Store, Server2StorePostUp); - compareDataStoresForEquality(finalServer2ArchiveStore, Server2ArchivePostUp); + compareDataStoresForEquality(finalServer2Store, server2StorePostUp); + compareDataStoresForEquality(finalServer2ArchiveStore, server2ArchivePostUp); } @@ -366,13 +369,13 @@ public class PrismFeedDeleteTest extends BaseTestClass { bundles[1] = new Bundle(bundles[1], cluster2); bundles[0].setCLusterColo(cluster1Colo); - logger.info("cluster bundle1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0))); + LOGGER.info("cluster bundle1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0))); ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0)); Assert.assertTrue(r.getMessage().contains("SUCCEEDED")); bundles[1].setCLusterColo(cluster2Colo); - logger.info("cluster bundle2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0))); + LOGGER.info("cluster bundle2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0))); r = prism.getClusterHelper().submitEntity(bundles[1].getClusters().get(0)); Assert.assertTrue(r.getMessage().contains("SUCCEEDED")); @@ -614,21 +617,21 @@ public class PrismFeedDeleteTest extends BaseTestClass { AssertUtil.assertSucceeded(prism.getFeedHelper().delete(bundles[0].getDataSets().get(0))); - List<String> Server1StorePostUp = cluster1.getFeedHelper().getStoreInfo(); - List<String> Server1ArchivePostUp = cluster1.getFeedHelper().getArchiveInfo(); + List<String> server1StorePostUp = cluster1.getFeedHelper().getStoreInfo(); + List<String> server1ArchivePostUp = cluster1.getFeedHelper().getArchiveInfo(); - List<String> Server2StorePostUp = cluster2.getFeedHelper().getStoreInfo(); - List<String> Server2ArchivePostUp = cluster2.getFeedHelper().getArchiveInfo(); + List<String> server2StorePostUp = cluster2.getFeedHelper().getStoreInfo(); + List<String> server2ArchivePostUp = cluster2.getFeedHelper().getArchiveInfo(); List<String> prismStorePostUp = prism.getFeedHelper().getStoreInfo(); List<String> prismArchivePostUp = prism.getFeedHelper().getArchiveInfo(); - compareDataStoresForEquality(Server2StorePostUp, finalServer2Store); - compareDataStoresForEquality(Server2ArchivePostUp, finalServer2ArchiveStore); + compareDataStoresForEquality(server2StorePostUp, finalServer2Store); + compareDataStoresForEquality(server2ArchivePostUp, finalServer2ArchiveStore); - compareDataStoreStates(finalServer1Store, Server1StorePostUp, clusterName); - compareDataStoreStates(Server1ArchivePostUp, finalServer1ArchiveStore, clusterName); + compareDataStoreStates(finalServer1Store, server1StorePostUp, clusterName); + compareDataStoreStates(server1ArchivePostUp, finalServer1ArchiveStore, clusterName); compareDataStoreStates(finalPrismStore, prismStorePostUp, clusterName); compareDataStoreStates(prismArchivePostUp, finalPrismArchiveStore, clusterName); @@ -785,13 +788,13 @@ public class PrismFeedDeleteTest extends BaseTestClass { restartRequired = true; bundles[0].setCLusterColo(cluster1Colo); - logger.info("cluster bundle1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0))); + LOGGER.info("cluster bundle1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0))); ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0)); Assert.assertTrue(r.getMessage().contains("SUCCEEDED")); bundles[1].setCLusterColo(cluster2Colo); - logger.info("cluster bundle2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0))); + LOGGER.info("cluster bundle2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0))); r = prism.getClusterHelper().submitEntity(bundles[1].getClusters().get(0)); Assert.assertTrue(r.getMessage().contains("SUCCEEDED")); @@ -816,7 +819,7 @@ public class PrismFeedDeleteTest extends BaseTestClass { Util.readEntityName(bundles[1].getClusters().get(0)), ClusterType.TARGET, null, baseHDFSDir + "/clusterPath/localDC/rc/billing" + MINUTE_DATE_PATTERN); - logger.info("feed: " + Util.prettyPrintXml(feed)); + LOGGER.info("feed: " + Util.prettyPrintXml(feed)); r = prism.getFeedHelper().submitEntity(feed); @@ -886,13 +889,13 @@ public class PrismFeedDeleteTest extends BaseTestClass { restartRequired = true; bundles[0].setCLusterColo(cluster1Colo); - logger.info("cluster bundle1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0))); + LOGGER.info("cluster bundle1: " + Util.prettyPrintXml(bundles[0].getClusters().get(0))); ServiceResponse r = prism.getClusterHelper().submitEntity(bundles[0].getClusters().get(0)); Assert.assertTrue(r.getMessage().contains("SUCCEEDED")); bundles[1].setCLusterColo(cluster2Colo); - logger.info("cluster bundle2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0))); + LOGGER.info("cluster bundle2: " + Util.prettyPrintXml(bundles[1].getClusters().get(0))); r = prism.getClusterHelper().submitEntity(bundles[1].getClusters().get(0)); Assert.assertTrue(r.getMessage().contains("SUCCEEDED")); @@ -915,7 +918,7 @@ public class PrismFeedDeleteTest extends BaseTestClass { Util.readEntityName(bundles[1].getClusters().get(0)), ClusterType.TARGET, null, baseHDFSDir + "/clusterPath/localDC/rc/billing" + MINUTE_DATE_PATTERN); - logger.info("feed: " + Util.prettyPrintXml(feed)); + LOGGER.info("feed: " + Util.prettyPrintXml(feed)); r = prism.getFeedHelper().submitEntity(feed); @@ -943,8 +946,8 @@ public class PrismFeedDeleteTest extends BaseTestClass { Util.shutDownService(cluster1.getFeedHelper()); ServiceResponse response = prism.getFeedHelper().delete(feed); - Assert.assertTrue(response.getMessage().contains(cluster1Colo + "/org.apache.falcon" + - ".FalconException") + Assert.assertTrue(response.getMessage().contains(cluster1Colo + "/org.apache.falcon" + + ".FalconException") && response.getMessage().contains(cluster2Colo + "/" + Util.readEntityName(feed))); AssertUtil.assertPartial(response);