You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by rk...@apache.org on 2012/12/08 01:10:02 UTC
svn commit: r1418563 - in /oozie/trunk: ./
core/src/test/java/org/apache/oozie/action/hadoop/
core/src/test/java/org/apache/oozie/command/
core/src/test/java/org/apache/oozie/command/bundle/
core/src/test/java/org/apache/oozie/command/coord/ core/src/t...
Author: rkanter
Date: Sat Dec 8 00:09:59 2012
New Revision: 1418563
URL: http://svn.apache.org/viewvc?rev=1418563&view=rev
Log:
OOZIE-1114 Some tests don't use the Services singleton properly (rkanter)
Modified:
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsActionExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsELFunctions.java
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/TestCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordKillXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowKillXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInfoJPAExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSubsetJPAExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestActionService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallableQueueService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallbackService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestDagXLogInfoService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestELService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestGroupsService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestInstrumentationService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestMemoryLocksService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPauseTransitService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestProxyUserService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchedulerService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestServices.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestUUIDService.java
oozie/trunk/core/src/test/java/org/apache/oozie/util/TestXLogFilter.java
oozie/trunk/core/src/test/java/org/apache/oozie/util/db/TestSqlStatement.java
oozie/trunk/release-log.txt
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsActionExecutor.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsActionExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsActionExecutor.java Sat Dec 8 00:09:59 2012
@@ -85,6 +85,7 @@ public class TestFsActionExecutor extend
}
// testing schemes supported
+ Services.get().destroy();
setSystemProperty(HadoopAccessorService.SUPPORTED_FILESYSTEMS, "hdfs,viewfs");
new Services().init();
try {
@@ -106,6 +107,7 @@ public class TestFsActionExecutor extend
public void testFileSchemeWildcard() throws Exception {
FsActionExecutor ae = new FsActionExecutor();
+ Services.get().destroy();
setSystemProperty(HadoopAccessorService.SUPPORTED_FILESYSTEMS, "*");
new Services().init();
@@ -148,6 +150,7 @@ public class TestFsActionExecutor extend
assertEquals("FS001", ex.getErrorCode());
}
+ Services.get().destroy();
setSystemProperty(HadoopAccessorService.SUPPORTED_FILESYSTEMS, null);
new Services().init();
try {
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsELFunctions.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsELFunctions.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsELFunctions.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestFsELFunctions.java Sat Dec 8 00:09:59 2012
@@ -40,10 +40,19 @@ import org.apache.oozie.util.XConfigurat
public class TestFsELFunctions extends XFsTestCase {
- public void testFunctions() throws Exception {
- Services services = new Services();
- services.init();
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
+ public void testFunctions() throws Exception {
String file1 = new Path(getFsTestCaseDir(), "file1").toString();
String file2 = new Path(getFsTestCaseDir(), "file2").toString();
String dir = new Path(getFsTestCaseDir(), "dir").toString();
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestJavaActionExecutor.java Sat Dec 8 00:09:59 2012
@@ -1029,6 +1029,7 @@ public class TestJavaActionExecutor exte
Path appPath = new Path("localfs://namenode:port/mydir");
JavaActionExecutor ae = new JavaActionExecutor();
JobConf conf = ae.createBaseHadoopConf(context, eActionXml);
+ Services.get().destroy();
setSystemProperty(HadoopAccessorService.SUPPORTED_FILESYSTEMS, "hdfs,viewfs");
new Services().init();
ae.setupActionConf(conf, context, eActionXml, appPath);
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestPigActionExecutor.java Sat Dec 8 00:09:59 2012
@@ -279,6 +279,7 @@ public class TestPigActionExecutor exten
* value
*/
public void testExecutionStatsWithMaxStatsSizeLimit() throws Exception {
+ Services.get().destroy();
// Set a very small value for max size of stats
setSystemProperty(JavaActionExecutor.MAX_EXTERNAL_STATS_SIZE, new String("1"));
new Services().init();
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/TestCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/TestCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/TestCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/TestCommand.java Sat Dec 8 00:09:59 2012
@@ -36,6 +36,18 @@ import java.util.UUID;
public class TestCommand extends XTestCase {
private static List<String> EXECUTED = Collections.synchronizedList(new ArrayList<String>());
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
private static class DummyXCallable implements XCallable<Void> {
private String name;
private String key = null;
@@ -140,9 +152,6 @@ public class TestCommand extends XTestCa
}
public void testDagCommand() throws Exception {
- Services services = new Services();
- services.init();
-
XLog.Info.get().clear();
XLog.Info.get().setParameter(DagXLogInfoService.JOB, "job");
XLog.Info.get().setParameter(DagXLogInfoService.ACTION, "action");
@@ -191,9 +200,6 @@ public class TestCommand extends XTestCa
assertEquals(1, EXECUTED.size());
assertEquals(Arrays.asList("ex"), EXECUTED);
-
-
- services.destroy();
}
/**
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleRerunXCommand.java Sat Dec 8 00:09:59 2012
@@ -134,7 +134,8 @@ public class TestBundleRerunXCommand ext
public void testBundleRerunWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- new Services().init();
+ services = new Services();
+ services.init();
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.DONEWITHERROR, false);
this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.SUCCEEDED);
this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.FAILED);
@@ -214,7 +215,8 @@ public class TestBundleRerunXCommand ext
Date pauseTime = new Date(curr.getTime() - 1000);
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- new Services().init();
+ services = new Services();
+ services.init();
BundleJobBean job = this.addRecordToBundleJobTableWithPausedTime(Job.Status.PAUSEDWITHERROR, false, pauseTime);
this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.FAILED);
this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.PAUSED);
@@ -268,7 +270,8 @@ public class TestBundleRerunXCommand ext
public void testBundleRerunInSuspendedWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- new Services().init();
+ services = new Services();
+ services.init();
BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUSPENDEDWITHERROR, false);
this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.SUSPENDED);
this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.SUSPENDEDWITHERROR);
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java Sat Dec 8 00:09:59 2012
@@ -289,7 +289,8 @@ public class TestCoordActionInputCheckXC
String[] whiteList = new String[1];
whiteList[0] = "localhost:5330";
setSystemProperty(HadoopAccessorService.NAME_NODE_WHITELIST, whiteList[0]);
- new Services().init();
+ services = new Services();
+ services.init();
// setting the configuration
XConfiguration jobConf = new XConfiguration();
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java Sat Dec 8 00:09:59 2012
@@ -279,7 +279,8 @@ public class TestCoordChangeXCommand ext
public void testCoordChangeStatus() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- new Services().init();
+ services = new Services();
+ services.init();
Date startTime = new Date();
Date endTime = new Date(startTime.getTime() + (20 * 60 * 1000));
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordKillXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordKillXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordKillXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordKillXCommand.java Sat Dec 8 00:09:59 2012
@@ -160,7 +160,7 @@ public class TestCoordKillXCommand exten
public void testCoordKillForBackwardSupport() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java Sat Dec 8 00:09:59 2012
@@ -711,7 +711,8 @@ public class TestCoordRerunXCommand exte
public void testCoordRerunInDoneWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- new Services().init();
+ services = new Services();
+ services.init();
CoordinatorJobBean job = this.addRecordToCoordJobTable(Job.Status.DONEWITHERROR, false, false);
addRecordToCoordActionTable(job.getId(), 1, CoordinatorAction.Status.FAILED, "coord-rerun-action1.xml", 0);
@@ -833,7 +834,8 @@ public class TestCoordRerunXCommand exte
public void testCoordRerunForBackwardSupport1() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- new Services().init();
+ services = new Services();
+ services.init();
Date start = DateUtils.parseDateOozieTZ("2009-02-01T01:00Z");
Date end = DateUtils.parseDateOozieTZ("2009-02-02T23:59Z");
@@ -881,7 +883,8 @@ public class TestCoordRerunXCommand exte
public void testCoordRerunForBackwardSupport2() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- new Services().init();
+ services = new Services();
+ services.init();
Date start = DateUtils.parseDateOozieTZ("2009-02-01T01:00Z");
Date end = DateUtils.parseDateOozieTZ("2009-02-02T23:59Z");
@@ -930,7 +933,8 @@ public class TestCoordRerunXCommand exte
public void testCoordRerunForBackwardSupport3() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- new Services().init();
+ services = new Services();
+ services.init();
Date start = DateUtils.parseDateOozieTZ("2009-02-01T01:00Z");
Date end = DateUtils.parseDateOozieTZ("2009-02-02T23:59Z");
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java Sat Dec 8 00:09:59 2012
@@ -122,7 +122,8 @@ public class TestCoordResumeXCommand ext
public void testCoordSuspendAndResumeForPrepWithBackwardCompatibility() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- new Services().init();
+ services = new Services();
+ services.init();
CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.PREP, false, false);
job.setAppNamespace(SchemaService.COORDINATOR_NAMESPACE_URI_1);
JPAService jpaService = Services.get().get(JPAService.class);
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowKillXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowKillXCommand.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowKillXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowKillXCommand.java Sat Dec 8 00:09:59 2012
@@ -163,8 +163,9 @@ public class TestWorkflowKillXCommand ex
public void testChildId() throws Exception {
+ services.destroy();
setSystemProperty(UUIDService.CONF_GENERATOR, "counter");
- Services services = new Services();
+ services = new Services();
services.init();
UUIDService uuid = services.get(UUIDService.class);
String id = uuid.generateId(ApplicationType.WORKFLOW);
@@ -181,7 +182,6 @@ public class TestWorkflowKillXCommand ex
childId = uuid.generateChildId(id, "a");
assertEquals(id, uuid.getId(childId));
assertEquals("a", uuid.getChildName(childId));
- services.destroy();
}
/**
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInfoJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInfoJPAExecutor.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInfoJPAExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInfoJPAExecutor.java Sat Dec 8 00:09:59 2012
@@ -123,22 +123,18 @@ public class TestCoordActionGetForInfoJP
}
public void testCoordActionGetAllColumns() throws Exception {
+ services.destroy();
setSystemProperty(CoordActionGetForInfoJPAExecutor.COORD_GET_ALL_COLS_FOR_ACTION, "true");
- new Services().init();
- try {
- String resourceXmlName = "coord-action-get.xml";
- CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
- CoordinatorActionBean action = createCoordAction(job.getId(), 1, CoordinatorAction.Status.WAITING,
- resourceXmlName, 0);
- String slaXml = "slaXml";
- action.setSlaXml(slaXml);
- // Insert the action
- insertRecordCoordAction(action);
- _testGetForInfoAllActions(action.getId(), slaXml);
- }
- finally {
- Services.get().destroy();
- }
+ services = new Services();
+ services.init();
+ String resourceXmlName = "coord-action-get.xml";
+ CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ CoordinatorActionBean action = createCoordAction(job.getId(), 1, CoordinatorAction.Status.WAITING, resourceXmlName, 0);
+ String slaXml = "slaXml";
+ action.setSlaXml(slaXml);
+ // Insert the action
+ insertRecordCoordAction(action);
+ _testGetForInfoAllActions(action.getId(), slaXml);
}
private void _testGetForInfoAllActions(String actionId, String slaXml) throws Exception{
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSubsetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSubsetJPAExecutor.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSubsetJPAExecutor.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSubsetJPAExecutor.java Sat Dec 8 00:09:59 2012
@@ -159,22 +159,19 @@ public class TestCoordJobGetActionsSubse
}
public void testGetActionAllColumns() throws Exception{
+ services.destroy();
setSystemProperty(CoordActionGetForInfoJPAExecutor.COORD_GET_ALL_COLS_FOR_ACTION, "true");
- new Services().init();
- try {
- int actionNum = 1;
- String slaXml = "slaXml";
- String resourceXmlName = "coord-action-get.xml";
- CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
- CoordinatorActionBean action = createCoordAction(job.getId(), actionNum, CoordinatorAction.Status.WAITING,
- resourceXmlName, 0);
- action.setSlaXml(slaXml);
- insertRecordCoordAction(action);
- _testGetForInfoAllActions(job.getId(), slaXml, 1, 1);
- }
- finally {
- Services.get().destroy();
- }
+ services = new Services();
+ services.init();
+ int actionNum = 1;
+ String slaXml = "slaXml";
+ String resourceXmlName = "coord-action-get.xml";
+ CoordinatorJobBean job = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, false, false);
+ CoordinatorActionBean action = createCoordAction(job.getId(), actionNum, CoordinatorAction.Status.WAITING,
+ resourceXmlName, 0);
+ action.setSlaXml(slaXml);
+ insertRecordCoordAction(action);
+ _testGetForInfoAllActions(job.getId(), slaXml, 1, 1);
}
private void _testGetForInfoAllActions(String jobId, String slaXml, int start, int len) throws Exception {
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestActionService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestActionService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestActionService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestActionService.java Sat Dec 8 00:09:59 2012
@@ -23,19 +23,25 @@ import org.apache.oozie.test.XTestCase;
public class TestActionService extends XTestCase {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
public void testService() throws Exception {
- Services services = new Services();
- services.init();
- assertNotNull(services.get(ActionService.class));
- services.destroy();
+ assertNotNull(Services.get().get(ActionService.class));
}
public void testActions() throws Exception {
- Services services = new Services();
- services.init();
- ActionService as = services.get(ActionService.class);
+ ActionService as = Services.get().get(ActionService.class);
assertNotNull(as.getExecutor("switch"));
- services.destroy();
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallableQueueService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallableQueueService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallableQueueService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallableQueueService.java Sat Dec 8 00:09:59 2012
@@ -187,11 +187,20 @@ public class TestCallableQueueService ex
}
}
- public void testQueuing() throws Exception {
- Services services = new Services();
- services.init();
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
+ public void testQueuing() throws Exception {
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final MyCallable callable = new MyCallable();
queueservice.queue(callable);
@@ -201,16 +210,10 @@ public class TestCallableQueueService ex
}
});
assertTrue(callable.executed != 0);
-
- services.destroy();
-
}
public void testDelayedQueuing() throws Exception {
- Services services = new Services();
- services.init();
-
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final MyCallable callable = new MyCallable();
long scheduled = System.currentTimeMillis();
@@ -221,17 +224,15 @@ public class TestCallableQueueService ex
}
});
assertTrue(callable.executed >= scheduled + 1000);
-
- services.destroy();
}
public void testPriorityExecution() throws Exception {
EXEC_ORDER = new AtomicLong();
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_THREADS, "1");
- Services services = new Services();
- services.init();
+ new Services().init();
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final MyCallable callable1 = new MyCallable(0, 200);
final MyCallable callable2 = new MyCallable(0, 200);
@@ -257,20 +258,15 @@ public class TestCallableQueueService ex
assertTrue(callableLow.executed >= 0);
assertTrue(callableHigh.executed >= 0);
assertTrue(callableHigh.order < callableLow.order);
-
- services.destroy();
-
}
public void testQueueSerial() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable(0, 10);
final MyCallable callable2 = new MyCallable(0, 10);
final MyCallable callable3 = new MyCallable(0, 10);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
queueservice.queueSerial(Arrays.asList(callable1, callable2, callable3));
waitFor(100, new Predicate() {
@@ -281,8 +277,6 @@ public class TestCallableQueueService ex
assertEquals(0, callable1.order);
assertEquals(1, callable2.order);
assertEquals(2, callable3.order);
-
- services.destroy();
}
public static class CLCallable implements XCallable<Void> {
@@ -357,11 +351,8 @@ public class TestCallableQueueService ex
}
public void testConcurrencyLimit() throws Exception {
- Services services = new Services();
- services.init();
-
CLCallable.resetConcurrency();
- final CallableQueueService queueservice = services.get(CallableQueueService.class);
+ final CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
for (int i = 0; i < 10; i++) {
queueservice.queue(new CLCallable(), 10);
@@ -384,8 +375,6 @@ public class TestCallableQueueService ex
System.out.println("CLCallable Concurrency :" + CLCallable.getConcurrency());
assertTrue(CLCallable.getConcurrency() <= 3);
-
- services.destroy();
}
/**
@@ -395,12 +384,12 @@ public class TestCallableQueueService ex
* @throws Exception
*/
public void testConcurrencyReachedAndChooseNextEligible() throws Exception {
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_CALLABLE_NEXT_ELIGIBLE, "true");
- Services services = new Services();
- services.init();
+ new Services().init();
CLCallable.resetConcurrency();
- final CallableQueueService queueservice = services.get(CallableQueueService.class);
+ final CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final MyCallable callable1 = new MyCallable(0, 100);
final MyCallable callable2 = new MyCallable(0, 100);
@@ -441,14 +430,10 @@ public class TestCallableQueueService ex
System.out.println("Callable callableOther executed :" + callableOther.executed);
assertTrue(callableOther.executed < last);
-
- services.destroy();
}
public void testSerialConcurrencyLimit() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("TestSerialConcurrencyLimit", 0, 100);
final MyCallable callable2 = new MyCallable("TestSerialConcurrencyLimit", 0, 100);
final MyCallable callable3 = new MyCallable("TestSerialConcurrencyLimit", 0, 100);
@@ -457,7 +442,7 @@ public class TestCallableQueueService ex
List<MyCallable> callables = Arrays.asList(callable1, callable2, callable3, callable4, callable5);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
String type = "SerialConcurrencyLimit";
for (MyCallable c : callables) {
@@ -484,14 +469,10 @@ public class TestCallableQueueService ex
}
}
assertTrue(secondBatch >= 2);
-
- services.destroy();
}
public void testConcurrency() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("TestConcurrency", 0, 100);
final MyCallable callable2 = new MyCallable("TestConcurrency", 0, 100);
final MyCallable callable3 = new MyCallable("TestConcurrency", 0, 100);
@@ -500,7 +481,7 @@ public class TestCallableQueueService ex
List<MyCallable> callables = Arrays.asList(callable1, callable2, callable3, callable4, callable5);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
for (MyCallable c : callables) {
queueservice.queue(c);
@@ -526,21 +507,17 @@ public class TestCallableQueueService ex
}
}
assertTrue(secondBatch >= 2);
-
- services.destroy();
}
public void testQueueUniquenessWithSameKey() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("QueueUniquenessWithSameKey", "QueueUniquenessWithSameKey", 0, 100);
final MyCallable callable2 = new MyCallable("QueueUniquenessWithSameKey", "QueueUniquenessWithSameKey", 0, 100);
final MyCallable callable3 = new MyCallable("QueueUniquenessWithSameKey", "QueueUniquenessWithSameKey", 0, 100);
List<MyCallable> callables = Arrays.asList(callable1, callable2, callable3);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
for (MyCallable c : callables) {
queueservice.queue(c);
@@ -555,21 +532,17 @@ public class TestCallableQueueService ex
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed == 0);
assertTrue(callable3.executed == 0);
-
- services.destroy();
}
public void testQueueUniquenessWithSameKeyInComposite() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("QueueUniquenessWithSameKeyInComposite", "QueueUniquenessWithSameKeyInComposite", 0, 200);
final MyCallable callable2 = new MyCallable("QueueUniquenessWithSameKeyInComposite", "QueueUniquenessWithSameKeyInComposite", 0, 200);
final MyCallable callable3 = new MyCallable("QueueUniquenessWithSameKeyInComposite", "QueueUniquenessWithSameKeyInComposite", 0, 200);
List<MyCallable> callables = Arrays.asList(callable1, callable2, callable3);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
String type = "QueueUniquenessWithSameKeyInComposite";
for (MyCallable c : callables) {
@@ -585,19 +558,15 @@ public class TestCallableQueueService ex
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed == 0);
assertTrue(callable3.executed == 0);
-
- services.destroy();
}
public void testQueueUniquenessWithSameKeyInOneComposite() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("QueueUniquenessWithSameKeyInOneComposite", "QueueUniquenessWithSameKeyInOneComposite", 0, 100);
final MyCallable callable2 = new MyCallable("QueueUniquenessWithSameKeyInOneComposite", "QueueUniquenessWithSameKeyInOneComposite", 0, 100);
final MyCallable callable3 = new MyCallable("QueueUniquenessWithSameKeyInOneComposite", "QueueUniquenessWithSameKeyInOneComposite", 0, 100);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
queueservice.queueSerial(Arrays.asList(callable1, callable2, callable3));
@@ -610,21 +579,17 @@ public class TestCallableQueueService ex
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed == 0);
assertTrue(callable3.executed == 0);
-
- services.destroy();
}
public void testQueueUniquenessWithDiffKey() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("QueueUniquenessWithDiffKey1", "QueueUniquenessWithDiffKey", 0, 100);
final MyCallable callable2 = new MyCallable("QueueUniquenessWithDiffKey2", "QueueUniquenessWithDiffKey", 0, 100);
final MyCallable callable3 = new MyCallable("QueueUniquenessWithDiffKey3", "QueueUniquenessWithDiffKey", 0, 100);
List<MyCallable> callables = Arrays.asList(callable1, callable2, callable3);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
for (MyCallable c : callables) {
queueservice.queue(c);
@@ -639,21 +604,17 @@ public class TestCallableQueueService ex
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed != 0);
assertTrue(callable3.executed != 0);
-
- services.destroy();
}
public void testQueueUniquenessWithDiffKeyInComposite() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("QueueUniquenessWithDiffKeyInComposite1", "QueueUniquenessWithDiffKeyInComposite", 0, 100);
final MyCallable callable2 = new MyCallable("QueueUniquenessWithDiffKeyInComposite2", "QueueUniquenessWithDiffKeyInComposite", 0, 100);
final MyCallable callable3 = new MyCallable("QueueUniquenessWithDiffKeyInComposite3", "QueueUniquenessWithDiffKeyInComposite", 0, 100);
List<MyCallable> callables = Arrays.asList(callable1, callable2, callable3);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
String type = "QueueUniquenessWithDiffKeyInComposite";
for (MyCallable c : callables) {
@@ -669,19 +630,15 @@ public class TestCallableQueueService ex
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed != 0);
assertTrue(callable3.executed != 0);
-
- services.destroy();
}
public void testQueueUniquenessWithDiffKeyInOneComposite() throws Exception {
EXEC_ORDER = new AtomicLong();
- Services services = new Services();
- services.init();
final MyCallable callable1 = new MyCallable("QueueUniquenessWithDiffKeyInOneComposite1", "QueueUniquenessWithDiffKeyInOneComposite", 0, 100);
final MyCallable callable2 = new MyCallable("QueueUniquenessWithDiffKeyInOneComposite2", "QueueUniquenessWithDiffKeyInOneComposite", 0, 100);
final MyCallable callable3 = new MyCallable("QueueUniquenessWithDiffKeyInOneComposite3", "QueueUniquenessWithDiffKeyInOneComposite", 0, 100);
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
queueservice.queueSerial(Arrays.asList(callable1, callable2, callable3));
@@ -694,8 +651,6 @@ public class TestCallableQueueService ex
assertTrue(callable1.executed != 0);
assertTrue(callable2.executed != 0);
assertTrue(callable3.executed != 0);
-
- services.destroy();
}
/**
@@ -704,12 +659,12 @@ public class TestCallableQueueService ex
*/
public void testInterrupt() throws Exception {
EXEC_ORDER = new AtomicLong();
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_THREADS, "1");
setSystemProperty(CallableQueueService.CONF_CALLABLE_INTERRUPT_TYPES, "testKill");
- Services services = new Services();
- services.init();
+ new Services().init();
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final ExtendedXCommand initialCallable = new ExtendedXCommand("initialKey", "initialType", 2, 200,
"initialLockKey");
final List<ExtendedXCommand> callables = new ArrayList<ExtendedXCommand>();
@@ -739,7 +694,6 @@ public class TestCallableQueueService ex
assertTrue(initialCallable.executed > 0);
assertTrue(intCallable.executed > 0);
assertTrue(intCallable.executed < callables.get(5).executed);
- services.destroy();
}
/*
@@ -749,12 +703,12 @@ public class TestCallableQueueService ex
*/
public void testInterruptsWithDistinguishedLockKeys() throws Exception {
EXEC_ORDER = new AtomicLong();
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_THREADS, "1");
setSystemProperty(CallableQueueService.CONF_CALLABLE_INTERRUPT_TYPES, "testKill");
- Services services = new Services();
- services.init();
+ new Services().init();
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final ExtendedXCommand initialCallable = new ExtendedXCommand("initialKey", "initialType", 2, 200,
"initialLockKey");
@@ -785,8 +739,6 @@ public class TestCallableQueueService ex
assertTrue(initialCallable.executed > 0);
assertTrue(intCallable.executed > 0);
assertTrue(intCallable.executed > callables.get(5).executed);
-
- services.destroy();
}
/*
@@ -795,12 +747,12 @@ public class TestCallableQueueService ex
*/
public void testInterruptsWithCompositeCallable() throws Exception {
EXEC_ORDER = new AtomicLong();
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_THREADS, "1");
setSystemProperty(CallableQueueService.CONF_CALLABLE_INTERRUPT_TYPES, "testKill");
- Services services = new Services();
- services.init();
+ new Services().init();
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final ExtendedXCommand initialCallable = new ExtendedXCommand("initialKey", "initialType", 2, 200,
"initialLockKey");
final List<ExtendedXCommand> callables = new ArrayList<ExtendedXCommand>();
@@ -830,8 +782,6 @@ public class TestCallableQueueService ex
for (ExtendedXCommand c : callables) {
assertTrue(intCallable.executed < c.executed);
}
-
- services.destroy();
}
/*
@@ -840,12 +790,12 @@ public class TestCallableQueueService ex
*/
public void testInterruptsInCompositeCallable() throws Exception {
EXEC_ORDER = new AtomicLong();
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_THREADS, "1");
setSystemProperty(CallableQueueService.CONF_CALLABLE_INTERRUPT_TYPES, "testKill");
- Services services = new Services();
- services.init();
+ new Services().init();
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final ExtendedXCommand initialCallable = new ExtendedXCommand("initialKey", "initialType", 2, 200,
"initialLockKey");
final List<ExtendedXCommand> callables = new ArrayList<ExtendedXCommand>();
@@ -873,8 +823,6 @@ public class TestCallableQueueService ex
assertTrue(initialCallable.executed > 0);
assertTrue(callables.get(1).executed > callables.get(5).executed);
-
- services.destroy();
}
/*
@@ -883,13 +831,13 @@ public class TestCallableQueueService ex
*/
public void testMaxInterruptMapSize() throws Exception {
EXEC_ORDER = new AtomicLong();
+ Services.get().destroy();
setSystemProperty(CallableQueueService.CONF_THREADS, "1");
setSystemProperty(CallableQueueService.CONF_CALLABLE_INTERRUPT_TYPES, "testKill");
setSystemProperty(CallableQueueService.CONF_CALLABLE_INTERRUPT_MAP_MAX_SIZE, "0");
- Services services = new Services();
- services.init();
+ new Services().init();
- CallableQueueService queueservice = services.get(CallableQueueService.class);
+ CallableQueueService queueservice = Services.get().get(CallableQueueService.class);
final ExtendedXCommand initialCallable = new ExtendedXCommand("initialKey", "initialType", 2, 100,
"initialLockKey");
@@ -920,8 +868,6 @@ public class TestCallableQueueService ex
assertTrue(initialCallable.executed > 0);
assertTrue(intCallable.executed > 0);
assertTrue(intCallable.executed > callables.get(5).executed);
-
- services.destroy();
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallbackService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallbackService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallbackService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCallbackService.java Sat Dec 8 00:09:59 2012
@@ -23,18 +23,25 @@ import org.apache.oozie.test.XTestCase;
public class TestCallbackService extends XTestCase {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
public void testService() throws Exception {
- Services services = new Services();
- services.init();
- CallbackService cs = services.get(CallbackService.class);
+ CallbackService cs = Services.get().get(CallbackService.class);
assertNotNull(cs);
- services.destroy();
}
public void testCallbacks() throws Exception {
- Services services = new Services();
- services.init();
- CallbackService cs = services.get(CallbackService.class);
+ CallbackService cs = Services.get().get(CallbackService.class);
assertNotNull(cs);
String callback = cs.createCallBackUrl("a", "@STATUS");
assertTrue(callback.contains("http://"));
@@ -43,7 +50,6 @@ public class TestCallbackService extends
callback = callback.replace("@STATUS", "OK");
assertEquals("a", cs.getActionId(callback));
assertEquals("OK", cs.getExternalStatus(callback));
- services.destroy();
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestDagXLogInfoService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestDagXLogInfoService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestDagXLogInfoService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestDagXLogInfoService.java Sat Dec 8 00:09:59 2012
@@ -24,15 +24,24 @@ import org.apache.oozie.util.XLog;
public class TestDagXLogInfoService extends XTestCase {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
public void testLogInfo() throws Exception {
- Services services = new Services();
- services.init();
- assertNotNull(services.get(DagXLogInfoService.class));
+ assertNotNull(Services.get().get(DagXLogInfoService.class));
String prefix = XLog.Info.get().createPrefix();
assertTrue(prefix.contains(DagXLogInfoService.TOKEN));
assertTrue(prefix.contains(DagXLogInfoService.APP));
assertTrue(prefix.contains(DagXLogInfoService.JOB));
assertTrue(prefix.contains(DagXLogInfoService.ACTION));
- services.destroy();
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestELService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestELService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestELService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestELService.java Sat Dec 8 00:09:59 2012
@@ -24,11 +24,21 @@ import org.apache.oozie.util.ELEvaluator
public class TestELService extends XTestCase {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
public void testELForWorkflow() throws Exception {
- Services services = new Services();
- services.init();
- assertNotNull(services.get(ELService.class));
- ELEvaluator eval = services.get(ELService.class).createEvaluator("workflow");
+ assertNotNull(Services.get().get(ELService.class));
+ ELEvaluator eval = Services.get().get(ELService.class).createEvaluator("workflow");
assertNotNull(eval.evaluate("${KB}", Long.class));
assertNotNull(eval.evaluate("${MB}", Long.class));
assertNotNull(eval.evaluate("${GB}", Long.class));
@@ -39,7 +49,6 @@ public class TestELService extends XTest
assertNotNull(eval.evaluate("${firstNotNull(null, 'b')}", String.class));
assertNotNull(eval.evaluate("${timestamp()}", String.class));
assertNotNull(eval.evaluate("${urlEncode('abc')}", String.class));
- services.destroy();
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestGroupsService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestGroupsService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestGroupsService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestGroupsService.java Sat Dec 8 00:09:59 2012
@@ -57,6 +57,9 @@ public class TestGroupsService extends X
catch (Exception ex) {
fail(ex.toString());
}
+ finally {
+ services.destroy();
+ }
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestInstrumentationService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestInstrumentationService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestInstrumentationService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestInstrumentationService.java Sat Dec 8 00:09:59 2012
@@ -21,12 +21,21 @@ import org.apache.oozie.test.XTestCase;
public class TestInstrumentationService extends XTestCase {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
public void testInstrumentation() throws Exception {
- Services services = new Services();
- services.init();
- assertNotNull(services.get(InstrumentationService.class));
- assertNotNull(services.get(InstrumentationService.class).get());
- services.destroy();
+ assertNotNull(Services.get().get(InstrumentationService.class));
+ assertNotNull(Services.get().get(InstrumentationService.class).get());
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestLiteWorkflowAppService.java Sat Dec 8 00:09:59 2012
@@ -138,7 +138,9 @@ public class TestLiteWorkflowAppService
catch (Exception ex) {
//nop
}
- services.destroy();
+ finally {
+ services.destroy();
+ }
}
public void testSchema() throws Exception {
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestMemoryLocksService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestMemoryLocksService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestMemoryLocksService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestMemoryLocksService.java Sat Dec 8 00:09:59 2012
@@ -21,10 +21,20 @@ import org.apache.oozie.test.XTestCase;
public class TestMemoryLocksService extends XTestCase {
- public void testService() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
new Services().init();
- assertNotNull(Services.get().get(MemoryLocksService.class));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
Services.get().destroy();
+ super.tearDown();
+ }
+
+ public void testService() throws Exception {
+ assertNotNull(Services.get().get(MemoryLocksService.class));
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPauseTransitService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPauseTransitService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPauseTransitService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPauseTransitService.java Sat Dec 8 00:09:59 2012
@@ -301,7 +301,9 @@ public class TestPauseTransitService ext
public void testPauseCoordinatorForBackwardSupport() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- new Services().init();
+ services = new Services();
+ setClassesToBeExcluded(services.getConf(), excludedServices);
+ services.init();
final JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestProxyUserService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestProxyUserService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestProxyUserService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestProxyUserService.java Sat Dec 8 00:09:59 2012
@@ -58,6 +58,9 @@ public class TestProxyUserService extend
catch (Exception ex) {
fail();
}
+ finally {
+ services.destroy();
+ }
}
public void testWrongHost() throws Exception {
@@ -76,6 +79,9 @@ public class TestProxyUserService extend
catch (Exception ex) {
fail();
}
+ finally {
+ services.destroy();
+ }
}
public void testWrongConfigHosts() throws Exception {
@@ -93,6 +99,9 @@ public class TestProxyUserService extend
catch (Exception ex) {
fail();
}
+ finally {
+ services.destroy();
+ }
}
public void testValidateAnyHostAnyUser() throws Exception {
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchedulerService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchedulerService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchedulerService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestSchedulerService.java Sat Dec 8 00:09:59 2012
@@ -26,11 +26,21 @@ import java.util.concurrent.atomic.Atomi
public class TestSchedulerService extends XTestCase {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ new Services().init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ Services.get().destroy();
+ super.tearDown();
+ }
+
public void testInstrumentation() throws Exception {
- Services services = new Services();
- services.init();
- assertNotNull(services.get(SchedulerService.class));
- SchedulerService ss = services.get(SchedulerService.class);
+ assertNotNull(Services.get().get(SchedulerService.class));
+ SchedulerService ss = Services.get().get(SchedulerService.class);
final AtomicInteger counter = new AtomicInteger();
ss.schedule(new Runnable() {
public void run() {
@@ -44,7 +54,6 @@ public class TestSchedulerService extend
}
});
assertTrue(counter.get() > 1);
- services.destroy();
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestServices.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestServices.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestServices.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestServices.java Sat Dec 8 00:09:59 2012
@@ -29,15 +29,18 @@ public class TestServices extends XTestC
setSystemProperty(Services.CONF_SERVICE_EXT_CLASSES, "");
Services services = new Services();
services.init();
- assertNotNull(services.get(XLogService.class));
- assertNotNull(services.get(ConfigurationService.class));
-
- String shouldBe = "oozie-" + System.getProperty("user.name");
- assertTrue(shouldBe.startsWith(services.getSystemId()));
- assertNotNull(services.getRuntimeDir());
- assertTrue(new File(services.getRuntimeDir()).exists());
-
- services.destroy();
+ try {
+ assertNotNull(services.get(XLogService.class));
+ assertNotNull(services.get(ConfigurationService.class));
+
+ String shouldBe = "oozie-" + System.getProperty("user.name");
+ assertTrue(shouldBe.startsWith(services.getSystemId()));
+ assertNotNull(services.getRuntimeDir());
+ assertTrue(new File(services.getRuntimeDir()).exists());
+ }
+ finally {
+ services.destroy();
+ }
}
public static class S1 implements Service {
@@ -89,8 +92,13 @@ public class TestServices extends XTestC
setSystemProperty(Services.CONF_SERVICE_CLASSES, SERVICES);
Services services = new Services();
services.init();
- assertEquals(S1.class, services.get(S1.class).getClass());
- assertEquals(S2.class, services.get(S2.class).getClass());
+ try {
+ assertEquals(S1.class, services.get(S1.class).getClass());
+ assertEquals(S2.class, services.get(S2.class).getClass());
+ }
+ finally {
+ services.destroy();
+ }
}
private static final String SERVICES_EXT = S1Ext.class.getName();
@@ -102,9 +110,14 @@ public class TestServices extends XTestC
setSystemProperty(Services.CONF_SERVICE_EXT_CLASSES, SERVICES_EXT);
Services services = new Services();
services.init();
- assertEquals(S1Ext.class, services.get(S1.class).getClass());
- assertEquals(S2.class, services.get(S2.class).getClass());
- assertFalse(S1.INITED_S1);
- assertTrue(S1Ext.INITED_S1EXT);
+ try {
+ assertEquals(S1Ext.class, services.get(S1.class).getClass());
+ assertEquals(S2.class, services.get(S2.class).getClass());
+ assertFalse(S1.INITED_S1);
+ assertTrue(S1Ext.INITED_S1EXT);
+ }
+ finally {
+ services.destroy();
+ }
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java Sat Dec 8 00:09:59 2012
@@ -144,7 +144,7 @@ public class TestStatusTransitService ex
public void testCoordStatusTransitServiceNoDoneWithErrorForBackwardSupport() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_COORD_STATUS, "true");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
@@ -344,7 +344,7 @@ public class TestStatusTransitService ex
public void testCoordStatusTransitServiceSuspendedWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
@@ -512,7 +512,7 @@ public class TestStatusTransitService ex
public void testCoordStatusTransitServiceBackwardSupport() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "true");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
@@ -552,7 +552,7 @@ public class TestStatusTransitService ex
public void testCoordStatusTransitServiceRunning3() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
@@ -592,7 +592,7 @@ public class TestStatusTransitService ex
public void testCoordStatusTransitServicePaused() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
@@ -634,7 +634,7 @@ public class TestStatusTransitService ex
public void testCoordStatusTransitServicePausedWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
String currentDatePlusMonth = XDataTestCase.getCurrentDateafterIncrementingInMonths(1);
@@ -1076,7 +1076,7 @@ public class TestStatusTransitService ex
public void testBundleStatusTransitServiceRunningWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
BundleJobBean bundleJob = this.addRecordToBundleJobTable(Job.Status.RUNNING, true);
@@ -1247,7 +1247,7 @@ public class TestStatusTransitService ex
public void testBundleStatusTransitServiceSuspendedWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
BundleJobBean bundleJob = this.addRecordToBundleJobTable(Job.Status.RUNNING, true);
@@ -1281,7 +1281,7 @@ public class TestStatusTransitService ex
public void testBundleStatusTransitServicePausedWithError() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
BundleJobBean bundleJob = createBundleJob(Job.Status.PAUSED, true);
@@ -1317,7 +1317,7 @@ public class TestStatusTransitService ex
public void testBundleStatusTransitServicePaused() throws Exception {
Services.get().destroy();
setSystemProperty(StatusTransitService.CONF_BACKWARD_SUPPORT_FOR_STATES_WITHOUT_ERROR, "false");
- Services services = new Services();
+ services = new Services();
setClassesToBeExcluded(services.getConf(), excludedServices);
services.init();
BundleJobBean bundleJob = createBundleJob(Job.Status.PAUSEDWITHERROR, true);
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/service/TestUUIDService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestUUIDService.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/service/TestUUIDService.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/service/TestUUIDService.java Sat Dec 8 00:09:59 2012
@@ -49,36 +49,48 @@ public class TestUUIDService extends XTe
setSystemProperty(UUIDService.CONF_GENERATOR, "counter");
Services services = new Services();
services.init();
- UUIDService uuid = services.get(UUIDService.class);
- String id = uuid.generateId(ApplicationType.WORKFLOW);
- assertTrue(id.startsWith("0000000-"));
- for (int i = 0; i < 1000; i++) {
- id = uuid.generateId(ApplicationType.WORKFLOW);
+ try {
+ UUIDService uuid = services.get(UUIDService.class);
+ String id = uuid.generateId(ApplicationType.WORKFLOW);
+ assertTrue(id.startsWith("0000000-"));
+ for (int i = 0; i < 1000; i++) {
+ id = uuid.generateId(ApplicationType.WORKFLOW);
+ }
+ assertTrue(id.startsWith("0001000-"));
+ }
+ finally {
+ services.destroy();
}
- assertTrue(id.startsWith("0001000-"));
- services.destroy();
}
public void testChildId() throws Exception {
setSystemProperty(UUIDService.CONF_GENERATOR, "counter");
Services services = new Services();
services.init();
- UUIDService uuid = services.get(UUIDService.class);
- String id = uuid.generateId(ApplicationType.WORKFLOW);
- String childId = uuid.generateChildId(id, "a");
- assertEquals(id, uuid.getId(childId));
- assertEquals("a", uuid.getChildName(childId));
- services.destroy();
+ try {
+ UUIDService uuid = services.get(UUIDService.class);
+ String id = uuid.generateId(ApplicationType.WORKFLOW);
+ String childId = uuid.generateChildId(id, "a");
+ assertEquals(id, uuid.getId(childId));
+ assertEquals("a", uuid.getChildName(childId));
+ }
+ finally {
+ services.destroy();
+ }
setSystemProperty(UUIDService.CONF_GENERATOR, "random");
services = new Services();
services.init();
- uuid = services.get(UUIDService.class);
- id = uuid.generateId(ApplicationType.WORKFLOW);
- childId = uuid.generateChildId(id, "a");
- assertEquals(id, uuid.getId(childId));
- assertEquals("a", uuid.getChildName(childId));
- services.destroy();
+ try {
+ UUIDService uuid = services.get(UUIDService.class);
+ String id = uuid.generateId(ApplicationType.WORKFLOW);
+ String childId = uuid.generateChildId(id, "a");
+ assertEquals(id, uuid.getId(childId));
+ assertEquals("a", uuid.getChildName(childId));
+ }
+ finally {
+ services.destroy();
+ }
}
}
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/util/TestXLogFilter.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestXLogFilter.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/util/TestXLogFilter.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/util/TestXLogFilter.java Sat Dec 8 00:09:59 2012
@@ -29,13 +29,17 @@ public class TestXLogFilter extends XTes
public void testXLogFileter() throws ServiceException {
Services services = new Services();
services.init();
- XLogStreamer.Filter xf2 = new XLogStreamer.Filter();
- xf2.constructPattern();
- ArrayList<String> a = new ArrayList<String>();
- a.add("2009-06-24 02:43:13,958 DEBUG");
- a.add(" WorkflowRunnerCallable:323 - " + XLog.Info.get().createPrefix() + " test log");
- assertEquals(true, xf2.matches(a));
- services.destroy();
+ try {
+ XLogStreamer.Filter xf2 = new XLogStreamer.Filter();
+ xf2.constructPattern();
+ ArrayList<String> a = new ArrayList<String>();
+ a.add("2009-06-24 02:43:13,958 DEBUG");
+ a.add(" WorkflowRunnerCallable:323 - " + XLog.Info.get().createPrefix() + " test log");
+ assertEquals(true, xf2.matches(a));
+ }
+ finally {
+ services.destroy();
+ }
XLogStreamer.Filter.reset();
XLogStreamer.Filter.defineParameter("USER");
Modified: oozie/trunk/core/src/test/java/org/apache/oozie/util/db/TestSqlStatement.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/util/db/TestSqlStatement.java?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/util/db/TestSqlStatement.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/util/db/TestSqlStatement.java Sat Dec 8 00:09:59 2012
@@ -57,6 +57,7 @@ public class TestSqlStatement extends XT
protected void tearDown() throws Exception {
TestSchema.dropSchema(conn);
conn.close();
+ Services.get().destroy();
super.tearDown();
}
Modified: oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1418563&r1=1418562&r2=1418563&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Sat Dec 8 00:09:59 2012
@@ -1,5 +1,6 @@
-- Oozie 3.4.0 release (trunk - unreleased)
+OOZIE-1114 Some tests don't use the Services singleton properly (rkanter)
OOZIE-1113 The cookies used in the AltKerberosAuthenticationHandler examples aren't read properly if quoted (rkanter)
OOZIE-1101 Fix log messages that contain {0} or similar (rkanter)
OOZIE-1073 Optimize latest and future EL resolution in case of start-instance and end-instance (rohini via virag)