You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by sr...@apache.org on 2013/04/26 17:50:21 UTC
[05/47] Fixes for Checkstyle
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyTest.java b/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyTest.java
index 99b330e..ca2a968 100644
--- a/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyTest.java
+++ b/webapp/src/test/java/org/apache/falcon/resource/EntityManagerJerseyTest.java
@@ -17,27 +17,7 @@
*/
package org.apache.falcon.resource;
-import java.io.File;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-
-import javax.servlet.ServletInputStream;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.FsShell;
-import org.apache.hadoop.fs.Path;
+import com.sun.jersey.api.client.ClientResponse;
import org.apache.falcon.FalconWebException;
import org.apache.falcon.entity.v0.EntityType;
import org.apache.falcon.entity.v0.feed.Feed;
@@ -47,20 +27,33 @@ import org.apache.falcon.entity.v0.process.Property;
import org.apache.falcon.entity.v0.process.Validity;
import org.apache.falcon.util.BuildProperties;
import org.apache.falcon.util.DeploymentProperties;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FsShell;
+import org.apache.hadoop.fs.Path;
import org.apache.oozie.client.BundleJob;
import org.apache.oozie.client.Job;
import org.apache.oozie.client.Job.Status;
import org.testng.Assert;
import org.testng.annotations.Test;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.servlet.ServletInputStream;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBException;
+import java.io.File;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
-public class EntityManagerJerseyTest extends AbstractTestBase{
+public class EntityManagerJerseyTest extends AbstractTestBase {
/**
* Tests should be enabled only in local environments as they need running
* instance of webserver
*/
-
+
@Test
public void testUpdateCheckUser() throws Exception {
Map<String, String> overlay = getUniqueOverlay();
@@ -72,37 +65,39 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
scheduleProcess(tmpFile.getAbsolutePath(), overlay);
waitForBundleStart(Status.RUNNING);
-
+
List<BundleJob> bundles = getBundles();
Assert.assertEquals(bundles.size(), 1);
Assert.assertEquals(bundles.get(0).getUser(), REMOTE_USER);
-
- ClientResponse response = this.service.path("api/entities/definition/feed/" + outputFeedName).header("Remote-User", REMOTE_USER)
+
+ ClientResponse response = this.service.path("api/entities/definition/feed/" + outputFeedName).header(
+ "Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
Feed feed = (Feed) EntityType.FEED.getUnmarshaller()
.unmarshal(new StringReader(response.getEntity(String.class)));
-
+
//change output feed path and update feed as another user
feed.getLocations().getLocations().get(0).setPath("/falcon/test/output2/${YEAR}/${MONTH}/${DAY}");
tmpFile = getTempFile();
EntityType.FEED.getMarshaller().marshal(feed, tmpFile);
- response = this.service.path("api/entities/update/feed/" + outputFeedName).header("Remote-User", "testuser").accept(MediaType.TEXT_XML)
+ response = this.service.path("api/entities/update/feed/" + outputFeedName).header("Remote-User",
+ "testuser").accept(MediaType.TEXT_XML)
.post(ClientResponse.class, getServletInputStream(tmpFile.getAbsolutePath()));
- assertSuccessful(response);
-
+ assertSuccessful(response);
+
bundles = getBundles();
Assert.assertEquals(bundles.size(), 2);
Assert.assertEquals(bundles.get(0).getUser(), REMOTE_USER);
Assert.assertEquals(bundles.get(1).getUser(), REMOTE_USER);
}
-
-
+
+
@Test(enabled = false)
public void testOptionalInput() throws Exception {
Map<String, String> overlay = getUniqueOverlay();
String tmpFileName = overlayParametersOverTemplate(PROCESS_TEMPLATE, overlay);
Process process = (Process) EntityType.PROCESS.getUnmarshaller().unmarshal(new File(tmpFileName));
-
+
Input in1 = process.getInputs().getInputs().get(0);
Input in2 = new Input();
in2.setFeed(in1.getFeed());
@@ -112,51 +107,53 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
in2.setStart("now(-1,0)");
in2.setEnd("now(0,0)");
process.getInputs().getInputs().add(in2);
-
+
File tmpFile = getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
scheduleProcess(tmpFile.getAbsolutePath(), overlay);
waitForWorkflowStart(processName);
}
-
- @Test
- public void testProcessDeleteAndSchedule() throws Exception {
- //Submit process with invalid property so that coord submit fails and bundle goes to failed state
- Map<String, String> overlay = getUniqueOverlay();
+
+ @Test
+ public void testProcessDeleteAndSchedule() throws Exception {
+ //Submit process with invalid property so that coord submit fails and bundle goes to failed state
+ Map<String, String> overlay = getUniqueOverlay();
String tmpFileName = overlayParametersOverTemplate(PROCESS_TEMPLATE, overlay);
- Process process = (Process) EntityType.PROCESS.getUnmarshaller().unmarshal(new File(tmpFileName));
- Property prop = new Property();
- prop.setName("newProp");
- prop.setValue("${formatTim()}");
+ Process process = (Process) EntityType.PROCESS.getUnmarshaller().unmarshal(new File(tmpFileName));
+ Property prop = new Property();
+ prop.setName("newProp");
+ prop.setValue("${formatTim()}");
process.getProperties().getProperties().add(prop);
File tmpFile = getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
scheduleProcess(tmpFile.getAbsolutePath(), overlay);
waitForBundleStart(Status.FAILED);
-
+
//Delete and re-submit the process with correct workflow
- ClientResponse clientRepsonse = this.service.path("api/entities/delete/process/" + processName).header("Remote-User", REMOTE_USER)
+ ClientResponse clientRepsonse = this.service.path("api/entities/delete/process/" + processName).header(
+ "Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_XML).delete(ClientResponse.class);
- assertSuccessful(clientRepsonse);
- process.getWorkflow().setPath("/falcon/test/workflow");
+ assertSuccessful(clientRepsonse);
+ process.getWorkflow().setPath("/falcon/test/workflow");
tmpFile = getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
clientRepsonse = this.service.path("api/entities/submitAndSchedule/process").header("Remote-User", REMOTE_USER)
- .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
+ .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
.post(ClientResponse.class, getServletInputStream(tmpFile.getAbsolutePath()));
- assertSuccessful(clientRepsonse);
-
+ assertSuccessful(clientRepsonse);
+
//Assert that new schedule creates new bundle
List<BundleJob> bundles = getBundles();
Assert.assertEquals(bundles.size(), 2);
- }
-
+ }
+
@Test
public void testProcessInputUpdate() throws Exception {
scheduleProcess();
waitForBundleStart(Job.Status.RUNNING);
-
- ClientResponse response = this.service.path("api/entities/definition/process/" + processName).header("Remote-User", REMOTE_USER)
+
+ ClientResponse response = this.service.path("api/entities/definition/process/" + processName).header(
+ "Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
Process process = (Process) EntityType.PROCESS.getUnmarshaller()
.unmarshal(new StringReader(response.getEntity(String.class)));
@@ -179,21 +176,23 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
processValidity.setEnd(new Date(new Date().getTime() + 2 * 24 * 60 * 60 * 1000));
File tmpFile = getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
- response = this.service.path("api/entities/update/process/" + processName).header("Remote-User", REMOTE_USER).accept(MediaType.TEXT_XML)
+ response = this.service.path("api/entities/update/process/" + processName).header("Remote-User",
+ REMOTE_USER).accept(MediaType.TEXT_XML)
.post(ClientResponse.class, getServletInputStream(tmpFile.getAbsolutePath()));
- assertSuccessful(response);
-
+ assertSuccessful(response);
+
//Assert that update creates new bundle
List<BundleJob> bundles = getBundles();
Assert.assertEquals(bundles.size(), 2);
}
-
+
@Test
public void testProcessEndtimeUpdate() throws Exception {
scheduleProcess();
waitForBundleStart(Job.Status.RUNNING);
-
- ClientResponse response = this.service.path("api/entities/definition/process/" + processName).header("Remote-User", REMOTE_USER)
+
+ ClientResponse response = this.service.path("api/entities/definition/process/" + processName).header(
+ "Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
Process process = (Process) EntityType.PROCESS.getUnmarshaller()
.unmarshal(new StringReader(response.getEntity(String.class)));
@@ -202,15 +201,16 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
processValidity.setEnd(new Date(new Date().getTime() + 60 * 60 * 1000));
File tmpFile = getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
- response = this.service.path("api/entities/update/process/" + processName).header("Remote-User", REMOTE_USER).accept(MediaType.TEXT_XML)
+ response = this.service.path("api/entities/update/process/" + processName).header("Remote-User",
+ REMOTE_USER).accept(MediaType.TEXT_XML)
.post(ClientResponse.class, getServletInputStream(tmpFile.getAbsolutePath()));
- assertSuccessful(response);
-
+ assertSuccessful(response);
+
//Assert that update does not create new bundle
List<BundleJob> bundles = getBundles();
Assert.assertEquals(bundles.size(), 1);
}
-
+
@Test
public void testStatus() throws Exception {
ClientResponse response;
@@ -227,12 +227,12 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
.header("Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
- APIResult result = (APIResult)unmarshaller.
+ APIResult result = (APIResult) unmarshaller.
unmarshal(new StringReader(response.getEntity(String.class)));
Assert.assertTrue(result.getMessage().contains("SUBMITTED"));
-
+
}
-
+
@Test
public void testIdempotentSubmit() throws Exception {
ClientResponse response;
@@ -242,33 +242,31 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
assertSuccessful(response);
response = submitToFalcon(CLUSTER_FILE_TEMPLATE, overlay, EntityType.CLUSTER);
- assertSuccessful(response);
+ assertSuccessful(response);
}
-
+
@Test
- public void testNotFoundStatus() throws FalconWebException
- {
- ClientResponse response;
- String feed1 = "f1" + System.currentTimeMillis();
- response = this.service
+ public void testNotFoundStatus() throws FalconWebException {
+ ClientResponse response;
+ String feed1 = "f1" + System.currentTimeMillis();
+ response = this.service
.path("api/entities/status/feed/" + feed1)
.header("Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
String status = response.getEntity(String.class);
- Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
-
+ Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
+
}
@Test
- public void testVersion() throws FalconWebException
- {
- ClientResponse response;
- response = this.service
+ public void testVersion() throws FalconWebException {
+ ClientResponse response;
+ response = this.service
.path("api/admin/version")
.header("Remote-User", REMOTE_USER)
.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
String status = response.getEntity(String.class);
- Assert.assertEquals(status, "{Version:\"" +
+ Assert.assertEquals(status, "{Version:\"" +
BuildProperties.get().getProperty("build.version") + "\",Mode:\"" +
DeploymentProperties.get().getProperty("deploy.mode") + "\"}");
@@ -304,42 +302,42 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
assertSuccessful(clientRepsonse);
}
- @Test
- public void testClusterSubmitScheduleSuspendResumeDelete() throws Exception {
- ClientResponse clientRepsonse;
+ @Test
+ public void testClusterSubmitScheduleSuspendResumeDelete() throws Exception {
+ ClientResponse clientRepsonse;
Map<String, String> overlay = getUniqueOverlay();
- clientRepsonse = submitToFalcon(CLUSTER_FILE_TEMPLATE, overlay,
- EntityType.CLUSTER);
- assertSuccessful(clientRepsonse);
+ clientRepsonse = submitToFalcon(CLUSTER_FILE_TEMPLATE, overlay,
+ EntityType.CLUSTER);
+ assertSuccessful(clientRepsonse);
- clientRepsonse = this.service
- .path("api/entities/schedule/cluster/" + clusterName)
+ clientRepsonse = this.service
+ .path("api/entities/schedule/cluster/" + clusterName)
.header("Remote-User", REMOTE_USER)
- .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
- .post(ClientResponse.class);
- assertFailure(clientRepsonse);
+ .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
+ .post(ClientResponse.class);
+ assertFailure(clientRepsonse);
- clientRepsonse = this.service
- .path("api/entities/suspend/cluster/" + clusterName)
+ clientRepsonse = this.service
+ .path("api/entities/suspend/cluster/" + clusterName)
.header("Remote-User", REMOTE_USER)
- .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
- .post(ClientResponse.class);
- assertFailure(clientRepsonse);
+ .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
+ .post(ClientResponse.class);
+ assertFailure(clientRepsonse);
- clientRepsonse = this.service
- .path("api/entities/resume/cluster/" + clusterName)
+ clientRepsonse = this.service
+ .path("api/entities/resume/cluster/" + clusterName)
.header("Remote-User", REMOTE_USER)
- .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
- .post(ClientResponse.class);
- assertFailure(clientRepsonse);
+ .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
+ .post(ClientResponse.class);
+ assertFailure(clientRepsonse);
- clientRepsonse = this.service
- .path("api/entities/delete/cluster/" + clusterName)
+ clientRepsonse = this.service
+ .path("api/entities/delete/cluster/" + clusterName)
.header("Remote-User", REMOTE_USER)
- .accept(MediaType.TEXT_XML).delete(ClientResponse.class);
- assertSuccessful(clientRepsonse);
- }
+ .accept(MediaType.TEXT_XML).delete(ClientResponse.class);
+ assertSuccessful(clientRepsonse);
+ }
@Test
public void testSubmit() throws Exception {
@@ -378,7 +376,7 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
String feedXML = response.getEntity(String.class);
try {
- Feed result = (Feed)unmarshaller.
+ Feed result = (Feed) unmarshaller.
unmarshal(new StringReader(feedXML));
Assert.assertEquals(result.getName(), overlay.get("inputFeedName"));
} catch (JAXBException e) {
@@ -398,7 +396,7 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
@Test
public void testScheduleSuspendResume() throws Exception {
scheduleProcess();
-
+
ClientResponse clientRepsonse = this.service
.path("api/entities/suspend/process/" + processName)
.header("Remote-User", REMOTE_USER)
@@ -412,7 +410,7 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
assertSuccessful(clientRepsonse);
}
- @Test (enabled = true)
+ @Test(enabled = true)
public void testFeedSchedule() throws Exception {
ClientResponse response;
Map<String, String> overlay = getUniqueOverlay();
@@ -425,10 +423,10 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
createTestData();
ClientResponse clientRepsonse = this.service
- .path("api/entities/schedule/feed/" + overlay.get("inputFeedName"))
+ .path("api/entities/schedule/feed/" + overlay.get("inputFeedName"))
.header("Remote-User", REMOTE_USER)
- .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
- .post(ClientResponse.class);
+ .accept(MediaType.TEXT_XML).type(MediaType.TEXT_XML)
+ .post(ClientResponse.class);
assertSuccessful(clientRepsonse);
}
@@ -479,7 +477,7 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
path = new Path("/examples/input-data/rawLogs/" + formatter.format(date) + "/file");
list.add(path);
fs.create(path).close();
- new FsShell(conf).run(new String[] {"-chown", "-R", "guest:users", "/examples/input-data/rawLogs"});
+ new FsShell(conf).run(new String[]{"-chown", "-R", "guest:users", "/examples/input-data/rawLogs"});
return list;
}
@@ -557,26 +555,26 @@ public class EntityManagerJerseyTest extends AbstractTestBase{
assertSuccessful(response);
}
-
+
@Test
public void testGetDependencies() throws Exception {
- ClientResponse response;
- response = this.service
+ ClientResponse response;
+ response = this.service
.path("api/entities/list/process/")
.header("Remote-User", REMOTE_USER).type(MediaType.TEXT_XML)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
- Assert.assertEquals(response.getStatus(), 200);
-
- Map<String, String> overlay = getUniqueOverlay();
+ Assert.assertEquals(response.getStatus(), 200);
+
+ Map<String, String> overlay = getUniqueOverlay();
response = submitToFalcon(CLUSTER_FILE_TEMPLATE, overlay, EntityType.CLUSTER);
assertSuccessful(response);
-
+
response = this.service
.path("api/entities/list/cluster/")
.header("Remote-User", REMOTE_USER).type(MediaType.TEXT_XML)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
Assert.assertEquals(response.getStatus(), 200);
-
+
}
}
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/java/org/apache/falcon/resource/ProcessInstanceManagerTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/resource/ProcessInstanceManagerTest.java b/webapp/src/test/java/org/apache/falcon/resource/ProcessInstanceManagerTest.java
index d5e861e..6ecc063 100644
--- a/webapp/src/test/java/org/apache/falcon/resource/ProcessInstanceManagerTest.java
+++ b/webapp/src/test/java/org/apache/falcon/resource/ProcessInstanceManagerTest.java
@@ -18,8 +18,6 @@
package org.apache.falcon.resource;
-import javax.ws.rs.core.MediaType;
-
import org.apache.falcon.Tag;
import org.apache.falcon.entity.EntityUtil;
import org.apache.falcon.entity.ExternalId;
@@ -34,9 +32,12 @@ import org.apache.oozie.client.WorkflowJob;
import org.testng.Assert;
import org.testng.annotations.Test;
-@Test(enabled=false)
+import javax.ws.rs.core.MediaType;
+
+@Test(enabled = false)
public class ProcessInstanceManagerTest extends AbstractTestBase {
private static final String START_INSTANCE = "2012-04-20T00:00Z";
+
protected void schedule() throws Exception {
scheduleProcess();
waitForProcessWFtoStart();
@@ -113,7 +114,7 @@ public class ProcessInstanceManagerTest extends AbstractTestBase {
public void testResumesInstances() throws Exception {
testSuspendInstances();
-
+
InstancesResult response = this.service.path("api/instance/resume/process/" + processName)
.queryParam("start", START_INSTANCE).header("Remote-User", "guest").accept(MediaType.APPLICATION_JSON)
.post(InstancesResult.class);
@@ -124,16 +125,18 @@ public class ProcessInstanceManagerTest extends AbstractTestBase {
waitForWorkflow(START_INSTANCE, WorkflowJob.Status.RUNNING);
}
-
+
private void waitForWorkflow(String instance, WorkflowJob.Status status) throws Exception {
ExternalId extId = new ExternalId(processName, Tag.DEFAULT, EntityUtil.parseDateUTC(instance));
- OozieClient ozClient = OozieClientFactory.get((Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
+ OozieClient ozClient = OozieClientFactory.get(
+ (Cluster) ConfigurationStore.get().get(EntityType.CLUSTER, clusterName));
String jobId = ozClient.getJobId(extId.getId());
WorkflowJob jobInfo = null;
for (int i = 0; i < 15; i++) {
jobInfo = ozClient.getJobInfo(jobId);
- if (jobInfo.getStatus() == status)
+ if (jobInfo.getStatus() == status) {
break;
+ }
System.out.println("Waiting for workflow job " + jobId + " status " + status);
Thread.sleep((i + 1) * 1000);
}
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/java/org/apache/falcon/security/BasicAuthFilterTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/security/BasicAuthFilterTest.java b/webapp/src/test/java/org/apache/falcon/security/BasicAuthFilterTest.java
index 3533aa2..238bfc4 100644
--- a/webapp/src/test/java/org/apache/falcon/security/BasicAuthFilterTest.java
+++ b/webapp/src/test/java/org/apache/falcon/security/BasicAuthFilterTest.java
@@ -32,9 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.Response;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.*;
public class BasicAuthFilterTest {
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/java/org/apache/falcon/util/ResourcesReflectionUtilTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/falcon/util/ResourcesReflectionUtilTest.java b/webapp/src/test/java/org/apache/falcon/util/ResourcesReflectionUtilTest.java
index 61c9c3f..96d5c53 100644
--- a/webapp/src/test/java/org/apache/falcon/util/ResourcesReflectionUtilTest.java
+++ b/webapp/src/test/java/org/apache/falcon/util/ResourcesReflectionUtilTest.java
@@ -19,24 +19,32 @@
package org.apache.falcon.util;
import junit.framework.Assert;
-
import org.testng.annotations.Test;
public class ResourcesReflectionUtilTest {
-
- @Test
- public void testMonitoredResources(){
- Assert.assertEquals("submit",ResourcesReflectionUtil.getResourceMonitorName("SchedulableEntityManagerProxy.submit"));
- Assert.assertEquals("entityType", ResourcesReflectionUtil.getResourceDimensionsName("SchedulableEntityManagerProxy.submit").get(1));
-
- Assert.assertEquals("submitAndSchedule",ResourcesReflectionUtil.getResourceMonitorName("SchedulableEntityManagerProxy.submitAndSchedule"));
- Assert.assertEquals("entityType", ResourcesReflectionUtil.getResourceDimensionsName("SchedulableEntityManagerProxy.submit").get(1));
-
- Assert.assertEquals("kill-instance",ResourcesReflectionUtil.getResourceMonitorName("InstanceManagerProxy.killInstance"));
- Assert.assertEquals("entityType", ResourcesReflectionUtil.getResourceDimensionsName("InstanceManagerProxy.killInstance").get(1));
-
- Assert.assertEquals("wf-instance-failed",ResourcesReflectionUtil.getResourceMonitorName("GenericAlert.instrumentFailedInstance"));
- Assert.assertEquals(new Integer(10), ResourcesReflectionUtil.getResourceTimeTakenName("GenericAlert.instrumentFailedInstance"));
- Assert.assertEquals(null, ResourcesReflectionUtil.getResourceTimeTakenName("GenericAlert.alertLateRerunFailed"));
- }
+
+ @Test
+ public void testMonitoredResources() {
+ Assert.assertEquals("submit",
+ ResourcesReflectionUtil.getResourceMonitorName("SchedulableEntityManagerProxy.submit"));
+ Assert.assertEquals("entityType",
+ ResourcesReflectionUtil.getResourceDimensionsName("SchedulableEntityManagerProxy.submit").get(1));
+
+ Assert.assertEquals("submitAndSchedule",
+ ResourcesReflectionUtil.getResourceMonitorName("SchedulableEntityManagerProxy.submitAndSchedule"));
+ Assert.assertEquals("entityType",
+ ResourcesReflectionUtil.getResourceDimensionsName("SchedulableEntityManagerProxy.submit").get(1));
+
+ Assert.assertEquals("kill-instance",
+ ResourcesReflectionUtil.getResourceMonitorName("InstanceManagerProxy.killInstance"));
+ Assert.assertEquals("entityType",
+ ResourcesReflectionUtil.getResourceDimensionsName("InstanceManagerProxy.killInstance").get(1));
+
+ Assert.assertEquals("wf-instance-failed",
+ ResourcesReflectionUtil.getResourceMonitorName("GenericAlert.instrumentFailedInstance"));
+ Assert.assertEquals(new Integer(10),
+ ResourcesReflectionUtil.getResourceTimeTakenName("GenericAlert.instrumentFailedInstance"));
+ Assert.assertEquals(null,
+ ResourcesReflectionUtil.getResourceTimeTakenName("GenericAlert.alertLateRerunFailed"));
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/cluster-template.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/cluster-template.xml b/webapp/src/test/resources/cluster-template.xml
index 4bcad41..b3ba11b 100644
--- a/webapp/src/test/resources/cluster-template.xml
+++ b/webapp/src/test/resources/cluster-template.xml
@@ -17,24 +17,25 @@
limitations under the License.
-->
-<cluster colo="gs" description="" name="##cluster##" xmlns="uri:falcon:cluster:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <interfaces>
- <interface type="readonly" endpoint="hftp://localhost:50010"
- version="0.20.2" />
- <interface type="write" endpoint="hdfs://localhost:8020"
- version="0.20.2" />
- <interface type="execute" endpoint="localhost:8021" version="0.20.2" />
- <interface type="workflow" endpoint="http://localhost:11000/oozie/"
- version="3.1" />
- <interface type="messaging" endpoint="tcp://10.14.117.33:61616?daemon=true"
- version="5.1.6" />
- <interface type="registry" endpoint="Hcat" version="1" />
- </interfaces>
- <locations>
- <location name="staging" path="/projects/falcon/staging" />
- <location name="temp" path="/tmp" />
- <location name="working" path="/project/falcon/working" />
- </locations>
- <properties>
- </properties>
+<cluster colo="gs" description="" name="##cluster##" xmlns="uri:falcon:cluster:0.1"
+ >
+ <interfaces>
+ <interface type="readonly" endpoint="hftp://localhost:50010"
+ version="0.20.2"/>
+ <interface type="write" endpoint="hdfs://localhost:8020"
+ version="0.20.2"/>
+ <interface type="execute" endpoint="localhost:8021" version="0.20.2"/>
+ <interface type="workflow" endpoint="http://localhost:11000/oozie/"
+ version="3.1"/>
+ <interface type="messaging" endpoint="tcp://10.14.117.33:61616?daemon=true"
+ version="5.1.6"/>
+ <interface type="registry" endpoint="Hcat" version="1"/>
+ </interfaces>
+ <locations>
+ <location name="staging" path="/projects/falcon/staging"/>
+ <location name="temp" path="/tmp"/>
+ <location name="working" path="/project/falcon/working"/>
+ </locations>
+ <properties>
+ </properties>
</cluster>
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/feed-template1.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/feed-template1.xml b/webapp/src/test/resources/feed-template1.xml
index 3797df4..8d0c5e1 100644
--- a/webapp/src/test/resources/feed-template1.xml
+++ b/webapp/src/test/resources/feed-template1.xml
@@ -16,7 +16,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<feed description="clicks log" name="##inputFeedName##" xmlns="uri:falcon:feed:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<feed description="clicks log" name="##inputFeedName##" xmlns="uri:falcon:feed:0.1"
+ >
<partitions>
<partition name="timestamp"/>
</partitions>
@@ -24,21 +25,22 @@
<frequency>hours(1)</frequency>
<timezone>UTC</timezone>
- <late-arrival cut-off="hours(6)" />
+ <late-arrival cut-off="hours(6)"/>
<clusters>
<cluster name="##cluster##" type="source">
<validity start="2010-01-01T00:00Z" end="2012-04-21T00:00Z"/>
- <retention limit="hours(24)" action="delete" /> <!-- Limit can be in Time or Instances 100, Action ENUM DELETE,ARCHIVE -->
+ <retention limit="hours(24)" action="delete"/>
+ <!-- Limit can be in Time or Instances 100, Action ENUM DELETE,ARCHIVE -->
</cluster>
</clusters>
<locations>
- <location type="data" path="/falcon/test/input/${YEAR}/${MONTH}/${DAY}/${HOUR}" />
- <location type="stats" path="/projects/falcon/clicksStats" />
- <location type="meta" path="/projects/falcon/clicksMetaData" />
+ <location type="data" path="/falcon/test/input/${YEAR}/${MONTH}/${DAY}/${HOUR}"/>
+ <location type="stats" path="/projects/falcon/clicksStats"/>
+ <location type="meta" path="/projects/falcon/clicksMetaData"/>
</locations>
-
- <ACL owner="testuser" group="group" permission="0x755" />
- <schema location="/schema/clicks" provider="protobuf" />
+
+ <ACL owner="testuser" group="group" permission="0x755"/>
+ <schema location="/schema/clicks" provider="protobuf"/>
</feed>
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/feed-template2.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/feed-template2.xml b/webapp/src/test/resources/feed-template2.xml
index aa1f4ac..80a62ed 100644
--- a/webapp/src/test/resources/feed-template2.xml
+++ b/webapp/src/test/resources/feed-template2.xml
@@ -16,26 +16,28 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<feed description="clicks log" name="##outputFeedName##" xmlns="uri:falcon:feed:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<feed description="clicks log" name="##outputFeedName##" xmlns="uri:falcon:feed:0.1"
+ >
<groups>output</groups>
<frequency>days(1)</frequency>
<timezone>UTC</timezone>
- <late-arrival cut-off="hours(6)" />
+ <late-arrival cut-off="hours(6)"/>
<clusters>
<cluster name="##cluster##" type="source">
<validity start="2010-01-01T01:00Z" end="##feedEndDate##"/>
- <retention limit="hours(6)" action="delete" /> <!-- Limit can be in Time or Instances 100, Action ENUM DELETE,ARCHIVE -->
+ <retention limit="hours(6)" action="delete"/>
+ <!-- Limit can be in Time or Instances 100, Action ENUM DELETE,ARCHIVE -->
</cluster>
</clusters>
<locations>
- <location type="data" path="/falcon/test/output/${YEAR}/${MONTH}/${DAY}" />
- <location type="stats" path="/projects/falcon/clicksStats" />
- <location type="meta" path="/projects/falcon/clicksMetaData" />
+ <location type="data" path="/falcon/test/output/${YEAR}/${MONTH}/${DAY}"/>
+ <location type="stats" path="/projects/falcon/clicksStats"/>
+ <location type="meta" path="/projects/falcon/clicksMetaData"/>
</locations>
-
- <ACL owner="testuser" group="group" permission="0x755" />
- <schema location="/schema/clicks" provider="protobuf" />
+
+ <ACL owner="testuser" group="group" permission="0x755"/>
+ <schema location="/schema/clicks" provider="protobuf"/>
</feed>
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/org/apache/falcon/logging/process.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/org/apache/falcon/logging/process.xml b/webapp/src/test/resources/org/apache/falcon/logging/process.xml
index 9b65800..ae8ba16 100644
--- a/webapp/src/test/resources/org/apache/falcon/logging/process.xml
+++ b/webapp/src/test/resources/org/apache/falcon/logging/process.xml
@@ -17,11 +17,11 @@
limitations under the License.
-->
-<process name="process-name" xmlns="uri:falcon:process:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<process name="process-name" xmlns="uri:falcon:process:0.1">
<!-- where -->
<clusters>
<cluster name="testCluster">
- <validity start="2010-01-01T01:00Z" end="2010-01-01T01:01Z" />
+ <validity start="2010-01-01T01:00Z" end="2010-01-01T01:01Z"/>
</cluster>
</clusters>
@@ -30,13 +30,13 @@
<order>LIFO</order>
<frequency>minutes(1)</frequency>
<timezone>UTC</timezone>
-
+
<properties>
- <property name="queueName" value="default" />
+ <property name="queueName" value="default"/>
</properties>
<workflow path="/workflow/workflow.xml"/>
- <retry policy="periodic" delay="minutes(2)" attempts="3" />
-
+ <retry policy="periodic" delay="minutes(2)" attempts="3"/>
+
</process>
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/org/apache/falcon/logging/workflow.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/org/apache/falcon/logging/workflow.xml b/webapp/src/test/resources/org/apache/falcon/logging/workflow.xml
index 3ab3d29..4fc73d1 100644
--- a/webapp/src/test/resources/org/apache/falcon/logging/workflow.xml
+++ b/webapp/src/test/resources/org/apache/falcon/logging/workflow.xml
@@ -17,31 +17,31 @@
-->
<workflow-app xmlns="uri:oozie:workflow:0.2" name="test-wf">
- <start to="fsAction" />
- <action name="fsAction">
- <fs>
- <delete path="${nameNode}/test/dir1" />
- <mkdir path="${nameNode}/test/dir1" />
- </fs>
- <ok to="javaAction" />
- <error to="fail" />
- </action>
- <action name="javaAction">
- <java>
- <job-tracker>${jobTracker}</job-tracker>
- <name-node>${nameNode}</name-node>
- <main-class>org.apache.oozie.example.DemoJavaMain</main-class>
- <arg>Hello</arg>
- <arg>Oozie!</arg>
- </java>
+ <start to="fsAction"/>
+ <action name="fsAction">
+ <fs>
+ <delete path="${nameNode}/test/dir1"/>
+ <mkdir path="${nameNode}/test/dir1"/>
+ </fs>
+ <ok to="javaAction"/>
+ <error to="fail"/>
+ </action>
+ <action name="javaAction">
+ <java>
+ <job-tracker>${jobTracker}</job-tracker>
+ <name-node>${nameNode}</name-node>
+ <main-class>org.apache.oozie.example.DemoJavaMain</main-class>
+ <arg>Hello</arg>
+ <arg>Oozie!</arg>
+ </java>
<ok to="end"/>
<error to="fail"/>
- </action>
- <kill name="fail">
- <message>Job failed, error
- message[${wf:errorMessage(wf:lastErrorNode())}]
- </message>
- </kill>
- <end name="end" />
+ </action>
+ <kill name="fail">
+ <message>Job failed, error
+ message[${wf:errorMessage(wf:lastErrorNode())}]
+ </message>
+ </kill>
+ <end name="end"/>
</workflow-app>
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/process-template.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/process-template.xml b/webapp/src/test/resources/process-template.xml
index ff10889..716a458 100644
--- a/webapp/src/test/resources/process-template.xml
+++ b/webapp/src/test/resources/process-template.xml
@@ -17,10 +17,10 @@
limitations under the License.
-->
-<process name="##processName##" xmlns="uri:falcon:process:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<process name="##processName##" xmlns="uri:falcon:process:0.1">
<clusters>
<cluster name="##cluster##">
- <validity end="2012-04-21T00:00Z" start="2012-04-20T00:00Z" />
+ <validity end="2012-04-21T00:00Z" start="2012-04-20T00:00Z"/>
</cluster>
</clusters>
@@ -28,22 +28,22 @@
<order>FIFO</order>
<frequency>days(1)</frequency>
<timezone>UTC</timezone>
-
+
<inputs>
<input end="today(0,0)" start="today(0,0)" feed="##inputFeedName##" name="input" partition="${fileTime}"/>
</inputs>
<outputs>
- <output instance="now(0,0)" feed="##outputFeedName##" name="output" />
+ <output instance="now(0,0)" feed="##outputFeedName##" name="output"/>
</outputs>
<properties>
<property name="fileTime" value="${formatTime(dateOffset(instanceTime(), 1, 'DAY'), 'yyyy-MMM-dd')}"/>
<property name="user" value="${user()}"/>
<property name="baseTime" value="${today(0,0)}"/>
</properties>
- <workflow engine="oozie" path="/falcon/test/workflow" />
- <retry policy="periodic" delay="minutes(10)" attempts="3" />
+ <workflow engine="oozie" path="/falcon/test/workflow"/>
+ <retry policy="periodic" delay="minutes(10)" attempts="3"/>
<late-process policy="exp-backoff" delay="hours(1)">
- <late-input input="input" workflow-path="/falcon/test/workflow" />
+ <late-input input="input" workflow-path="/falcon/test/workflow"/>
</late-process>
</process>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/webapp/src/test/resources/process-version-0.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/process-version-0.xml b/webapp/src/test/resources/process-version-0.xml
index a9b5557..3ac7ac8 100644
--- a/webapp/src/test/resources/process-version-0.xml
+++ b/webapp/src/test/resources/process-version-0.xml
@@ -16,12 +16,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<process name="sample" xmlns="uri:falcon:process:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<process name="sample" xmlns="uri:falcon:process:0.1">
<!-- where -->
<clusters>
- <cluster name="testCluster">
- <validity start="2011-11-01T00:00Z" end="2011-12-31T23:59Z"/>
- </cluster>
+ <cluster name="testCluster">
+ <validity start="2011-11-01T00:00Z" end="2011-12-31T23:59Z"/>
+ </cluster>
</clusters>
<!-- when -->
@@ -29,30 +29,30 @@
<order>LIFO</order>
<frequency>hours(1)</frequency>
<timezone>UTC</timezone>
-
+
<!-- what -->
<inputs>
- <input name="input1" feed="inputFeed1" start="$ptime-6" end="$ptime" />
- <input name="input2" feed="inputFeed2" start="$ptime" end="$ptime" />
+ <input name="input1" feed="inputFeed1" start="$ptime-6" end="$ptime"/>
+ <input name="input2" feed="inputFeed2" start="$ptime" end="$ptime"/>
</inputs>
<outputs>
- <output name="output1" feed="outputFeed1" instance="$ptime" />
- <output name="output2" feed="outputFeed2" instance="$ptime" />
+ <output name="output1" feed="outputFeed1" instance="$ptime"/>
+ <output name="output2" feed="outputFeed2" instance="$ptime"/>
</outputs>
<!-- how -->
<properties>
- <property name="name" value="value" />
- <property name="name" value="value" />
+ <property name="name" value="value"/>
+ <property name="name" value="value"/>
</properties>
- <workflow engine="oozie" path="hdfs://path/to/workflow" />
+ <workflow engine="oozie" path="hdfs://path/to/workflow"/>
- <retry policy="periodic" delay="minutes(10)" attempts="3" />
+ <retry policy="periodic" delay="minutes(10)" attempts="3"/>
<late-process policy="exp-backoff" delay="hours(1)">
- <late-input input="impression" workflow-path="/impression/late/workflow" />
- <late-input input="clicks" workflow-path="/clicks/late/workflow" />
+ <late-input input="impression" workflow-path="/impression/late/workflow"/>
+ <late-input input="clicks" workflow-path="/clicks/late/workflow"/>
</late-process>
</process>