X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FEdgeTest.java;fp=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FEdgeTest.java;h=0000000000000000000000000000000000000000;hp=7c36d096822af755516732f5db0f94dac5e9d24d;hb=42c32160bfd41de57189bb246fec5ffb48ed8e9e;hpb=edf5bfcee83c750853253ccfd991ba7000f5f65b diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/EdgeTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/EdgeTest.java deleted file mode 100644 index 7c36d09682..0000000000 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/core/EdgeTest.java +++ /dev/null @@ -1,186 +0,0 @@ - -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -/** - * @file EdgeTest.java - * - * @brief Unit Tests for Edge element - * - * Unit Tests for Edge element - */ -package org.opendaylight.controller.sal.core; - -import org.junit.Assert; -import org.junit.Test; - -public class EdgeTest { - @Test - public void testEdgeEquals() { - try { - Node n0 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - NodeConnector c0 = new NodeConnector( - NodeConnector.NodeConnectorIDType.OPENFLOW, new Short( - (short) 0x4), n0); - - Node n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - NodeConnector c1 = new NodeConnector( - NodeConnector.NodeConnectorIDType.OPENFLOW, new Short( - (short) 0x1), n1); - - Node n2 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - NodeConnector c2 = new NodeConnector( - NodeConnector.NodeConnectorIDType.OPENFLOW, new Short( - (short) 0x4), n2); - - Node n3 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - NodeConnector c3 = new NodeConnector( - NodeConnector.NodeConnectorIDType.OPENFLOW, new Short( - (short) 0x1), n3); - - Edge e0 = new Edge(c0, c1); - Edge e1 = new Edge(c2, c3); - // e0 must be equal to e1 to pass the test - Assert.assertTrue(e0.equals(e1)); - } catch (ConstructionException e) { - // Exception is NOT expected if raised test will fail - Assert.assertTrue(false); - } - } - - @Test - public void testEdgeDifferents() { - Node n0, n1, n2, n3; - NodeConnector c0, c1, c2, c3; - Edge e0, e1; - try { - // Difference in the tail node - n0 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c0 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n0); - - n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c1 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n1); - - e0 = new Edge(c0, c1); - - n2 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c2 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n2); - - n3 = new Node(Node.NodeIDType.OPENFLOW, new Long(111L)); - c3 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n3); - - e0 = new Edge(c0, c1); - e1 = new Edge(c2, c3); - // e0 must be different from e1 to pass the test - Assert.assertTrue(!e0.equals(e1)); - - // Difference in the head node - n0 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c0 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n0); - - n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c1 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n1); - - e0 = new Edge(c0, c1); - - n2 = new Node(Node.NodeIDType.OPENFLOW, new Long(41L)); - c2 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n2); - - n3 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c3 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n3); - - e0 = new Edge(c0, c1); - e1 = new Edge(c2, c3); - // e0 must be different from e1 to pass the test - Assert.assertTrue(!e0.equals(e1)); - - // Difference in the head nodeconnetor - n0 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c0 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n0); - - n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c1 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n1); - - e0 = new Edge(c0, c1); - - n2 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c2 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x5), n2); - - n3 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c3 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n3); - - e0 = new Edge(c0, c1); - e1 = new Edge(c2, c3); - // e0 must be different from e1 to pass the test - Assert.assertTrue(!e0.equals(e1)); - - // Difference in the tail nodeconnetor - n0 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c0 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n0); - - n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c1 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n1); - - e0 = new Edge(c0, c1); - - n2 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c2 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n2); - - n3 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c3 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x2), n3); - - e0 = new Edge(c0, c1); - e1 = new Edge(c2, c3); - // e0 must be different from e1 to pass the test - Assert.assertTrue(!e0.equals(e1)); - - // Difference in the both nodeconnetor/node - n0 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c0 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n0); - - n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L)); - c1 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x1), n1); - - e0 = new Edge(c0, c1); - - n2 = new Node(Node.NodeIDType.OPENFLOW, new Long(40L)); - c2 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x4), n2); - - n3 = new Node(Node.NodeIDType.OPENFLOW, new Long(111L)); - c3 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, - new Short((short) 0x2), n3); - - e0 = new Edge(c0, c1); - e1 = new Edge(c2, c3); - // e0 must be different from e1 to pass the test - Assert.assertTrue(!e0.equals(e1)); - } catch (ConstructionException e) { - // Exception is NOT expected if raised test will fail - Assert.assertTrue(false); - } - } -}