summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-11-16 13:33:55 +0100
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-11-16 13:44:54 +0100
commite86e6fd2af438fc9b63651aef607d5e470cc53d1 (patch)
tree4ed0b774af48059c3e88d97b5810f998d63da366
parentb315e03572a752c3f12cd4b97d2e05f2bdbc1ec5 (diff)
Add a logger to Unit test
Add a logger to the unit test CldsModelTest Change-Id: I9631c250352d8fe2dbc8771682636aedc3231790 Issue-ID: CLAMP-74 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
-rw-r--r--src/test/java/org/onap/clamp/clds/model/CldsModelTest.java25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
index 229867813..8b8197538 100644
--- a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
@@ -26,6 +26,9 @@ package org.onap.clamp.clds.model;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
import javax.ws.rs.BadRequestException;
import org.junit.Test;
@@ -34,6 +37,7 @@ import org.junit.Test;
* Test org.onap.clamp.ClampDesigner.model.Model
*/
public class CldsModelTest {
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsModelTest.class);
@Test
public void testCreateUsingControlName() {
@@ -64,10 +68,8 @@ public class CldsModelTest {
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_CREATE);
cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
cldsModel.validateAction(CldsEvent.ACTION_TEST);
-
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
fail("Exception should have been sent");
-
}
@Test(expected = IllegalArgumentException.class)
@@ -79,12 +81,10 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
fail("Exception should have been sent");
} catch (IllegalArgumentException e) {
- System.out.println("Exception caught IllegalArgumentException as expected");
+ logger.error("Exception caught IllegalArgumentException as expected", e);
}
-
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_RESUBMIT);
cldsModel.validateAction(CldsEvent.ACTION_RESUBMIT);
-
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
fail("Exception should have been sent");
}
@@ -95,10 +95,8 @@ public class CldsModelTest {
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DISTRIBUTE);
cldsModel.validateAction(CldsEvent.ACTION_RESUBMIT);
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
-
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
-
}
@Test(expected = IllegalArgumentException.class)
@@ -108,10 +106,8 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
cldsModel.validateAction(CldsEvent.ACTION_RESUBMIT);
-
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
-
}
@Test(expected = IllegalArgumentException.class)
@@ -122,10 +118,8 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_UNDEPLOY);
cldsModel.validateAction(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_STOP);
-
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
-
}
@Test(expected = IllegalArgumentException.class)
@@ -136,23 +130,19 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_STOP);
cldsModel.validateAction(CldsEvent.ACTION_UNDEPLOY);
-
try {
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
} catch (IllegalArgumentException e) {
System.out.println("Exception caught IllegalArgumentException as expected");
}
-
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
cldsModel.validateAction(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_STOP);
cldsModel.validateAction(CldsEvent.ACTION_UNDEPLOY);
-
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
-
}
@Test(expected = IllegalArgumentException.class)
@@ -160,20 +150,16 @@ public class CldsModelTest {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DELETE);
cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
-
try {
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
} catch (IllegalArgumentException e) {
System.out.println("Exception caught IllegalArgumentException as expected");
}
-
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DELETE);
cldsModel.getEvent().setActionStateCd(CldsEvent.ACTION_STATE_SENT);
-
cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
fail("Exception should have been sent");
-
}
@Test(expected = IllegalArgumentException.class)
@@ -183,7 +169,6 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_RESTART);
cldsModel.validateAction(CldsEvent.ACTION_UNDEPLOY);
-
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
}