Skip to content
Snippets Groups Projects
Commit b54288b3 authored by buczekp's avatar buczekp
Browse files

[LMS-1949] improved tests

SVN: 19413
parent ba89693e
No related merge requests found
...@@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo; ...@@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo;
import org.jmock.Expectations; import org.jmock.Expectations;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DataRetrievalFailureException; import org.springframework.dao.DataRetrievalFailureException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import ch.rinn.restrictions.Friend; import ch.rinn.restrictions.Friend;
...@@ -42,6 +43,19 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; ...@@ -42,6 +43,19 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
{ ScriptBO.class, ScriptBO.IScriptFactory.class, ScriptPE.class }) { ScriptBO.class, ScriptBO.IScriptFactory.class, ScriptPE.class })
public final class ScriptBOTest extends AbstractBOTest public final class ScriptBOTest extends AbstractBOTest
{ {
@SuppressWarnings("unused")
@DataProvider
private final static Object[][] scriptTypes()
{
return new Object[][]
{
{ ScriptType.DYNAMIC_PROPERTY },
{ ScriptType.MANAGED_PROPERTY }
};
}
private static final String SCRIPT = "1+1"; private static final String SCRIPT = "1+1";
private static final String NAME = "name"; private static final String NAME = "name";
...@@ -68,13 +82,7 @@ public final class ScriptBOTest extends AbstractBOTest ...@@ -68,13 +82,7 @@ public final class ScriptBOTest extends AbstractBOTest
context.assertIsSatisfied(); context.assertIsSatisfied();
} }
@Test @Test(dataProvider = "scriptTypes")
public final void testDefineAndSaveDynamicProperty()
{
testDefineAndSave(ScriptType.DYNAMIC_PROPERTY);
testDefineAndSave(ScriptType.MANAGED_PROPERTY);
}
public final void testDefineAndSave(ScriptType scriptType) public final void testDefineAndSave(ScriptType scriptType)
{ {
final ScriptBO scriptBO = createScriptBO(); final ScriptBO scriptBO = createScriptBO();
...@@ -189,13 +197,7 @@ public final class ScriptBOTest extends AbstractBOTest ...@@ -189,13 +197,7 @@ public final class ScriptBOTest extends AbstractBOTest
context.assertIsSatisfied(); context.assertIsSatisfied();
} }
@Test @Test(dataProvider = "scriptTypes")
public void testUpdateScriptNotChanged() throws Exception
{
testUpdateScriptNotChanged(ScriptType.DYNAMIC_PROPERTY);
testUpdateScriptNotChanged(ScriptType.MANAGED_PROPERTY);
}
public void testUpdateScriptNotChanged(ScriptType scriptType) throws Exception public void testUpdateScriptNotChanged(ScriptType scriptType) throws Exception
{ {
final ScriptBO scriptBO = createScriptBO(); final ScriptBO scriptBO = createScriptBO();
...@@ -237,14 +239,8 @@ public final class ScriptBOTest extends AbstractBOTest ...@@ -237,14 +239,8 @@ public final class ScriptBOTest extends AbstractBOTest
context.assertIsSatisfied(); context.assertIsSatisfied();
} }
@Test
public void testUpdateScriptChanged() throws Exception
{
testUpdateScriptChanged(ScriptType.DYNAMIC_PROPERTY);
testUpdateScriptChanged(ScriptType.MANAGED_PROPERTY);
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Test(dataProvider = "scriptTypes")
public void testUpdateScriptChanged(final ScriptType scriptType) throws Exception public void testUpdateScriptChanged(final ScriptType scriptType) throws Exception
{ {
final ScriptBO scriptBO = createScriptBO(); final ScriptBO scriptBO = createScriptBO();
......
...@@ -43,6 +43,18 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; ...@@ -43,6 +43,18 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
public final class ScriptDAOTest extends AbstractDAOTest public final class ScriptDAOTest extends AbstractDAOTest
{ {
@SuppressWarnings("unused")
@DataProvider
private final static Object[][] scriptTypes()
{
return new Object[][]
{
{ ScriptType.DYNAMIC_PROPERTY },
{ ScriptType.MANAGED_PROPERTY }
};
}
private static final String DESCRIPTION = "desc"; private static final String DESCRIPTION = "desc";
private static final String SCRIPT = "1+1"; private static final String SCRIPT = "1+1";
...@@ -64,18 +76,6 @@ public final class ScriptDAOTest extends AbstractDAOTest ...@@ -64,18 +76,6 @@ public final class ScriptDAOTest extends AbstractDAOTest
return NAME + i; return NAME + i;
} }
@SuppressWarnings("unused")
@DataProvider
private final static Object[][] scriptTypes()
{
return new Object[][]
{
{ ScriptType.DYNAMIC_PROPERTY },
{ ScriptType.MANAGED_PROPERTY }
};
}
@Test(dataProvider = "scriptTypes") @Test(dataProvider = "scriptTypes")
public void testCreateScript(ScriptType scriptType) public void testCreateScript(ScriptType scriptType)
{ {
......
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