diff options
Diffstat (limited to 'controlloop/m2')
15 files changed, 64 insertions, 62 deletions
diff --git a/controlloop/m2/appclcm/pom.xml b/controlloop/m2/appclcm/pom.xml index 78200454a..8c4ff9068 100644 --- a/controlloop/m2/appclcm/pom.xml +++ b/controlloop/m2/appclcm/pom.xml @@ -72,7 +72,7 @@ <dependency> <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> + <artifactId>powermock-api-mockito2</artifactId> <scope>test</scope> </dependency> diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java index 0748b6ee0..5f436c2d4 100644 --- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java +++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java @@ -111,7 +111,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void getVnfHealthCheckRequestTest() throws ControlLoopException { + public void testGetVnfHealthCheckRequest() throws ControlLoopException { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); @@ -141,7 +141,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageHealthyStateTest() { + public void testIncomingHealthCheckMessageHealthyState() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); @@ -160,7 +160,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageUnhealthyStateTest() { + public void testIncomingHealthCheckMessageUnhealthyState() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); @@ -181,7 +181,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageUnknownStateTest() { + public void testIncomingHealthCheckMessageUnknownState() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); @@ -202,7 +202,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageNoStateTest() { + public void testIncomingHealthCheckMessageNoState() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); @@ -223,7 +223,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageUnsuccessfulTest() { + public void testIncomingHealthCheckMessageUnsuccessful() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); @@ -244,7 +244,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageNoPayloadTest() { + public void testIncomingHealthCheckMessageNoPayload() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); @@ -262,7 +262,7 @@ public class AppcLcmHealthCheckOperationTest { } @Test - public void incomingHealthCheckMessageEmptyPayloadTest() { + public void testIncomingHealthCheckMessageEmptyPayload() { policy.setRecipe("HEALTHCHECK"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmHealthCheckOperation(transaction, policy, event, 1); diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java index 0ddfb5b2c..6611a9da2 100644 --- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java +++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java @@ -114,7 +114,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmRestartRequestTest() throws ControlLoopException { + public void testGetVmRestartRequest() throws ControlLoopException { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VM); @@ -144,7 +144,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfRestartRequestTest() throws ControlLoopException { + public void testGetVnfRestartRequest() throws ControlLoopException { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VNF); @@ -174,7 +174,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmRebuildRequestTest() throws ControlLoopException { + public void testGetVmRebuildRequest() throws ControlLoopException { policy.setRecipe("REBUILD"); policy.getTarget().setType(TargetType.VM); @@ -204,7 +204,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfRebuildRequestTest() throws ControlLoopException { + public void testGetVnfRebuildRequest() throws ControlLoopException { policy.setRecipe("REBUILD"); policy.getTarget().setType(TargetType.VNF); @@ -234,7 +234,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmMigrateRequestTest() throws ControlLoopException { + public void testGetVmMigrateRequest() throws ControlLoopException { policy.setRecipe("MIGRATE"); policy.getTarget().setType(TargetType.VM); @@ -264,7 +264,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfMigrateRequestTest() throws ControlLoopException { + public void testGetVnfMigrateRequest() throws ControlLoopException { policy.setRecipe("MIGRATE"); policy.getTarget().setType(TargetType.VNF); @@ -294,7 +294,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmEvacuateRequestTest() throws ControlLoopException { + public void testGetVmEvacuateRequest() throws ControlLoopException { policy.setRecipe("EVACUATE"); policy.getTarget().setType(TargetType.VM); @@ -324,7 +324,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfEvacuateRequestTest() throws ControlLoopException { + public void testGetVnfEvacuateRequest() throws ControlLoopException { policy.setRecipe("EVACUATE"); policy.getTarget().setType(TargetType.VNF); @@ -354,7 +354,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmRebootRequestTest() throws ControlLoopException { + public void testGetVmRebootRequest() throws ControlLoopException { policy.setRecipe("REBOOT"); policy.getTarget().setType(TargetType.VM); @@ -386,7 +386,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfRebootRequestTest() throws ControlLoopException { + public void testGetVnfRebootRequest() throws ControlLoopException { policy.setRecipe("REBOOT"); policy.getTarget().setType(TargetType.VNF); @@ -418,7 +418,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfStartRequestTest() throws ControlLoopException { + public void testGetVnfStartRequest() throws ControlLoopException { policy.setRecipe("START"); policy.getTarget().setType(TargetType.VNF); @@ -448,7 +448,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmStartRequestTest() throws ControlLoopException { + public void testGetVmStartRequest() throws ControlLoopException { policy.setRecipe("START"); policy.getTarget().setType(TargetType.VM); @@ -478,7 +478,7 @@ public class AppcLcmOperationTest { } @Test - public void getVnfStopRequestTest() throws ControlLoopException { + public void testGetVnfStopRequest() throws ControlLoopException { policy.setRecipe("STOP"); policy.getTarget().setType(TargetType.VNF); @@ -508,7 +508,7 @@ public class AppcLcmOperationTest { } @Test - public void getVmStopRequestTest() throws ControlLoopException { + public void testGetVmStopRequest() throws ControlLoopException { policy.setRecipe("STOP"); policy.getTarget().setType(TargetType.VM); @@ -546,7 +546,7 @@ public class AppcLcmOperationTest { */ @Test - public void incomingVmSuccessMessageTest() { + public void testIncomingVmSuccessMessage() { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VM); operation = new AppcLcmOperation(transaction, policy, event, 1); @@ -559,7 +559,7 @@ public class AppcLcmOperationTest { } @Test - public void incomingVnfSuccessMessageTest() { + public void testIncomingVnfSuccessMessage() { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmOperation(transaction, policy, event, 1); @@ -580,7 +580,7 @@ public class AppcLcmOperationTest { } @Test - public void incomingVmFailureMessageTest() { + public void testIncomingVmFailureMessage() { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VM); operation = new AppcLcmOperation(transaction, policy, event, 1); @@ -593,7 +593,7 @@ public class AppcLcmOperationTest { } @Test - public void incomingAllVnfFailureMessageTest() { + public void testIncomingAllVnfFailureMessage() { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmOperation(transaction, policy, event, 1); @@ -616,7 +616,7 @@ public class AppcLcmOperationTest { } @Test - public void incomingPartialVnfFailureMessageTest() { + public void testIncomingPartialVnfFailureMessage() { policy.setRecipe("RESTART"); policy.getTarget().setType(TargetType.VNF); operation = new AppcLcmOperation(transaction, policy, event, 1); @@ -657,7 +657,7 @@ public class AppcLcmOperationTest { */ @Test - public void validAaiSubtagTest() { + public void testValidAaiSubtag() { transaction.setNotificationMessage(null); VirtualControlLoopEvent validEvent = new VirtualControlLoopEvent(); validEvent.setTarget("vserver.vserver-name"); @@ -668,7 +668,7 @@ public class AppcLcmOperationTest { } @Test - public void noAaiSubtagTest() { + public void testNoAaiSubtag() { transaction.setNotificationMessage(null); VirtualControlLoopEvent noAaiTag = new VirtualControlLoopEvent(); noAaiTag.setAai(null); @@ -677,7 +677,7 @@ public class AppcLcmOperationTest { } @Test - public void noClosedLoopDisabledInAaiTest() { + public void testNoClosedLoopDisabledInAai() { transaction.setNotificationMessage(null); VirtualControlLoopEvent invalidEvent = new VirtualControlLoopEvent(); assertFalse(AppcLcmOperation.isAaiValid(transaction, invalidEvent)); @@ -686,7 +686,7 @@ public class AppcLcmOperationTest { } @Test - public void closedLoopDisabledInAaiTest() { + public void testClosedLoopDisabledInAai() { transaction.setNotificationMessage(null); VirtualControlLoopEvent invalidEvent = new VirtualControlLoopEvent(); invalidEvent.getAai().put(AppcLcmOperation.DCAE_CLOSEDLOOP_DISABLED_FIELD, "true"); @@ -696,7 +696,7 @@ public class AppcLcmOperationTest { } @Test - public void targetMismatchInAaiTest() { + public void testTargetMismatchInAai() { transaction.setNotificationMessage(null); VirtualControlLoopEvent validEvent = new VirtualControlLoopEvent(); validEvent.setTarget("vserver.vserver-name"); diff --git a/controlloop/m2/base/pom.xml b/controlloop/m2/base/pom.xml index e59025cd7..02df1ee66 100644 --- a/controlloop/m2/base/pom.xml +++ b/controlloop/m2/base/pom.xml @@ -85,7 +85,7 @@ <dependency> <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> + <artifactId>powermock-api-mockito2</artifactId> <scope>test</scope> </dependency> diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java index 5ca62fa82..ec5ab8ef6 100644 --- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java +++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java @@ -121,5 +121,6 @@ public interface Operation extends Serializable { * * @param histEntry the history entry for this particular operation */ - default void histEntryCompleted(ControlLoopOperation histEntry) {} + default void histEntryCompleted(ControlLoopOperation histEntry) { + } } diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java index 65bff684d..e92f6a234 100644 --- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java +++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java @@ -647,14 +647,16 @@ public class Transaction implements Serializable { * * @param transaction the transaction containing the adjunct */ - public default void init(Transaction transaction) {} + public default void init(Transaction transaction) { + } /** * Called for each adjunct when the transaction completes, and is * removed from Drools memory. Any adjunct-specific cleanup can be * done at this point (e.g. freeing locks). */ - public default void cleanup(Transaction transaction) {} + public default void cleanup(Transaction transaction) { + } } /** diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java index 4cbd05e03..ce5f2df1f 100644 --- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java +++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java @@ -101,7 +101,7 @@ public class ActorOperationTest { } @Test - public void operationTest() throws ControlLoopException { + public void testOperation() throws ControlLoopException { Actor actor = new TestActor(); Operation operation = actor.createOperation(null, null, null, 0); assertNotNull(operation); diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java index eacfc8f6f..78aab89d4 100644 --- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java +++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java @@ -65,7 +65,7 @@ public class GuardAdjunctTest { } @Test - public void asyncQueryTest() { + public void testAsyncQuery() { Policy policy = new Policy(); policy.setActor("APPCLCM"); policy.setRecipe("test"); @@ -83,7 +83,7 @@ public class GuardAdjunctTest { } @Test - public void asyncCreateDbEntryTest() { + public void testAsyncCreateDbEntry() { ControlLoopOperation op = new ControlLoopOperation(); op.setStart(Instant.now().minusSeconds(1)); op.setEnd(Instant.now()); diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java index 3c186ce6d..124509557 100644 --- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java +++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java @@ -111,7 +111,7 @@ public class TransactionTest { } @Test - public void validControlLoopEventTest() { + public void testValidControlLoopEvent() { VirtualControlLoopEvent event = setControlLoopEvent(UUID.randomUUID(), "cltest", Instant.now(), ControlLoopTargetType.VM, "vserver.vserver-name"); Transaction transaction = new Transaction(null, "clvusptest", event.getRequestId(), createControlLoop()); @@ -119,7 +119,7 @@ public class TransactionTest { } @Test - public void noRequestIdControlLoopEventTest() { + public void testNoRequestIdControlLoopEvent() { VirtualControlLoopEvent event = setControlLoopEvent(null, "cltest", Instant.now(), ControlLoopTargetType.VM, "vserver.vserver-name"); Transaction transaction = new Transaction(null, "clvusptest", event.getRequestId(), createControlLoop()); @@ -128,7 +128,7 @@ public class TransactionTest { } @Test - public void noTargetTypeControlLoopEventTest() { + public void testNoTargetTypeControlLoopEvent() { VirtualControlLoopEvent event = setControlLoopEvent(UUID.randomUUID(), "cltest", Instant.now(), null, "vserver.vserver-name"); Transaction transaction = new Transaction(null, "clvusptest", event.getRequestId(), createControlLoop()); @@ -137,7 +137,7 @@ public class TransactionTest { } @Test - public void noTargetControlLoopEventTest() { + public void testNoTargetControlLoopEvent() { VirtualControlLoopEvent event = setControlLoopEvent(UUID.randomUUID(), "cltest", Instant.now(), ControlLoopTargetType.VM, null); Transaction transaction = new Transaction(null, "clvusptest", event.getRequestId(), createControlLoop()); @@ -152,14 +152,14 @@ public class TransactionTest { } @Test - public void getRequestIdTest() { + public void testGetRequestId() { UUID requestId = UUID.randomUUID(); Transaction transaction = new Transaction(null, "clvusptest", requestId, createControlLoop()); assertEquals(requestId, transaction.getRequestId()); } @Test - public void getWorkingMemoryTest() { + public void testGetWorkingMemory() { // Create mock working session StatefulKnowledgeSessionImpl mockWorkingMemory = mock(StatefulKnowledgeSessionImpl.class); Transaction transaction = new Transaction(mockWorkingMemory, "clvusptest", @@ -192,7 +192,7 @@ public class TransactionTest { } @Test - public void getOperationTimeoutTest() { + public void testGetOperationTimeout() { Transaction transaction = new Transaction(null, "clvusptest", UUID.randomUUID(), createControlLoop()); VirtualControlLoopEvent onset = setControlLoopEvent(UUID.randomUUID(), "cltest", null, ControlLoopTargetType.VM, "vserver.vserver-name"); @@ -201,7 +201,7 @@ public class TransactionTest { } @Test - public void getCurrentPolicy() { + public void testGetCurrentPolicy() { ControlLoopPolicy controlLoopPolicy = createControlLoop(); Transaction transaction = new Transaction(null, "clvusptest", UUID.randomUUID(), controlLoopPolicy); VirtualControlLoopEvent onset = setControlLoopEvent(UUID.randomUUID(), @@ -217,7 +217,7 @@ public class TransactionTest { } @Test - public void getNotificationTest() { + public void testGetNotification() { Transaction transaction = new Transaction(null, "clvusptest", UUID.randomUUID(), createControlLoop()); VirtualControlLoopEvent onset = setControlLoopEvent(UUID.randomUUID(), "cltest", null, ControlLoopTargetType.VM, "vserver.vserver-name"); diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/UtilTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/UtilTest.java index 53d97209b..d4518ca6f 100644 --- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/UtilTest.java +++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/UtilTest.java @@ -22,7 +22,7 @@ package org.onap.policy.m2.base; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -54,7 +54,7 @@ public class UtilTest { } @Test - public void deliverTest() { + public void testDeliver() { Properties prop = new Properties(); prop.put("noop.sink.topics", "testTopic"); TopicEndpointManager.getManager().addTopicSinks(prop); diff --git a/controlloop/m2/guard/pom.xml b/controlloop/m2/guard/pom.xml index 501151a85..6362ad43b 100644 --- a/controlloop/m2/guard/pom.xml +++ b/controlloop/m2/guard/pom.xml @@ -40,7 +40,6 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>2.13.0</version> <scope>test</scope> </dependency> diff --git a/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java b/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java index 1a61d9019..777fc78f0 100644 --- a/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java +++ b/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java @@ -76,7 +76,7 @@ public class GuardContextTest { } @Test - public void guardDbResponseTest() throws InterruptedException { + public void testGuardDbResponse() throws InterruptedException { Properties props = new Properties(prop); props.setProperty("guard.disabled", "false"); props.setProperty("guard.javax.persistence.jdbc.user", "user"); @@ -99,7 +99,7 @@ public class GuardContextTest { } @Test - public void badValuesTest() throws InterruptedException { + public void testBadValues() throws InterruptedException { Properties props = new Properties(prop); props.setProperty("guard.disabled", "true"); props.setProperty("guard.pdp.rest.client.user", ""); @@ -120,7 +120,7 @@ public class GuardContextTest { } @Test - public void policyGuardResponseTest() { + public void testPolicyGuardResponse() { UUID requestId = UUID.randomUUID(); PolicyGuardResponse emptyResponse1 = new PolicyGuardResponse(null, null, null); diff --git a/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java b/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java index 4c5770fb2..65ad01a1d 100644 --- a/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java +++ b/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java @@ -71,7 +71,7 @@ public class LockAdjunctTest { } @Test - public void lockAdjunctTest() { + public void testLockAdjunct() { owner = new TestOwner(); lock = PolicyEngineConstants.getManager().createLock("key", "ownerKey", 60, owner, false); LockAdjunct lockA = new LockAdjunct(); diff --git a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java index 3a80f9581..925e9451f 100644 --- a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java +++ b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java @@ -173,7 +173,7 @@ public class SimDmaap { * @return a JSON array, containing 0-limit messages */ String get(String group, long timeout, int limit) - throws InterruptedException { + throws InterruptedException { // look up the group -- create one if it doesn't exist Group groupObj = groupTable.get(group); if (groupObj == null) { @@ -257,7 +257,7 @@ public class SimDmaap { @PathParam("id") String id, @QueryParam("timeout") long timeout, @QueryParam("limit") int limit) - throws InterruptedException { + throws InterruptedException { logger.info("Receive: topic={}, group={}, id={}, timeout={}, limit={}", topic, group, id, timeout, limit); diff --git a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java index 393a030f0..e2d258cb6 100644 --- a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java +++ b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java @@ -98,7 +98,7 @@ public class Util { * @return a String containing the contents of the file */ public static String fileToString(File file) - throws IOException, FileNotFoundException { + throws IOException, FileNotFoundException { try (FileInputStream fis = new FileInputStream(file)) { String string = inputStreamToString(fis); return string; @@ -113,7 +113,7 @@ public class Util { * @return a File, whose contents contain the string */ public static File stringToFile(String string, String suffix) - throws IOException { + throws IOException { File file = File.createTempFile("templates-util", suffix); file.deleteOnExit(); @@ -130,7 +130,7 @@ public class Util { * @return a File, whose contents contain the string */ public static File stringToFile(String string) - throws IOException { + throws IOException { return stringToFile(string, ""); } @@ -162,7 +162,7 @@ public class Util { * replaced */ public static String openAndReplace(String fileName, String... args) - throws IOException, FileNotFoundException { + throws IOException, FileNotFoundException { String text = fileToString(new File(fileName)); for (int i = 0 ; i < args.length ; i += 2) { text = text.replace(args[i], args[i + 1]); |