summaryrefslogtreecommitdiffstats
path: root/policy-utils/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-06 17:07:46 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-09-08 08:42:38 -0500
commitaa9c440c87b93fedb68d682b0a87b7948e67a90f (patch)
treeff712dbd2e41f9e08f1711d98f454eb46858c503 /policy-utils/src/test
parent2a6876b1efd5df87761f44bffd455774da9d1d94 (diff)
Fix checkstyle in utils
Just focusing on the policy-utils submodule. Issue-ID: POLICY-882 Change-Id: I9f2ecac8f435f2d743b1fafc477d320b10852bdc Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'policy-utils/src/test')
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java52
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java305
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java13
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java21
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java40
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java (renamed from policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MDCTransactionTest.java)110
6 files changed, 265 insertions, 276 deletions
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java
index 5063447c..fa8a62c8 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,40 +29,40 @@ public class PairTripleTest {
@Test
public void pairTest() {
- Pair<String, String> p = new Pair<String, String>("foo", "bar");
+ Pair<String, String> pair = new Pair<String, String>("foo", "bar");
- assertEquals("foo", p.first());
- assertEquals("bar", p.second());
- assertEquals("foo", p.getFirst());
- assertEquals("bar", p.getSecond());
-
- p.first("one");
- p.second("two");
+ assertEquals("foo", pair.first());
+ assertEquals("bar", pair.second());
+ assertEquals("foo", pair.getFirst());
+ assertEquals("bar", pair.getSecond());
- assertEquals("one", p.first());
- assertEquals("two", p.second());
- assertEquals("one", p.getFirst());
- assertEquals("two", p.getSecond());
-
- assertNotNull(p.toString());
+ pair.first("one");
+ pair.second("two");
+
+ assertEquals("one", pair.first());
+ assertEquals("two", pair.second());
+ assertEquals("one", pair.getFirst());
+ assertEquals("two", pair.getSecond());
+
+ assertNotNull(pair.toString());
}
@Test
public void tripleTest() {
- Triple<String, String, String> t = new Triple<String, String,String>("foo", "bar", "fiz");
+ Triple<String, String, String> triple = new Triple<String, String,String>("foo", "bar", "fiz");
- assertEquals("foo", t.first());
- assertEquals("bar", t.second());
- assertEquals("fiz", t.third());
-
- t.first("one");
- t.second("two");
- t.third("three");
+ assertEquals("foo", triple.first());
+ assertEquals("bar", triple.second());
+ assertEquals("fiz", triple.third());
+
+ triple.first("one");
+ triple.second("two");
+ triple.third("three");
- assertEquals("one", t.first());
- assertEquals("two", t.second());
- assertEquals("three", t.third());
+ assertEquals("one", triple.first());
+ assertEquals("two", triple.second());
+ assertEquals("three", triple.third());
}
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java
index 9d2aa397..05440c69 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,165 +37,146 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class PropertyUtilTest
-{
- private final static Logger logger = LoggerFactory.getLogger(PropertyUtilTest.class);
-
- private static File directory = null;
-
- /**
- * Test Setup -- Create a directory for temporary files
- */
- @BeforeClass
- static public void setup()
- {
- logger.info("setup: creating a temporary directory");
-
- // create a directory for temporary files
- directory = new File(UUID.randomUUID().toString());
- directory.mkdir();
- }
-
- /**
- * Test Cleanup -- Remove temporary files
- */
- @AfterClass
- static public void teardown()
- {
- logger.info("teardown: remove the temporary directory");
-
- // the assumption is that we only have one level of temporary files
- for (File file : directory.listFiles())
- {
- file.delete();
- }
- directory.delete();
- }
-
- /**
- * Utility method to write a properties file
- *
- * @param name the file name, relative to the temporary directory
- * @param the properties to store in the file
- * @return a File instance associated with the newly-created file
- * @throws IOException if the file can't be created for some reason
- */
- File createFile(String name, Properties p) throws IOException
- {
- File file = new File(directory, name);
- FileOutputStream fos = new FileOutputStream(file);
- try
- {
- p.store(fos, "Property file '" + name + "'");
- }
- finally
- {
- fos.close();
- }
- return(file);
- }
-
- /**
- * Create a 'PropertyUtil.Listener' subclass, which receives property
- * file updates. It stores the latest values in an array, and notifies
- * any thread waiting on this array.
- *
- * @param returns this is an array of length 2 -- the first entry will
- * contain the 'properties' value, and the second will contain
- * 'changedKeys'. It is also used to signal any waiting thread
- * using 'returns.notifyAll()'.
- */
- PropertyUtil.Listener createListenerThread(final Object[] returns)
- {
- return(new PropertyUtil.Listener()
- {
- public void propertiesChanged
- (Properties properties, Set<String> changedKeys)
- {
- // When a notification is received, store the values in the
- // 'returns' array, and signal using the same array.
- logger.info("Listener invoked: properties=" + properties
- + ", changedKeys=" + changedKeys);
- returns[0] = properties;
- returns[1] = changedKeys;
- synchronized(returns)
- {
- returns.notifyAll();
- }
- }
- });
- }
-
- /**
- * Test the basic properties file interface.
- */
- @Test
- public void testGetProperties() throws Exception
- {
- logger.info("testGetProperties: test the basic properties file interface");
-
- // copy system properties
- logger.info("Copy system properties to a file");
- Properties prop1 = System.getProperties();
- File file1 = createFile("createAndReadPropertyFile-1", prop1);
-
- // read in properties, and compare
- logger.info("Read in properties from new file");
- Properties prop2 = PropertyUtil.getProperties(file1);
-
- // they should match
- assertEquals(prop1, prop2);
- }
-
- /**
- * This tests the 'PropertyUtil.Listener' interface.
- */
- @Test
- public void testListenerInterface() throws Exception
- {
- logger.info("testListenerInterface: test receipt of dynamic updates");
-
- // create initial property file
- Properties prop1 = new Properties();
- prop1.setProperty("p1", "p1 value");
- prop1.setProperty("p2", "p2 value");
- prop1.setProperty("p3", "p3 value");
- logger.info("Create initial properties file: " + prop1);
- File file1 = createFile("createAndReadPropertyFile-2", prop1);
-
- // create a listener for the notification interface
- Object[] returns = new Object[2];
- PropertyUtil.Listener listener = createListenerThread(returns);
-
- // read it in, and do a comparison
- Properties prop2 = PropertyUtil.getProperties(file1, listener);
- logger.info("Read in properties: " + prop2);
- assertEquals(prop1, prop2);
- assertEquals(prop2.getProperty("p1"), "p1 value");
- assertEquals(prop2.getProperty("p2"), "p2 value");
- assertEquals(prop2.getProperty("p3"), "p3 value");
-
- // make some changes, and update the file (p3 is left unchanged)
- prop2.remove("p1"); // remove one property
- prop2.setProperty("p2", "new p2 value"); // change one property
- prop2.setProperty("p4", "p4 value"); // add a new property
- logger.info("Modified properties: " + prop2);
-
- // now, update the file, and wait for notification
- synchronized(returns)
- {
- createFile("createAndReadPropertyFile-2", prop2);
-
- // wait up to 60 seconds, although we should receive notification
- // in 10 seconds or less (if things are working)
- returns.wait(60000L);
- }
-
- // verify we have the updates
- assertEquals(prop2, returns[0]);
-
- // verify that we have the expected set of keys
- assertEquals(new TreeSet<String>(Arrays.asList(new String[]{"p1", "p2", "p4"})),
- returns[1]);
- }
+public class PropertyUtilTest {
+ private static final Logger logger = LoggerFactory.getLogger(PropertyUtilTest.class);
+
+ private static File directory = null;
+
+ /**
+ * Test Setup -- Create a directory for temporary files.
+ */
+ @BeforeClass
+ public static void setup() {
+ logger.info("setup: creating a temporary directory");
+
+ // create a directory for temporary files
+ directory = new File(UUID.randomUUID().toString());
+ directory.mkdir();
+ }
+
+ /**
+ * Test Cleanup -- Remove temporary files.
+ */
+ @AfterClass
+ public static void teardown() {
+ logger.info("teardown: remove the temporary directory");
+
+ // the assumption is that we only have one level of temporary files
+ for (File file : directory.listFiles()) {
+ file.delete();
+ }
+ directory.delete();
+ }
+
+ /**
+ * Utility method to write a properties file.
+ *
+ * @param name the file name, relative to the temporary directory
+ * @param the properties to store in the file
+ * @return a File instance associated with the newly-created file
+ * @throws IOException if the file can't be created for some reason
+ */
+ File createFile(String name, Properties properties) throws IOException {
+ File file = new File(directory, name);
+ try (FileOutputStream fos = new FileOutputStream(file)) {
+ properties.store(fos, "Property file '" + name + "'");
+ }
+ return (file);
+ }
+
+ /**
+ * Create a 'PropertyUtil.Listener' subclass, which receives property
+ * file updates. It stores the latest values in an array, and notifies
+ * any thread waiting on this array.
+ *
+ * @param returns this is an array of length 2 -- the first entry will
+ * contain the 'properties' value, and the second will contain
+ * 'changedKeys'. It is also used to signal any waiting thread
+ * using 'returns.notifyAll()'.
+ */
+ PropertyUtil.Listener createListenerThread(final Object[] returns) {
+ return (new PropertyUtil.Listener() {
+ public void propertiesChanged(Properties properties, Set<String> changedKeys) {
+ // When a notification is received, store the values in the
+ // 'returns' array, and signal using the same array.
+ logger.info("Listener invoked: properties=" + properties
+ + ", changedKeys=" + changedKeys);
+ returns[0] = properties;
+ returns[1] = changedKeys;
+ synchronized (returns) {
+ returns.notifyAll();
+ }
+ }
+ });
+ }
+
+ /**
+ * Test the basic properties file interface.
+ */
+ @Test
+ public void testGetProperties() throws Exception {
+ logger.info("testGetProperties: test the basic properties file interface");
+
+ // copy system properties
+ logger.info("Copy system properties to a file");
+ Properties prop1 = System.getProperties();
+ File file1 = createFile("createAndReadPropertyFile-1", prop1);
+
+ // read in properties, and compare
+ logger.info("Read in properties from new file");
+ Properties prop2 = PropertyUtil.getProperties(file1);
+
+ // they should match
+ assertEquals(prop1, prop2);
+ }
+
+ /**
+ * This tests the 'PropertyUtil.Listener' interface.
+ */
+ @Test
+ public void testListenerInterface() throws Exception {
+ logger.info("testListenerInterface: test receipt of dynamic updates");
+
+ // create initial property file
+ Properties prop1 = new Properties();
+ prop1.setProperty("p1", "p1 value");
+ prop1.setProperty("p2", "p2 value");
+ prop1.setProperty("p3", "p3 value");
+ logger.info("Create initial properties file: " + prop1);
+ File file1 = createFile("createAndReadPropertyFile-2", prop1);
+
+ // create a listener for the notification interface
+ Object[] returns = new Object[2];
+ PropertyUtil.Listener listener = createListenerThread(returns);
+
+ // read it in, and do a comparison
+ Properties prop2 = PropertyUtil.getProperties(file1, listener);
+ logger.info("Read in properties: " + prop2);
+ assertEquals(prop1, prop2);
+ assertEquals("p1 value", prop2.getProperty("p1"));
+ assertEquals("p2 value", prop2.getProperty("p2"));
+ assertEquals("p3 value", prop2.getProperty("p3"));
+
+ // make some changes, and update the file (p3 is left unchanged)
+ prop2.remove("p1"); // remove one property
+ prop2.setProperty("p2", "new p2 value"); // change one property
+ prop2.setProperty("p4", "p4 value"); // add a new property
+ logger.info("Modified properties: " + prop2);
+
+ // now, update the file, and wait for notification
+ synchronized (returns) {
+ createFile("createAndReadPropertyFile-2", prop2);
+
+ // wait up to 60 seconds, although we should receive notification
+ // in 10 seconds or less (if things are working)
+ returns.wait(60000L);
+ }
+
+ // verify we have the updates
+ assertEquals(prop2, returns[0]);
+
+ // verify that we have the expected set of keys
+ assertEquals(new TreeSet<String>(Arrays.asList(new String[]{"p1", "p2", "p4"})),
+ returns[1]);
+ }
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java
index 1d6b111a..255c7f13 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import org.onap.policy.drools.utils.Reference;
@@ -54,22 +55,22 @@ public class ReferenceTest {
public void testCompareAndSet() {
Reference<Integer> val = new Reference<>(null);
- Integer v = 100;
+ Integer valCompare = 100;
// try an incorrect value - should fail and leave value unchanged
- assertFalse(val.compareAndSet(500, v));
+ assertFalse(val.compareAndSet(500, valCompare));
assertNull(val.get());
- assertTrue(val.compareAndSet(null, v));
- assertEquals(v, val.get());
+ assertTrue(val.compareAndSet(null, valCompare));
+ assertEquals(valCompare, val.get());
// try an incorrect value - should fail and leave value unchanged
Integer v2 = 200;
assertFalse(val.compareAndSet(600, v2));
- assertEquals(v, val.get());
+ assertEquals(valCompare, val.get());
// now try again, this time with the correct value
- assertTrue(val.compareAndSet(v, v2));
+ assertTrue(val.compareAndSet(valCompare, v2));
assertEquals(v2, val.get());
Integer v3 = 300;
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java
index 0cb51060..706c5f24 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.drools.utils;
import static org.junit.Assert.assertEquals;
@@ -62,23 +63,23 @@ public class ReflectionUtilTest {
@Test(expected = IllegalArgumentException.class)
public void testException1() {
- ReflectionUtil.fetchClass(null, "org.onap.policy.drools.utils.ReflectionUtil");
+ ReflectionUtil.fetchClass(null, "org.onap.policy.drools.utils.ReflectionUtil");
}
@Test(expected = IllegalArgumentException.class)
public void testException2() {
Class<?> class1;
- try {
- class1 = Class.forName("org.onap.policy.drools.utils.ReflectionUtil");
- ClassLoader classLoader = class1.getClassLoader();
- ReflectionUtil.fetchClass(classLoader, null);
- } catch (ClassNotFoundException e) {
- fail();
- }
+ try {
+ class1 = Class.forName("org.onap.policy.drools.utils.ReflectionUtil");
+ ClassLoader classLoader = class1.getClassLoader();
+ ReflectionUtil.fetchClass(classLoader, null);
+ } catch (ClassNotFoundException e) {
+ fail();
+ }
}
@Test
public void testException3() throws ClassNotFoundException {
- assertNull(ReflectionUtil.fetchClass(ClassLoader.getSystemClassLoader(), "foo.bar"));
+ assertNull(ReflectionUtil.fetchClass(ClassLoader.getSystemClassLoader(), "foo.bar"));
}
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java
index d773b265..be1a8a97 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.drools.utils.logging;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.slf4j.Logger;
@@ -27,30 +29,30 @@ import org.slf4j.LoggerFactory;
public class LoggerUtilTest {
- @Test
- public void test() {
+ @Test
+ public void test() {
- Logger logger = LoggerFactory.getLogger(LoggerUtilTest.class);
+ Logger logger = LoggerFactory.getLogger(LoggerUtilTest.class);
- assertTrue(logger.isInfoEnabled());
+ assertTrue(logger.isInfoEnabled());
- logger.info("line 1");
- logger.info(LoggerUtil.METRIC_LOG_MARKER, "line 1 Metric");
- logger.info(LoggerUtil.TRANSACTION_LOG_MARKER, "line 1 Transaction");
+ logger.info("line 1");
+ logger.info(LoggerUtil.METRIC_LOG_MARKER, "line 1 Metric");
+ logger.info(LoggerUtil.TRANSACTION_LOG_MARKER, "line 1 Transaction");
- LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "warn");
- logger.info("line 2");
- logger.info(LoggerUtil.METRIC_LOG_MARKER, "line 2 Metric");
- logger.info(LoggerUtil.TRANSACTION_LOG_MARKER, "line 2 Transaction");
+ LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "warn");
+ logger.info("line 2");
+ logger.info(LoggerUtil.METRIC_LOG_MARKER, "line 2 Metric");
+ logger.info(LoggerUtil.TRANSACTION_LOG_MARKER, "line 2 Transaction");
- assertFalse(logger.isInfoEnabled());
+ assertFalse(logger.isInfoEnabled());
- LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "debug");
- logger.debug("line 3");
- logger.debug(LoggerUtil.METRIC_LOG_MARKER, "line 3 Metric");
- logger.debug(LoggerUtil.TRANSACTION_LOG_MARKER, "line 3 Transaction");
+ LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "debug");
+ logger.debug("line 3");
+ logger.debug(LoggerUtil.METRIC_LOG_MARKER, "line 3 Metric");
+ logger.debug(LoggerUtil.TRANSACTION_LOG_MARKER, "line 3 Transaction");
- assertTrue(logger.isDebugEnabled());
- }
+ assertTrue(logger.isDebugEnabled());
+ }
}
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MDCTransactionTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
index f6c48daf..1b7a3c7d 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MDCTransactionTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java
@@ -16,16 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.policy.drools.utils.logging;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import java.time.Duration;
import java.time.Instant;
import org.junit.Test;
import org.slf4j.MDC;
-public class MDCTransactionTest {
+public class MdcTransactionTest {
@Test
public void resetSubTransaction() {
@@ -114,31 +118,31 @@ public class MDCTransactionTest {
@Test
public void flush() {
MDCTransaction trans =
- MDCTransaction.newTransaction().
- setRequestId(null).
- setInvocationId(null).
- setPartner(null).
- setVirtualServerName(null).
- setServer(null).
- setServerIpAddress(null).
- setServerFqdn(null).
- setServiceName(null).
- setStartTime(null).
- setEndTime(null).
- setServiceInstanceId("service-instance-id").
- setInstanceUUID(null).
- setProcessKey("process-key").
- setStatusCode("status-code").
- setResponseCode("response-code").
- setResponseDescription("response-description").
- setSeverity("severity").
- setAlertSeverity("alert-severity").
- setTargetEntity("target-entity").
- setTargetServiceName("target-service-name").
- setTargetVirtualEntity("target-virtual-entity").
- setClientIpAddress("client-ip-address").
- setRemoteHost("remote-host").
- flush();
+ MDCTransaction.newTransaction()
+ .setRequestId(null)
+ .setInvocationId(null)
+ .setPartner(null)
+ .setVirtualServerName(null)
+ .setServer(null)
+ .setServerIpAddress(null)
+ .setServerFqdn(null)
+ .setServiceName(null)
+ .setStartTime(null)
+ .setEndTime(null)
+ .setServiceInstanceId("service-instance-id")
+ .setInstanceUUID(null)
+ .setProcessKey("process-key")
+ .setStatusCode("status-code")
+ .setResponseCode("response-code")
+ .setResponseDescription("response-description")
+ .setSeverity("severity")
+ .setAlertSeverity("alert-severity")
+ .setTargetEntity("target-entity")
+ .setTargetServiceName("target-service-name")
+ .setTargetVirtualEntity("target-virtual-entity")
+ .setClientIpAddress("client-ip-address")
+ .setRemoteHost("remote-host")
+ .flush();
assertTransactionFields(trans);
@@ -180,18 +184,18 @@ public class MDCTransactionTest {
assertEquals(trans.getClientIpAddress(), MDC.get(MDCTransaction.CLIENT_IP_ADDRESS));
assertEquals(trans.getRemoteHost(), MDC.get(MDCTransaction.REMOTE_HOST));
- assertEquals(trans.getServiceInstanceId(),"service-instance-id");
- assertEquals(trans.getProcessKey(),"process-key");
- assertEquals(trans.getStatusCode(),"status-code");
- assertEquals(trans.getResponseCode(),"response-code");
- assertEquals(trans.getResponseDescription(),"response-description");
- assertEquals(trans.getSeverity(),"severity");
- assertEquals(trans.getAlertSeverity(),"alert-severity");
- assertEquals(trans.getTargetEntity(),"target-entity");
- assertEquals(trans.getTargetServiceName(),"target-service-name");
- assertEquals(trans.getTargetVirtualEntity(),"target-virtual-entity");
- assertEquals(trans.getClientIpAddress(),"client-ip-address");
- assertEquals(trans.getRemoteHost(),"remote-host");
+ assertEquals("service-instance-id", trans.getServiceInstanceId());
+ assertEquals("process-key", trans.getProcessKey());
+ assertEquals("status-code", trans.getStatusCode());
+ assertEquals("response-code", trans.getResponseCode());
+ assertEquals("response-description", trans.getResponseDescription());
+ assertEquals("severity", trans.getSeverity());
+ assertEquals("alert-severity", trans.getAlertSeverity());
+ assertEquals("target-entity", trans.getTargetEntity());
+ assertEquals("target-service-name", trans.getTargetServiceName());
+ assertEquals("target-virtual-entity", trans.getTargetVirtualEntity());
+ assertEquals("client-ip-address", trans.getClientIpAddress());
+ assertEquals("remote-host", trans.getRemoteHost());
}
@Test
@@ -235,20 +239,20 @@ public class MDCTransactionTest {
assertNotNull(subTrans.getStartTime());
assertNullSubTransactionFieldsButInvocationId(trans);
- subTrans.setServiceInstanceId("service-instance-id").
- setInstanceUUID(null).
- setProcessKey("process-key").
- setStatusCode("status-code").
- setResponseCode("response-code").
- setResponseDescription("response-description").
- setSeverity("severity").
- setAlertSeverity("alert-severity").
- setTargetEntity("target-entity").
- setTargetServiceName("target-service-name").
- setTargetVirtualEntity("target-virtual-entity").
- setClientIpAddress("client-ip-address").
- setRemoteHost("remote-host").
- setEndTime(Instant.now());
+ subTrans.setServiceInstanceId("service-instance-id")
+ .setInstanceUUID(null)
+ .setProcessKey("process-key")
+ .setStatusCode("status-code")
+ .setResponseCode("response-code")
+ .setResponseDescription("response-description")
+ .setSeverity("severity")
+ .setAlertSeverity("alert-severity")
+ .setTargetEntity("target-entity")
+ .setTargetServiceName("target-service-name")
+ .setTargetVirtualEntity("target-virtual-entity")
+ .setClientIpAddress("client-ip-address")
+ .setRemoteHost("remote-host")
+ .setEndTime(Instant.now());
subTrans.setStatusCode(false).setResponseCode("400");