aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-optimizer/src/test
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-04-03 15:10:10 -0400
committerJerry Flood <jflood@att.com>2019-04-03 15:25:37 -0400
commit5d923ee5f40413f4327f82f77d01c06ebebbbfcb (patch)
tree391d38a2f6a4b076c377aa1d421af9082041f706 /cmso-optimizer/src/test
parent2bfc71e1c9eb6b746648242e02e88625180490af (diff)
Updates for ETE with minizinc
Issue-ID: OPTFRA-436 Change-Id: Ib6eb65728bcdbb2ea27a94125580b181d63babd6 Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-optimizer/src/test')
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java2
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java7
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindowTest.java14
3 files changed, 18 insertions, 5 deletions
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java
index c71c829..817c8de 100644
--- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java
@@ -52,7 +52,7 @@ public class PolicyManagerTest {
public void getPolicyByName() {
String policyName = "Weekday_00_06";
- String result = "CMSO.Weekday_00_06,CMSO.Weekday_00_06,CMSO.Weekday_00_06,";
+ String result = "CMSO.Weekday_00_06,CMSO.Weekday_00_06,CMSO.Weekday_00_06,CMSO.Weekday_00_06,";
List<Policy> policies = policyManager.getSupportedPolicies();
StringBuilder sb = new StringBuilder();
for (Policy pol : policies) {
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java
index ce1f1a4..d772650 100644
--- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java
@@ -23,6 +23,7 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.TimeZone;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -55,10 +56,10 @@ public class RecurringWindowsTest {
@Test
public void getAvailabilityWindowsForPolicies() {
- getAvailabilityWindowsForPolicy("Weekday_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 2);
- getAvailabilityWindowsForPolicy("EveryDay_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 4);
+ getAvailabilityWindowsForPolicy("AllDayEveryDay", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 5);
+ getAvailabilityWindowsForPolicy("Weekday_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 3);
+ getAvailabilityWindowsForPolicy("EveryDay_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 5);
getAvailabilityWindowsForPolicy("Weekend_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 3);
-
}
private void getAvailabilityWindowsForPolicy(String policyName, String startStr, String endStr, int size) {
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindowTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindowTest.java
index b1309fb..67242ef 100644
--- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindowTest.java
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindowTest.java
@@ -39,7 +39,12 @@ public class ChangeWindowTest {
testContains(window, "2019-03-07T23:59:59Z", "2019-03-12T00:00:00.00Z", false);
testContains(window, "2019-03-09T23:59:59Z", "2019-03-11T00:00:00.00Z", true);
testContains(window, "2019-03-06T23:59:59Z", "2019-03-06T23:59:59Z", false);
- testContains(window, "2019-03-12T23:59:59Z", "2019-03-13T00:00:00.00Z", false);
+
+ String tz = "US/Eastern";
+ window.setStartTime(Date.from(Instant.parse("2019-03-08T00:00:00.00Z")));
+ window.setEndTime(Date.from(Instant.parse("2019-03-08T06:00:00.00Z")));
+ testContainsTz(window, "2019-03-08T06:00:00Z", "2019-03-08T07:00:00.00Z", tz, true);
+ testContainsTz(window, "2019-03-08T00:00:00Z", "2019-03-08T01:00:00.00Z", tz, false);
}
@@ -50,4 +55,11 @@ public class ChangeWindowTest {
Assert.assertTrue(window.contains(test) == contains);
}
+ private void testContainsTz(ChangeWindow window, String from, String to, String tz, boolean contains) {
+ ChangeWindow test = new ChangeWindow();
+ test.setStartTime(Date.from(Instant.parse(from)));
+ test.setEndTime(Date.from(Instant.parse(to)));
+ Assert.assertTrue(window.containsInTimeZone(test, tz) == contains);
+ }
+
}