1 package org.openkilda.simulator.bolts;
3 import static org.hamcrest.CoreMatchers.instanceOf;
4 import static org.junit.Assert.assertEquals;
5 import static org.junit.Assert.assertFalse;
6 import static org.junit.Assert.assertThat;
7 import static org.junit.Assert.assertTrue;
19 import com.fasterxml.jackson.databind.ObjectMapper;
20 import org.apache.storm.tuple.Values;
21 import org.junit.After;
22 import org.junit.Before;
23 import org.junit.Rule;
24 import org.junit.Test;
25 import org.junit.rules.ExpectedException;
27 import java.util.ArrayList;
28 import java.util.List;
35 int localLinkPort = 1;
36 List<LinkMessage> links =
new ArrayList<>();
37 String peerSwitch =
"00:00:00:00:00:05";
44 public ExpectedException
thrown = ExpectedException.none();
48 public void setUp() throws Exception {
49 mapper =
new ObjectMapper();
51 speakerBolt.
prepare(null, null, null);
53 link =
new LinkMessage(linkLatency, localLinkPort, peerSwitch, peerPort);
66 assertEquals(1, speakerBolt.
switches.size());
69 assertTrue(sw.isActive());
71 List<IPortImpl> ports = sw.getPorts();
72 assertEquals(numOfPorts, ports.size());
74 if (
port.getNumber() != localLinkPort) {
75 assertFalse(
port.isActive());
76 assertFalse(
port.isActiveIsl());
78 assertTrue(
port.isActive());
79 assertTrue(
port.isActiveIsl());
86 List<Values> values = speakerBolt.
addSwitch(switchMessage);
88 assertEquals(3, values.size());
90 for (Values
value : values) {
95 assertEquals(dpid, sw.getSwitchId());
99 assertEquals(dpid,
port.getSwitchId());
100 if (
port.getPortNo() == localLinkPort) {
List< Values > addSwitch(AddSwitchCommand data)
Map< SwitchId, ISwitchImpl > switches
void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector)
void testAddSwitchValues()