diff options
author | Stan Bonev <sb5356@att.com> | 2018-11-28 11:04:03 -0500 |
---|---|---|
committer | Stan Bonev <sb5356@att.com> | 2018-11-28 11:04:03 -0500 |
commit | 749a3c537f597505087a939a33532aef3de90c78 (patch) | |
tree | 54767d4c4478e6d8e9aa659073ae1ca6957c1507 /resource-assignment/provider/src/test/java/jtest | |
parent | 9f6a84afcedd121c0d3c96f1abbead0abc0f9323 (diff) |
RA: Release resources on specific target
Change-Id: I695a916a3d527f61b9483bbb27977695fb1e094c
Issue-ID: CCSDK-766
Signed-off-by: Stan Bonev <sb5356@att.com>
Diffstat (limited to 'resource-assignment/provider/src/test/java/jtest')
3 files changed, 312 insertions, 5 deletions
diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java index b41c068ea..5dcf59917 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -89,6 +89,13 @@ public class DataSetup { return used.equals(usedInDb); } + public boolean checkLimitItem(String resourceName, String assetId, String resourceSetId, int used) { + String where = "resource_id = (SELECT resource_id FROM RESOURCE WHERE resource_name = '" + resourceName + + "' AND asset_id = '" + assetId + "') AND resource_set_id = '" + resourceSetId + "' AND lt_used = " + + used; + return allocationItem.exists(where); + } + public void setTestDb(TestDb testDb) { this.testDb = testDb; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java index a968c3fb1..04ee38115 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java @@ -79,7 +79,7 @@ public class TestGetResource { public void test001() throws Exception { String t = "001"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - no additional criteria"); setupResourceData(); @@ -106,7 +106,7 @@ public class TestGetResource { public void test002() throws Exception { String t = "002"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with resource entity condition"); setupResourceData(); @@ -136,7 +136,7 @@ public class TestGetResource { public void test003() throws Exception { String t = "003"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with resource share group condition"); setupResourceData(); @@ -165,7 +165,7 @@ public class TestGetResource { public void test004() throws Exception { String t = "004"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with resource share group condition NULL"); setupResourceData(); @@ -194,7 +194,7 @@ public class TestGetResource { public void test005() throws Exception { String t = "005"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with both resource entity and resource share group conditions"); setupResourceData(); diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java new file mode 100644 index 000000000..a936786ac --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java @@ -0,0 +1,300 @@ +package jtest.org.onap.ccsdk.sli.adaptors.ra; + +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:test-context.xml"}) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestRelease { + + private static final Logger log = LoggerFactory.getLogger(TestRelease.class); + + @Autowired(required = true) + private ResourceAllocator resourceAllocator; + + @Autowired(required = true) + private DataSetup dataSetup; + + private void setupResourceData() { + dataSetup.cleanup(); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-1::1", "EVC::TEST-1", "1"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-2::1", "EVC::TEST-2", "2"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-2::2", "EVC::TEST-2", "2"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "EVC::TEST-3", "3"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "EVC::TEST-3", "4"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "EVC::TEST-4", "5"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "EVC::TEST-4", "5"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "EVC::TEST-4", "6"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-1::1", "EVC::TEST-1", "1"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "EVC::TEST-3", "3"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "EVC::TEST-3", "4"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-5::1", "EVC::TEST-5", "5"); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-1::1", "EVC::TEST-1", 100); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-2::1", "EVC::TEST-2", 200); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-2::2", "EVC::TEST-2", 200); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "EVC::TEST-3", 300); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "EVC::TEST-3", 400); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "EVC::TEST-4", 500); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "EVC::TEST-4", 500); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "EVC::TEST-4", 600); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-1::1", "EVC::TEST-1", 100); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "EVC::TEST-3", 300); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "EVC::TEST-3", 400); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-5::1", "EVC::TEST-5", 500); + } + + @Test + public void test001() throws Exception { + + String t = "001"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource set"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-4"); + ctx.setAttribute("ra-input.resource-entity-version", "2"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + } + + @Test + public void test002() throws Exception { + + String t = "002"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test release - with resource union"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-4"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + } + + @Test + public void test003() throws Exception { + + String t = "003"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource set on 2 ports"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } + + @Test + public void test004() throws Exception { + + String t = "004"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource union on 2 ports"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } + + @Test + public void test005() throws Exception { + + String t = "005"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource set and asset"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-1"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } + + @Test + public void test006() throws Exception { + + String t = "006"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource union on 2 ports"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-1"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } +} |