diff options
Diffstat (limited to 'framework/src/onos/incubator/api/src/test/java/org/onosproject')
12 files changed, 0 insertions, 830 deletions
diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java deleted file mode 100644 index f2b15b09..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.config.basics; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.onosproject.net.config.basics.OpticalPortConfig.TYPE; -import static org.onosproject.net.config.basics.OpticalPortConfig.NAME; -import static org.onosproject.net.config.basics.OpticalPortConfig.PORT; -import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_LAMBDA; -import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_PORT; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.onosproject.net.config.Config; -import org.onosproject.net.config.ConfigApplyDelegate; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.Lists; -import org.onosproject.net.config.basics.OpticalPortConfig; - -public class OpticalPortConfigTest { - private static final String FIELD = "ports"; - private static final String KEY = "opc-test"; - - private static final DeviceId DID = DeviceId.deviceId(KEY); - private static final PortNumber PN = PortNumber.portNumber(100); - private static final ConnectPoint CPT = new ConnectPoint(DID, PN); - private static final String DEMOTREE = "{" + - "\"ports\": [" + - // config entity 0 - "{" + - "\"name\": \"1-10-E1_WPORT\"," + - "\"type\": \"OMS\"" + - "}," + - // config entity 1 - "{" + - "\"type\": \"OCH\"," + - "\"speed\": 0," + - "\"port\": 10" + - "}," + - // config entity 2 - "{" + - "\"name\": \"1-1-E1_LPORT\"," + - "\"type\": \"OCH\"," + - "\"annotations\": {" + - "\"staticLambda\": 1," + - "\"staticPort\": \"1-22-E1_WPORT\"" + - "}" + - "}" + - "]" + - "}"; - - private final ConfigApplyDelegate delegate = new MockCfgDelegate(); - private final ObjectMapper mapper = new ObjectMapper(); - - // one OPC per port in DEMOTREE - private List<OpticalPortConfig> opcl = Lists.newArrayList(); - // JsonNodes representing each port. - private List<JsonNode> testNodes = Lists.newArrayList(); - - @Before - public void setUp() { - try { - JsonNode tree = new ObjectMapper().readTree(DEMOTREE); - Iterator<JsonNode> pitr = tree.get(FIELD).elements(); - while (pitr.hasNext()) { - // initialize a config entity, add to lists - JsonNode jn = pitr.next(); - OpticalPortConfig opc = new OpticalPortConfig(); - ObjectNode node = JsonNodeFactory.instance.objectNode(); - opc.init(CPT, KEY, node, mapper, delegate); - - testNodes.add(jn); - opcl.add(opc); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Test - public void testBaseAttrs() { - // configs 0 and 1 - port with and without alphanumeric names - OpticalPortConfig op0 = opcl.get(0); - OpticalPortConfig op1 = opcl.get(1); - // config 2 - no name - OpticalPortConfig op2 = opcl.get(2); - JsonNode jn0 = testNodes.get(0); - JsonNode jn1 = testNodes.get(1); - - op0.portType(Port.Type.valueOf(jn0.path(TYPE).asText())) - .portName(jn0.path(NAME).asText()); - op1.portType(Port.Type.valueOf(jn1.path(TYPE).asText())) - .portNumberName(jn1.path(PORT).asLong()); - - assertEquals(Port.Type.OMS, op0.type()); - assertEquals(jn0.path(NAME).asText(), op0.name()); - assertEquals(jn1.path(PORT).asText(), op1.numberName()); - assertEquals("", op1.name()); - assertEquals("", op2.name()); - } - - @Test - public void testAdditionalAttrs() { - // config 1 has no annotations, 2 has predefined ones - OpticalPortConfig op1 = opcl.get(1); - OpticalPortConfig op2 = opcl.get(2); - JsonNode jn2 = testNodes.get(2); - Long sl = 1L; - - // see config entity 2 in DEMOTREE - op2.staticLambda(jn2.path("annotations").path(STATIC_LAMBDA).asLong()); - op2.staticPort(jn2.path("annotations").path(STATIC_PORT).asText()); - - assertEquals(sl, op2.staticLambda().get()); - assertFalse(op1.staticLambda().isPresent()); - assertEquals("1-22-E1_WPORT", op2.staticPort()); - assertEquals("", op1.staticPort()); - - op2.staticLambda(null); - assertFalse(op2.staticLambda().isPresent()); - } - - private class MockCfgDelegate implements ConfigApplyDelegate { - - @Override - public void onApply(@SuppressWarnings("rawtypes") Config config) { - config.apply(); - } - - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java deleted file mode 100644 index 55f052ac..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * 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.incubator.net.faultmanagement.alarm; - -import com.google.common.testing.EqualsTester; -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; -import static org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId.alarmEntityId; - -/** - * Test of the alarm source identifier. - * - */ -public class AlarmEntityIdTest { - - /** - * Checks that the class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(AlarmEntityId.class); - } - - @Test - public void string() { - assertEquals("och:foo", - alarmEntityId("och:foo").toString()); - } - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup( - alarmEntityId("och:foo"), - alarmEntityId("och:foo")) - .addEqualityGroup(alarmEntityId("och:bar")) - .testEquals(); - - } - - @Test - public void validSchemaPermitted() { - alarmEntityId("none:foo"); - alarmEntityId("port:foo"); - alarmEntityId("och:foo"); - alarmEntityId("other:foo"); - - } - - @Test(expected = IllegalArgumentException.class) - public void verifyUnexpectedSchemaRejected() { - alarmEntityId("junk:foo"); - } - - @Test(expected = IllegalArgumentException.class) - public void verifyCorruptSchemaRejected() { - alarmEntityId("other:"); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java deleted file mode 100644 index 74453a42..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * 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.incubator.net.faultmanagement.alarm; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * This class tests the immutability, equality, and non-equality of - * {@link AlarmId}. - */ -public class AlarmIdTest { - private static final long ID_A = 1L; - private static final long ID_B = 2L; - private static final long ID_Z = 987654321L; - - /** - * Tests the immutability of {@link AlarmId}. - */ - @Test - public void intentIdFollowsGuidelineForImmutableObject() { - assertThatClassIsImmutable(AlarmId.class); - } - - /** - * Tests equality of {@link AlarmId}. - */ - @Test - public void testEquality() { - final AlarmId id1 = new AlarmId(ID_A); - final AlarmId id2 = new AlarmId(ID_A); - - assertThat(id1, is(id2)); - } - - - /** - * Tests non-equality of {@link AlarmId}. - */ - @Test - public void testNonEquality() { - final AlarmId id1 = new AlarmId(ID_A); - final AlarmId id2 = new AlarmId(ID_B); - - assertThat(id1, is(not(id2))); - } - - @Test - public void valueOf() { - final AlarmId id = new AlarmId(0xdeadbeefL); - assertEquals("incorrect valueOf", id, AlarmId.valueOf(0xdeadbeefL)); - } - - /** - * Tests the equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - final AlarmId id1 = new AlarmId(11111L); - final AlarmId sameAsId1 = new AlarmId(11111L); - final AlarmId id2 = new AlarmId(22222L); - - new EqualsTester() - .addEqualityGroup(id1, sameAsId1) - .addEqualityGroup(id2) - .testEquals(); - } - - /** - * Tests construction of an AlarmId object. - */ - @Test - public void testConstruction() { - final AlarmId id1 = new AlarmId(ID_Z); - assertEquals(id1.fingerprint(), ID_Z); - - // No default constructor so no need to test it ! - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java deleted file mode 100644 index 199ed0d9..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * 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.incubator.net.faultmanagement.alarm; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; -import org.onosproject.net.DeviceId; - -public class DefaultAlarmTest { - - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultAlarm.class); - } - - /** - * Checks the construction of a DefaultAlarm object. - */ - @Test - public void testConstruction() { - final String nameValue = "name3"; - final DefaultAlarm a = new DefaultAlarm.Builder(AlarmId.valueOf(4), - DeviceId.NONE, nameValue, Alarm.SeverityLevel.CLEARED, 3).build(); - - assertThat(a, is(notNullValue())); - final DefaultAlarm b = new DefaultAlarm.Builder(a).build(); - - assertEquals(a, b); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java deleted file mode 100644 index 1055dbad..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.resource.label; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; - -import com.google.common.testing.EqualsTester; - -/** - * Tests of default label resource. - */ -public class DefaultLabelResourceTest extends AbstractEventTest { - - @Test - public void testEquality() { - String deviceId1 = "of:001"; - String deviceId2 = "of:002"; - long labelResourceId1 = 100; - long labelResourceId2 = 200; - DefaultLabelResource h1 = new DefaultLabelResource(deviceId1, - labelResourceId1); - DefaultLabelResource h2 = new DefaultLabelResource(deviceId1, - labelResourceId1); - DefaultLabelResource h3 = new DefaultLabelResource(deviceId2, - labelResourceId2); - DefaultLabelResource h4 = new DefaultLabelResource(deviceId2, - labelResourceId2); - - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java deleted file mode 100644 index 25ef57f7..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.resource.label; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; - -import com.google.common.testing.EqualsTester; - -/** - * Tests of the label resource pool. - */ -public class LabelResourcePoolTest extends AbstractEventTest { - - @Test - public void testEquality() { - LabelResourcePool h1 = new LabelResourcePool("of:001", 0, 100); - LabelResourcePool h2 = new LabelResourcePool("of:001", 0, 100); - LabelResourcePool h3 = new LabelResourcePool("of:002", 0, 100); - LabelResourcePool h4 = new LabelResourcePool("of:002", 0, 100); - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java deleted file mode 100644 index f41ad289..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.resource.label; - -import java.util.Collections; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.ImmutableSet; -import com.google.common.testing.EqualsTester; - -/** - * Tests of the label resource request. - */ -public class LabelResourceRequestTest extends AbstractEventTest { - - @Test - public void testEquality() { - DeviceId deviceId1 = DeviceId.deviceId("of:0001"); - DeviceId deviceId2 = DeviceId.deviceId("of:0002"); - long apply = 2; - ImmutableSet<LabelResource> releaseCollection = ImmutableSet - .copyOf(Collections.emptySet()); - LabelResourceRequest h1 = new LabelResourceRequest( - deviceId1, - LabelResourceRequest.Type.APPLY, - apply, null); - LabelResourceRequest h2 = new LabelResourceRequest( - deviceId1, - LabelResourceRequest.Type.APPLY, - apply, null); - LabelResourceRequest h3 = new LabelResourceRequest( - deviceId2, - LabelResourceRequest.Type.RELEASE, - 0, releaseCollection); - LabelResourceRequest h4 = new LabelResourceRequest( - deviceId2, - LabelResourceRequest.Type.RELEASE, - 0, releaseCollection); - - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java deleted file mode 100644 index 25ec73d4..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.tunnel; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.provider.ProviderId; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the default tunnel model entity. - */ -public class DefaultTunnelTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultTunnel.class); - } - - @Test - public void testEquality() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(32421)); - DefaultGroupId groupId = new DefaultGroupId(92034); - TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - ProviderId producerName1 = new ProviderId("producer1", "13"); - ProviderId producerName2 = new ProviderId("producer2", "13"); - Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - Tunnel p2 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - Tunnel p3 = new DefaultTunnel(producerName2, src, dst, Tunnel.Type.OCH, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java deleted file mode 100644 index 28669a21..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.provider.ProviderId; - -/** - * Test of a tunnel event. - */ -public class TunnelEventTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelEvent.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testConstructor() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(32421)); - DefaultGroupId groupId = new DefaultGroupId(92034); - TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - ProviderId producerName1 = new ProviderId("producer1", "13"); - Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - TunnelEvent e1 = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, p1); - assertThat(e1, is(notNullValue())); - assertThat(e1.type(), is(TunnelEvent.Type.TUNNEL_ADDED)); - assertThat(e1.subject(), is(p1)); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java deleted file mode 100644 index f4c109f9..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for tunnel id class. - */ -public class TunnelIdTest { - - final TunnelId tunnelId1 = TunnelId.valueOf(1); - final TunnelId sameAstunnelId1 = TunnelId.valueOf(1); - final TunnelId tunnelId2 = TunnelId.valueOf(2); - - /** - * Checks that the TunnelId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelId.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - new EqualsTester() - .addEqualityGroup(tunnelId1, sameAstunnelId1) - .addEqualityGroup(tunnelId2) - .testEquals(); - } - - /** - * Checks the construction of a FlowId object. - */ - @Test - public void testConstruction() { - final long tunnelIdValue = 7777L; - final TunnelId tunnelId = TunnelId.valueOf(tunnelIdValue); - assertThat(tunnelId, is(notNullValue())); - assertThat(tunnelId.id(), is(tunnelIdValue)); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java deleted file mode 100644 index d0fc49c7..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for tunnel name class. - */ -public class TunnelNameTest { - final TunnelName name1 = TunnelName.tunnelName("name1"); - final TunnelName sameAsName1 = TunnelName.tunnelName("name1"); - final TunnelName name2 = TunnelName.tunnelName("name2"); - - /** - * Checks that the TunnelName class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelName.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(name1, sameAsName1) - .addEqualityGroup(name2).testEquals(); - } - - /** - * Checks the construction of a OpenFlowGroupId object. - */ - @Test - public void testConstruction() { - final String nameValue = "name3"; - final TunnelName name = TunnelName.tunnelName(nameValue); - assertThat(name, is(notNullValue())); - assertThat(name.value(), is(nameValue)); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java deleted file mode 100644 index 46634c7c..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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.incubator.net.tunnel; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.DefaultApplicationId; - -import com.google.common.testing.EqualsTester; - -/** - * Test of order model entity. - */ -public class TunnelSubscriptionTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelSubscription.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquality() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421)); - ApplicationId appId = new DefaultApplicationId(243, "test"); - ApplicationId appId2 = new DefaultApplicationId(2431, "test1"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} |