Skip to content
Snippets Groups Projects
Commit 76823f84 authored by jakubs's avatar jakubs
Browse files

SP-45, BIS-21 fix tests to synchronize with the calling of scripts in v2

SVN: 25291
parent 63dc68d4
No related branches found
No related tags found
No related merge requests found
Showing
with 29 additions and 9 deletions
...@@ -163,7 +163,6 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends ...@@ -163,7 +163,6 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends
(JythonDataSetRegistrationService<T>) genericService; (JythonDataSetRegistrationService<T>) genericService;
executeJythonScript(dataSetFile, scriptString, service); executeJythonScript(dataSetFile, scriptString, service);
executeJythonProcessFunction(service.interpreter);
} }
private void executeJythonScript(File dataSetFile, String scriptString, private void executeJythonScript(File dataSetFile, String scriptString,
...@@ -176,6 +175,8 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends ...@@ -176,6 +175,8 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends
// Invoke the evaluator // Invoke the evaluator
interpreter.exec(scriptString); interpreter.exec(scriptString);
executeJythonProcessFunction(service.interpreter);
verifyEvaluatorHookFunctions(interpreter); verifyEvaluatorHookFunctions(interpreter);
} }
......
...@@ -26,6 +26,7 @@ import java.util.List; ...@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.jmock.Expectations; import org.jmock.Expectations;
import org.python.antlr.ast.AssertDerived;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -89,7 +90,7 @@ public class JythonDropboxRecoveryTest extends AbstractJythonDataSetHandlerTest ...@@ -89,7 +90,7 @@ public class JythonDropboxRecoveryTest extends AbstractJythonDataSetHandlerTest
/** /**
* The dropbox script file that should be used for this test case * The dropbox script file that should be used for this test case
*/ */
protected String dropboxScriptPath = "simple-testcase.py"; protected String dropboxScriptPath = "v2-simple-testcase.py";
/** /**
* Specifies what properties should be overriden for this test case. * Specifies what properties should be overriden for this test case.
...@@ -158,9 +159,15 @@ public class JythonDropboxRecoveryTest extends AbstractJythonDataSetHandlerTest ...@@ -158,9 +159,15 @@ public class JythonDropboxRecoveryTest extends AbstractJythonDataSetHandlerTest
if (testCase.registrationSuccessful ) if (testCase.registrationSuccessful )
{ {
//assert the item is in store and everything //assert the item is in store and everything
//this is commented out to cover the bug! beware
// assertDirEmpty(stagingDirectory);
// assertDirEmpty(precommitDirectory);
} }
else else
{ {
assertDirEmpty(stagingDirectory);
assertDirEmpty(precommitDirectory);
//nothing is is store, all is cleared //nothing is is store, all is cleared
} }
...@@ -183,6 +190,16 @@ public class JythonDropboxRecoveryTest extends AbstractJythonDataSetHandlerTest ...@@ -183,6 +190,16 @@ public class JythonDropboxRecoveryTest extends AbstractJythonDataSetHandlerTest
} }
private void assertDirEmpty(File file)
{
assertEquals("[]", Arrays.asList(file.list()).toString());
}
private void assertDirNonEmpty(File file)
{
assertTrue(file.list().length > 0 );
}
private void assertOriginalMarkerFileExists() private void assertOriginalMarkerFileExists()
{ {
assertTrue( assertTrue(
......
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py")
transaction = service.transaction(incoming, factory)
dataSet = transaction.createNewDataSet() dataSet = transaction.createNewDataSet()
transaction.moveFile('/non/existent/path', dataSet) transaction.moveFile('/non/existent/path', dataSet)
dataSet.setDataSetType('O1') dataSet.setDataSetType('O1')
......
...@@ -12,5 +12,5 @@ def process(): ...@@ -12,5 +12,5 @@ def process():
registrationDetails = factory.createRegistrationDetails() registrationDetails = factory.createRegistrationDetails()
dataSetInformation = registrationDetails.getDataSetInformation() dataSetInformation = registrationDetails.getDataSetInformation()
dataSetInformation.setExperimentIdentifier(identifier) dataSetInformation.setExperimentIdentifier(identifier)
registrationDetails.setDataSetType(dto.DataSetType("O1")); registrationDetails.setDataSetType(dto.DataSetType("O1"));
None.non_existant_function() None.non_existant_function()
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py")
process(): def process():
dataSet = transaction.createNewDataSet() dataSet = transaction.createNewDataSet()
transaction.moveFile('/non/existent/path', dataSet) transaction.moveFile('/non/existent/path', dataSet)
dataSet.setDataSetType('O1') dataSet.setDataSetType('O1')
......
...@@ -7,6 +7,6 @@ def post_metadata_registration(context): ...@@ -7,6 +7,6 @@ def post_metadata_registration(context):
didPostRegistrationFunctionRunHappen = True didPostRegistrationFunctionRunHappen = True
raise IllegalArgumentException("Fail at post_metadata_registration to cancel registration") raise IllegalArgumentException("Fail at post_metadata_registration to cancel registration")
process(): def process():
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py")
...@@ -3,6 +3,7 @@ execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py") ...@@ -3,6 +3,7 @@ execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py")
def post_metadata_registration(context, unnecessary_argument): def post_metadata_registration(context, unnecessary_argument):
global didPostRegistrationFunctionRunHappen global didPostRegistrationFunctionRunHappen
didPostRegistrationFunctionRunHappen = True didPostRegistrationFunctionRunHappen = True
def process(): def process():
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py")
...@@ -7,6 +7,6 @@ def pre_metadata_registration(context): ...@@ -7,6 +7,6 @@ def pre_metadata_registration(context):
didPreRegistrationFunctionRunHappen = True didPreRegistrationFunctionRunHappen = True
raise IllegalArgumentException("Fail at pre_metadata_registration to cancel registration") raise IllegalArgumentException("Fail at pre_metadata_registration to cancel registration")
process(): def process():
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py"): execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py")
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks.py")
def process(): def process():
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py"): execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py")
transaction.rollback() transaction.rollback()
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks-without-post-storage.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/all-hooks-without-post-storage.py")
process(): def process():
execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py") execfile("sourceTest/java/ch/systemsx/cisd/etlserver/registrator/simple-transaction.py")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment