diff options
Diffstat (limited to 'cmso-optimizer/src/test')
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); + } + } |