Improve unit test coverage for basic config classes
Change-Id: I8a9d6d51fcad89d8d215253fafdbecb12f1c81df
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/AllowedEntityConfigTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/AllowedEntityConfigTest.java
new file mode 100644
index 0000000..a0bc219
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/AllowedEntityConfigTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.config.basics;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import org.junit.Test;
+import org.onosproject.net.config.ConfigApplyDelegate;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public class AllowedEntityConfigTest {
+
+ class TestConfig extends AllowedEntityConfig<String> {
+ TestConfig() {
+ }
+ }
+
+ @Test
+ public void basicTest() {
+ ConfigApplyDelegate delegate = configApply -> { };
+ ObjectMapper mapper = new ObjectMapper();
+
+ TestConfig allowed = new TestConfig();
+ TestConfig notAllowed = new TestConfig();
+
+ allowed.init("enabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
+
+ notAllowed.init("disabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
+ notAllowed.isAllowed(false);
+
+ assertThat(allowed.isAllowed(), is(true));
+ assertThat(notAllowed.isAllowed(), is(false));
+
+ notAllowed.isAllowed(true);
+ allowed.isAllowed(false);
+ assertThat(allowed.isAllowed(), is(false));
+ assertThat(notAllowed.isAllowed(), is(true));
+ }
+}
\ No newline at end of file
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/BandwidthCapacityTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/BandwidthCapacityTest.java
new file mode 100644
index 0000000..146930b
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/BandwidthCapacityTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.config.basics;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import org.junit.Test;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.NetTestTools;
+import org.onosproject.net.config.ConfigApplyDelegate;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+
+public class BandwidthCapacityTest {
+
+ @Test
+ public void testConstruction() {
+ BandwidthCapacity config = new BandwidthCapacity();
+ ConfigApplyDelegate delegate = configApply -> { };
+ ObjectMapper mapper = new ObjectMapper();
+ ConnectPoint cp = NetTestTools.connectPoint("cp1", 3);
+
+ config.init(cp, "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
+
+ double expectedBw = 1.0;
+ config.capacity(Bandwidth.mbps(expectedBw));
+ assertThat(config.isValid(), is(true));
+ assertThat(config.toString(), containsString("capacity"));
+
+ }
+
+}
\ No newline at end of file
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/BasicFeatureConfigTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/BasicFeatureConfigTest.java
new file mode 100644
index 0000000..67ffdef
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/BasicFeatureConfigTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.config.basics;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import org.junit.Test;
+import org.onosproject.net.config.ConfigApplyDelegate;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public class BasicFeatureConfigTest {
+
+ class TestConfig extends BasicFeatureConfig<String> {
+ TestConfig(boolean defaultValue) {
+ super(defaultValue);
+ }
+ }
+
+ @Test
+ public void basicTest() {
+ ConfigApplyDelegate delegate = configApply -> { };
+ ObjectMapper mapper = new ObjectMapper();
+
+ TestConfig enabled = new TestConfig(true);
+ TestConfig disabled = new TestConfig(false);
+
+ enabled.init("enabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
+ disabled.init("disabled", "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
+
+ assertThat(enabled.enabled(), is(true));
+ assertThat(disabled.enabled(), is(false));
+
+ disabled.enabled(true);
+ enabled.enabled(false);
+ assertThat(enabled.enabled(), is(false));
+ assertThat(disabled.enabled(), is(true));
+ }
+}
\ No newline at end of file
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/BasicHostConfigTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/BasicHostConfigTest.java
new file mode 100644
index 0000000..6721cc7
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/BasicHostConfigTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.config.basics;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.google.common.collect.ImmutableSet;
+import org.junit.Test;
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.NetTestTools;
+import org.onosproject.net.config.ConfigApplyDelegate;
+
+import java.util.Set;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+
+public class BasicHostConfigTest {
+
+ /**
+ * Tests construction, setters and getters of a BasicLinkConfig object.
+ */
+ @Test
+ public void testConstruction() {
+ BasicHostConfig config = new BasicHostConfig();
+ ConfigApplyDelegate delegate = configApply -> { };
+ ObjectMapper mapper = new ObjectMapper();
+ HostId hostId = NetTestTools.hid("12:34:56:78:90:ab/1");
+ IpAddress ip1 = IpAddress.valueOf("1.1.1.1");
+ IpAddress ip2 = IpAddress.valueOf("1.1.1.2");
+ IpAddress ip3 = IpAddress.valueOf("1.1.1.3");
+ Set<IpAddress> ips = ImmutableSet.of(ip1, ip2, ip3);
+ HostLocation loc1 = new HostLocation(
+ NetTestTools.connectPoint("d1", 1), System.currentTimeMillis());
+ HostLocation loc2 = new HostLocation(
+ NetTestTools.connectPoint("d2", 2), System.currentTimeMillis());
+ Set<HostLocation> locs = ImmutableSet.of(loc1, loc2);
+
+ config.init(hostId, "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
+
+ config.setIps(ips)
+ .setLocations(locs);
+
+ assertThat(config.isValid(), is(true));
+ assertThat(config.name(), is("-"));
+ assertThat(config.ipAddresses(), hasSize(3));
+ assertThat(config.ipAddresses(), hasItems(ip1, ip2, ip3));
+ assertThat(config.locations(), hasSize(2));
+ assertThat(config.locations(), hasItems(loc1, loc2));
+ }
+
+}
\ No newline at end of file
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/BasicRegionConfigTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/BasicRegionConfigTest.java
index 7d9b78c..22058fe 100644
--- a/core/api/src/test/java/org/onosproject/net/config/basics/BasicRegionConfigTest.java
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/BasicRegionConfigTest.java
@@ -24,10 +24,15 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.config.InvalidFieldException;
import org.onosproject.net.region.Region;
+import org.onosproject.ui.topo.LayoutLocation;
import java.util.List;
import java.util.Set;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -186,4 +191,37 @@
cfg.isValid();
}
+
+ @Test
+ public void testPeerLocMapping() {
+ String peer1 = "peer1";
+ String loc1 = LayoutLocation.Type.GRID.toString();
+ double loc1Y = 22.0;
+ double loc1X = 33.0;
+ String peer2 = "peer2";
+ String loc2 = LayoutLocation.Type.GEO.toString();
+ double loc2Y = 222.0;
+ double loc2X = 333.0;
+ loadRegion(R2);
+ cfg.addPeerLocMapping(peer1, loc1, loc1Y, loc1X);
+ cfg.addPeerLocMapping(peer2, loc2, loc2Y, loc2X);
+
+ List<LayoutLocation> locs = cfg.getMappings();
+
+ assertThat(locs, hasSize(2));
+
+ LayoutLocation createdLoc1 = locs.stream().filter(loc -> loc.id().equals(peer1)).findFirst().orElse(null);
+ LayoutLocation createdLoc2 = locs.stream().filter(loc -> loc.id().equals(peer2)).findFirst().orElse(null);
+
+ assertThat(createdLoc1, notNullValue());
+ assertThat(createdLoc2, notNullValue());
+
+ assertThat(createdLoc1.locType().toString(), is(loc1));
+ assertThat(createdLoc1.longOrX(), is(loc1X));
+ assertThat(createdLoc1.latOrY(), is(loc1Y));
+
+ assertThat(createdLoc2.locType().toString(), is(loc2));
+ assertThat(createdLoc2.longOrX(), is(loc2X));
+ assertThat(createdLoc2.latOrY(), is(loc2Y));
+ }
}
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/McastConfigTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/McastConfigTest.java
new file mode 100644
index 0000000..03536cd
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/McastConfigTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2016-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.config.basics;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.annotations.Beta;
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.packet.VlanId;
+import org.onosproject.TestApplicationId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.ConfigApplyDelegate;
+
+import java.io.InputStream;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for class {@link McastConfig}.
+ */
+@Beta
+public class McastConfigTest {
+ private static final TestApplicationId APP_ID =
+ new TestApplicationId(CoreService.CORE_APP_NAME);
+ private McastConfig config;
+ private McastConfig invalidConfig;
+
+ private static final VlanId INGRESS_VLAN_1 = VlanId.NONE;
+ private static final VlanId EGRESS_VLAN_1 = VlanId.NONE;
+ private static final VlanId INGRESS_VLAN_2 = VlanId.vlanId((short) 100);
+ private static final VlanId EGRESS_VLAN_2 = VlanId.vlanId((short) 100);
+
+ /**
+ * Initialize test related variables.
+ *
+ * @throws Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ InputStream jsonStream = McastConfigTest.class
+ .getResourceAsStream("/mcast-config.json");
+ InputStream invalidJsonStream = McastConfigTest.class
+ .getResourceAsStream("/mcast-config-invalid.json");
+
+ ApplicationId subject = APP_ID;
+ String key = CoreService.CORE_APP_NAME;
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode jsonNode = mapper.readTree(jsonStream);
+ JsonNode invalidJsonNode = mapper.readTree(invalidJsonStream);
+ ConfigApplyDelegate delegate = new MockDelegate();
+
+ config = new McastConfig();
+ config.init(subject, key, jsonNode, mapper, delegate);
+ invalidConfig = new McastConfig();
+ invalidConfig.init(subject, key, invalidJsonNode, mapper, delegate);
+ }
+
+ /**
+ * Tests config validity.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void isValid() throws Exception {
+ assertTrue(config.isValid());
+ assertFalse(invalidConfig.isValid());
+ }
+
+ /**
+ * Tests ingress VLAN getter.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void ingressVlan() throws Exception {
+ VlanId ingressVlan = config.ingressVlan();
+ assertNotNull("ingressVlan should not be null", ingressVlan);
+ assertThat(ingressVlan, is(INGRESS_VLAN_1));
+ }
+
+ /**
+ * Tests ingress VLAN setter.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void setIngressVlan() throws Exception {
+ config.setIngressVlan(INGRESS_VLAN_2);
+
+ VlanId ingressVlan = config.ingressVlan();
+ assertNotNull("ingressVlan should not be null", ingressVlan);
+ assertThat(ingressVlan, is(INGRESS_VLAN_2));
+ }
+
+ /**
+ * Tests egress VLAN getter.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void egressVlan() throws Exception {
+ VlanId egressVlan = config.egressVlan();
+ assertNotNull("egressVlan should not be null", egressVlan);
+ assertThat(egressVlan, is(EGRESS_VLAN_1));
+ }
+
+ /**
+ * Tests egress VLAN setter.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void setEgressVlan() throws Exception {
+ config.setEgressVlan(EGRESS_VLAN_2);
+
+ VlanId egressVlan = config.egressVlan();
+ assertNotNull("egressVlan should not be null", egressVlan);
+ assertThat(egressVlan, is(EGRESS_VLAN_2));
+ }
+
+ private class MockDelegate implements ConfigApplyDelegate {
+ @Override
+ public void onApply(Config config) {
+ }
+ }
+}
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/SubjectFactoriesTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/SubjectFactoriesTest.java
new file mode 100644
index 0000000..7a4dc1a
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/SubjectFactoriesTest.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.config.basics;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.TestApplicationId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreServiceAdapter;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.HostId;
+import org.onosproject.net.LinkKey;
+import org.onosproject.net.NetTestTools;
+import org.onosproject.net.config.SubjectFactory;
+import org.onosproject.net.region.RegionId;
+import org.onosproject.ui.model.topo.UiTopoLayoutId;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+public class SubjectFactoriesTest {
+
+ class TestCoreService extends CoreServiceAdapter {
+
+ @Override
+ public ApplicationId registerApplication(String key) {
+ return new TestApplicationId(key);
+ }
+
+ }
+
+ @Before
+ public void setUp() {
+ SubjectFactories.setCoreService(new TestCoreService());
+ }
+
+ @Test
+ public void testAppIdFactory() {
+ SubjectFactory<ApplicationId> appIdFactory = SubjectFactories.APP_SUBJECT_FACTORY;
+ assertThat(appIdFactory, notNullValue());
+
+ ApplicationId id = NetTestTools.APP_ID;
+ ApplicationId createdAppId = appIdFactory.createSubject(id.name());
+ assertThat(createdAppId.id(), equalTo(id.id()));
+ assertThat(appIdFactory.subjectKey(id), is(id.name()));
+ }
+
+ @Test
+ public void testDeviceIdFactory() {
+ SubjectFactory<DeviceId> deviceIdFactory = SubjectFactories.DEVICE_SUBJECT_FACTORY;
+ assertThat(deviceIdFactory, notNullValue());
+
+ String deviceName = "d1";
+ String ofDeviceName = "of:" + deviceName;
+ DeviceId id = NetTestTools.did(deviceName);
+
+ DeviceId createdDeviceId = deviceIdFactory.createSubject(ofDeviceName);
+ assertThat(createdDeviceId, equalTo(id));
+ assertThat(deviceIdFactory.subjectKey(id), is(ofDeviceName));
+ }
+
+ @Test
+ public void testConnectPointFactory() {
+ SubjectFactory<ConnectPoint> connectPointFactory = SubjectFactories.CONNECT_POINT_SUBJECT_FACTORY;
+ assertThat(connectPointFactory, notNullValue());
+
+ String deviceName = "d1";
+ String ofDeviceName = "of:" + deviceName;
+ int devicePort = 2;
+ String cpString = ofDeviceName + "/" + Integer.toString(devicePort);
+ ConnectPoint cp = NetTestTools.connectPoint(deviceName, devicePort);
+
+ ConnectPoint createdConnectPoint = connectPointFactory.createSubject(cpString);
+ assertThat(createdConnectPoint, equalTo(cp));
+ assertThat(connectPointFactory.subjectKey(cp), is(cpString));
+ }
+
+ @Test
+ public void testHostFactory() {
+ SubjectFactory<HostId> hostFactory = SubjectFactories.HOST_SUBJECT_FACTORY;
+ assertThat(hostFactory, notNullValue());
+
+ String hostName = "11:11:11:11:11:11/3";
+ HostId hostId = NetTestTools.hid(hostName);
+
+ HostId createdHostId = hostFactory.createSubject(hostName);
+ assertThat(createdHostId, equalTo(hostId));
+ assertThat(hostFactory.subjectKey(hostId), is(hostId.toString()));
+ }
+
+ @Test
+ public void testLinkFactory() {
+ SubjectFactory<LinkKey> linkFactory = SubjectFactories.LINK_SUBJECT_FACTORY;
+ assertThat(linkFactory, notNullValue());
+
+ String deviceName1 = "d1";
+ String deviceName2 = "d2";
+ String ofDeviceName1 = "of:" + deviceName1;
+ String ofDeviceName2 = "of:" + deviceName2;
+ int devicePort1 = 2;
+ int devicePort2 = 3;
+ String cpString1 = ofDeviceName1 + "/" + Integer.toString(devicePort1);
+ String cpString2 = ofDeviceName2 + "/" + Integer.toString(devicePort2);
+ ConnectPoint cp1 = NetTestTools.connectPoint(deviceName1, devicePort1);
+ ConnectPoint cp2 = NetTestTools.connectPoint(deviceName2, devicePort2);
+ String linkString1 = cpString1 + '-' + cpString2;
+ LinkKey key1 = LinkKey.linkKey(cp1, cp2);
+
+ LinkKey createdLink1 = linkFactory.createSubject(linkString1);
+ assertThat(createdLink1.asId(), is(linkString1));
+ assertThat(linkFactory.subjectKey(key1), is(linkString1));
+ }
+
+ @Test
+ public void testRegionIdFactory() {
+ SubjectFactory<RegionId> regionIdFactory = SubjectFactories.REGION_SUBJECT_FACTORY;
+ assertThat(regionIdFactory, notNullValue());
+
+ String region1 = "region1";
+ RegionId id = RegionId.regionId(region1);
+
+ RegionId createdRegionId = regionIdFactory.createSubject(region1);
+ assertThat(createdRegionId.id(), equalTo(region1));
+ assertThat(regionIdFactory.subjectKey(id), is(region1));
+ }
+
+ @Test
+ public void testUITopoLayoutIdFactory() {
+ SubjectFactory<UiTopoLayoutId> uiTopoLayoutIdFactory = SubjectFactories.LAYOUT_SUBJECT_FACTORY;
+ assertThat(uiTopoLayoutIdFactory, notNullValue());
+
+ String layout1 = "layout1";
+ UiTopoLayoutId id = UiTopoLayoutId.layoutId(layout1);
+
+ UiTopoLayoutId createdLayouId = uiTopoLayoutIdFactory.createSubject(layout1);
+ assertThat(createdLayouId.id(), equalTo(layout1));
+ assertThat(uiTopoLayoutIdFactory.subjectKey(id), is(layout1));
+ }
+}
\ No newline at end of file
diff --git a/core/api/src/test/resources/mcast-config-invalid.json b/core/api/src/test/resources/mcast-config-invalid.json
new file mode 100644
index 0000000..3d7c3a0
--- /dev/null
+++ b/core/api/src/test/resources/mcast-config-invalid.json
@@ -0,0 +1,4 @@
+{
+ "ingressVlan" : "None",
+ "egressVlan" : "5000"
+}
\ No newline at end of file
diff --git a/core/api/src/test/resources/mcast-config.json b/core/api/src/test/resources/mcast-config.json
new file mode 100644
index 0000000..ba8eaeb
--- /dev/null
+++ b/core/api/src/test/resources/mcast-config.json
@@ -0,0 +1,4 @@
+{
+ "ingressVlan" : "None",
+ "egressVlan" : "None"
+}
\ No newline at end of file