Thomas Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame] | 1 | package org.onosproject.incubator.net.tunnel; |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 2 | |
| 3 | import static org.hamcrest.MatcherAssert.assertThat; |
| 4 | import static org.hamcrest.Matchers.is; |
| 5 | import static org.hamcrest.Matchers.notNullValue; |
| 6 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
| 7 | |
| 8 | import org.junit.Test; |
| 9 | import org.onlab.packet.IpAddress; |
| 10 | import org.onosproject.core.DefaultGroupId; |
| 11 | import org.onosproject.net.provider.ProviderId; |
| 12 | |
| 13 | /** |
| 14 | * Test of a tunnel event. |
| 15 | */ |
| 16 | public class TunnelEventTest { |
| 17 | /** |
| 18 | * Checks that the Order class is immutable. |
| 19 | */ |
| 20 | @Test |
| 21 | public void testImmutability() { |
| 22 | assertThatClassIsImmutable(TunnelEvent.class); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Checks the operation of equals(), hashCode() and toString() methods. |
| 27 | */ |
| 28 | @Test |
| 29 | public void testConstructor() { |
| 30 | TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress |
| 31 | .valueOf(23423)); |
| 32 | TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress |
| 33 | .valueOf(32421)); |
| 34 | DefaultGroupId groupId = new DefaultGroupId(92034); |
| 35 | TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); |
| 36 | TunnelId tunnelId = TunnelId.valueOf(41654654); |
| 37 | ProviderId producerName1 = new ProviderId("producer1", "13"); |
| 38 | Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, |
| 39 | Tunnel.State.ACTIVE, groupId, tunnelId, |
samuel | 7a5691a | 2015-05-23 00:36:32 +0800 | [diff] [blame^] | 40 | tunnelName, null); |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 41 | TunnelEvent e1 = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, p1); |
| 42 | assertThat(e1, is(notNullValue())); |
| 43 | assertThat(e1.type(), is(TunnelEvent.Type.TUNNEL_ADDED)); |
| 44 | assertThat(e1.subject(), is(p1)); |
| 45 | } |
| 46 | } |