Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-05-11 11:09:07 -0400
committerAngel Avila2016-05-11 11:09:07 -0400
commit4b3627fc33af06223f0eb43a22bac7dff5232a4a (patch)
treec84532889ddb6a843329cfcb1aac776b9dc4f851 /plugins/org.eclipse.osee.ats.core.test
parent51d7c6fed275a2f60b7bbd43ff6de6283b3eb64a (diff)
downloadorg.eclipse.osee-4b3627fc33af06223f0eb43a22bac7dff5232a4a.tar.gz
org.eclipse.osee-4b3627fc33af06223f0eb43a22bac7dff5232a4a.tar.xz
org.eclipse.osee-4b3627fc33af06223f0eb43a22bac7dff5232a4a.zip
feature[ats_UFM31]: Provide XWidget validators via OSGI
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core.test')
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java
index 4430cb3584..f2ca69db67 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/validator/AtsXWidgetValidateManagerTest.java
@@ -19,6 +19,8 @@ import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition;
import org.eclipse.osee.ats.api.workdef.IAtsWidgetDefinition;
import org.eclipse.osee.ats.api.workdef.WidgetResult;
import org.eclipse.osee.ats.api.workdef.WidgetStatus;
+import org.eclipse.osee.ats.api.workflow.transition.IAtsXWidgetValidator;
+import org.eclipse.osee.ats.api.workflow.transition.IAtsXWidgetValidatorProvider;
import org.eclipse.osee.ats.mocks.MockWidgetDefinition;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.junit.Assert;
@@ -36,8 +38,8 @@ public class AtsXWidgetValidateManagerTest {
public void testValidateTransition_emptyValidators() {
List<WidgetResult> results = new LinkedList<>();
- AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
- manager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null, atsServices);
+ AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null,
+ atsServices);
Assert.assertTrue(results.isEmpty());
}
@@ -46,9 +48,12 @@ public class AtsXWidgetValidateManagerTest {
List<WidgetResult> results = new LinkedList<>();
AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
- manager.add(new TestValidatorProvider(new AtsValidator()));
- manager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null, atsServices);
+ TestValidatorProvider provider = new TestValidatorProvider(new AtsValidator());
+ manager.add(provider);
+ AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null,
+ atsServices);
Assert.assertTrue(results.isEmpty());
+ manager.remove(provider);
}
@Test
@@ -56,9 +61,12 @@ public class AtsXWidgetValidateManagerTest {
List<WidgetResult> results = new LinkedList<>();
AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
- manager.add(new TestValidatorProvider(new AtsErrorValidator()));
- manager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null, atsServices);
+ TestValidatorProvider provider = new TestValidatorProvider(new AtsErrorValidator());
+ manager.add(provider);
+ AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, null, null, null,
+ atsServices);
Assert.assertFalse(results.isEmpty());
+ manager.remove(provider);
}
@Test
@@ -66,21 +74,18 @@ public class AtsXWidgetValidateManagerTest {
List<WidgetResult> results = new LinkedList<>();
AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
- manager.add(new TestValidatorProvider(new AtsExceptoinValidator()));
+ TestValidatorProvider provider = new TestValidatorProvider(new AtsExceptoinValidator());
+ manager.add(provider);
MockWidgetDefinition widgetDef = new MockWidgetDefinition("Widget Name");
- manager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, widgetDef, null, null, atsServices);
+ AtsXWidgetValidateManager.validateTransition(results, ValidatorTestUtil.emptyValueProvider, widgetDef, null, null,
+ atsServices);
Assert.assertFalse(results.isEmpty());
Assert.assertEquals(results.iterator().next().getStatus(), WidgetStatus.Exception);
Assert.assertEquals(
"Exception - Widget Name - Exception retriving validation for widget [AtsExceptoinValidator] Exception [problem]",
results.iterator().next().toString());
Assert.assertTrue(results.iterator().next().getException() instanceof OseeStateException);
- }
-
- @Test
- public void testAdd() {
- AtsXWidgetValidateManager manager = new AtsXWidgetValidateManager();
- manager.add(new TestValidatorProvider(new AtsValidator()));
+ manager.remove(provider);
}
private class AtsValidator implements IAtsXWidgetValidator {
@@ -108,7 +113,7 @@ public class AtsXWidgetValidateManagerTest {
}
- private class TestValidatorProvider implements AtsXWidgetValidatorProvider {
+ private class TestValidatorProvider implements IAtsXWidgetValidatorProvider {
private final LinkedList<IAtsXWidgetValidator> validators;

Back to the top