import io.netty.channel.socket.nio.NioServerSocketChannel;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.apache.commons.lang3.NotImplementedException;
public class NettyBootStrapper {
// Wait until all threads are terminated.
bossGroup.terminationFuture().sync();
workerGroup.terminationFuture().sync();
- } catch (Exception e) {
+ } catch (ExecutionException | TimeoutException e) {
//ignore
}
}
String string = ",\"key1" + counter + "\":\"planet of apes" + counter + "\", \"key2" + counter
+ "\":{\"k1\":\"ovs-db rocks the world\"}";
outputStream.write(string.substring(i == 0 ? 1 : 0).getBytes("UTF-8"));
- // System.out.println("data counter = " + counter);
}
outputStream.write("}".getBytes("UTF-8"));
}
counter++;
String string = " {\"part" + counter + "\":";
outputStream.write(string.getBytes("UTF-8"));
- // System.out.println("partial first half counter = " + counter);
}
/**
private void writePartialLast(OutputStream outputStream) throws IOException {
String string = "\"val" + counter + "\"}";
outputStream.write(string.getBytes("UTF-8"));
- // System.out.println("partial second half counter = " + counter);
}
}
InputStream resourceAsStream = OvsdbSchemaTest.class.getResourceAsStream("test_schema.json");
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(resourceAsStream);
- //System.out.println("jsonNode = " + jsonNode.get("id"));
DatabaseSchema schema = DatabaseSchema.fromJson("some", jsonNode.get("result"));
assertNotNull(schema);
mock(InstanceIdentifier.class);
when(bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(yiid))
.thenAnswer(new Answer<InstanceIdentifier<?>>() {
- public InstanceIdentifier<?> answer(InvocationOnMock invocation) throws Throwable {
+ public InstanceIdentifier<?> answer(InvocationOnMock invocation) throws Exception {
return (InstanceIdentifier<?>) invocation.getArguments()[0];
}
});
import org.mockito.Mock;
import org.mockito.Mockito;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.ovsdb.lib.EchoServiceCallbackFilters;
import org.opendaylight.ovsdb.lib.LockAquisitionCallback;
import org.opendaylight.ovsdb.lib.LockStolenCallback;
import org.opendaylight.ovsdb.lib.MonitorCallBack;
ConnectionInfo key = mock(ConnectionInfo.class);
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getConnectionInstance", ConnectionInfo.class));
when(ovsdbConnManager.getConnectionInstance(key)).thenReturn((OvsdbConnectionInstance)ovsdbClient);
- assertEquals("Error getting correct OvsdbClient object", ovsdbClient.getOvsdbClient(), ovsdbConnManager.getClient(key));
+ assertEquals("Error getting correct OvsdbClient object", ovsdbClient.getOvsdbClient(),
+ ovsdbConnManager.getClient(key));
//Test getClient(OvsdbBridgeAttributes mn)
OvsdbBridgeAttributes mn = mock(OvsdbBridgeAttributes.class);
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getConnectionInstance",
OvsdbBridgeAttributes.class));
when(ovsdbConnManager.getConnectionInstance(mn)).thenReturn((OvsdbConnectionInstance)ovsdbClient);
- assertEquals("Error getting correct OvsdbClient object", ovsdbClient.getOvsdbClient(), ovsdbConnManager.getClient(mn));
+ assertEquals("Error getting correct OvsdbClient object", ovsdbClient.getOvsdbClient(),
+ ovsdbConnManager.getClient(mn));
//Test getClient(Node node)
Node node = mock(Node.class);
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getConnectionInstance", Node.class));
when(ovsdbConnManager.getConnectionInstance(node)).thenReturn((OvsdbConnectionInstance)ovsdbClient);
- assertEquals("Error getting correct OvsdbClient object", ovsdbClient.getOvsdbClient(), ovsdbConnManager.getClient(node));
+ assertEquals("Error getting correct OvsdbClient object", ovsdbClient.getOvsdbClient(),
+ ovsdbConnManager.getClient(node));
}
@SuppressWarnings("unchecked")
@Test
public void testDatabaseName() {
- assertEquals("Error databaseName did not return correct value", "Open_vSwitch", OvsdbSchemaContants.DATABASE_NAME);
+ assertEquals("Error databaseName did not return correct value", "Open_vSwitch",
+ OvsdbSchemaContants.DATABASE_NAME);
}
@Test
OvsdbBridgeAugmentation mdsalbridge = mock(OvsdbBridgeAugmentation.class);
when(mdsalbridge.getDatapathType()).thenAnswer(new Answer<Class<? extends DatapathTypeBase>>() {
public Class<? extends DatapathTypeBase> answer(
- InvocationOnMock invocation) throws Throwable {
+ InvocationOnMock invocation) throws Exception {
return DatapathTypeNetdev.class;
}
});
when(mdsalbridge.getDatapathType()).thenAnswer(new Answer<Class<? extends DatapathTypeBase>>() {
public Class<? extends DatapathTypeBase> answer(
- InvocationOnMock invocation) throws Throwable {
+ InvocationOnMock invocation) throws Exception {
return DatapathTypeSystem.class;
}
});
when(ovsdbBridgeNode.getProtocolEntry()).thenReturn(protocolList);
when(protocolEntry.getProtocol()).thenAnswer(new Answer<Class<? extends OvsdbBridgeProtocolBase>>() {
public Class<? extends OvsdbBridgeProtocolBase> answer(
- InvocationOnMock invocation) throws Throwable {
+ InvocationOnMock invocation) throws Exception {
return OvsdbBridgeProtocolOpenflow10.class;
}
});
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(resourceAsStream);
- DatabaseSchema dbSchema = DatabaseSchema.fromJson(OvsdbSchemaContants.DATABASE_NAME, jsonNode.get("result"));
+ DatabaseSchema dbSchema = DatabaseSchema.fromJson(OvsdbSchemaContants.DATABASE_NAME,
+ jsonNode.get("result"));
String uuidString = "7da709ff-397f-4778-a0e8-994811272fdb";
OvsdbBridgeAugmentation omn = new OvsdbBridgeAugmentationBuilder()
when(db.newReadOnlyTransaction()).thenReturn(transaction);
when(mn.getManagedBy()).thenReturn(ref);
when(ref.getValue()).thenAnswer(new Answer<InstanceIdentifier<Node>>() {
- public InstanceIdentifier<Node> answer(InvocationOnMock invocation) throws Throwable {
+ public InstanceIdentifier<Node> answer(InvocationOnMock invocation) throws Exception {
return (InstanceIdentifier<Node>) mock(InstanceIdentifier.class);
}
});
ProtocolEntry protocol = mock(ProtocolEntry.class);
when(protocol.getProtocol()).thenAnswer(new Answer<Class<? extends OvsdbBridgeProtocolBase>>() {
public Class<? extends OvsdbBridgeProtocolBase> answer(
- InvocationOnMock invocation) throws Throwable {
+ InvocationOnMock invocation) throws Exception {
return OvsdbBridgeProtocolOpenflow10.class;
}
});
when(ovsdbBridge.getBridgeName()).thenReturn(ovsdbBridgeName);
when(protocolEntry.getProtocol()).thenAnswer(new Answer<Class<? extends OvsdbBridgeProtocolBase>>() {
public Class<? extends OvsdbBridgeProtocolBase> answer(
- InvocationOnMock invocation) throws Throwable {
+ InvocationOnMock invocation) throws Exception {
return OvsdbBridgeProtocolOpenflow10.class;
}
});
ProtocolEntryKey protocolEntryKey = mock(ProtocolEntryKey.class);
Mockito.when(protocolEntry.getProtocol()).thenAnswer(new Answer<Class<? extends OvsdbBridgeProtocolBase>>() {
public Class<? extends OvsdbBridgeProtocolBase> answer(
- InvocationOnMock invocation) throws Throwable {
+ InvocationOnMock invocation) throws Exception {
return OvsdbBridgeProtocolOpenflow10.class;
}
});
PowerMockito.mockStatic(SouthboundMapper.class);
when(SouthboundMapper.createInterfaceType(anyString()))
.thenAnswer(new Answer<Class<? extends InterfaceTypeBase>>() {
- public Class<? extends InterfaceTypeBase> answer(InvocationOnMock invocation) throws Throwable {
+ public Class<? extends InterfaceTypeBase> answer(InvocationOnMock invocation) throws Exception {
return InterfaceTypeInternal.class;
}
});
PowerMockito.mockStatic(SouthboundMapper.class);
when(SouthboundMapper.createDatapathType(anyString()))
.thenAnswer(new Answer<Class<? extends DatapathTypeBase>>() {
- public Class<? extends DatapathTypeBase> answer(InvocationOnMock invocation) throws Throwable {
+ public Class<? extends DatapathTypeBase> answer(InvocationOnMock invocation) throws Exception {
return DatapathTypeSystem.class;
}
});
PowerMockito.mockStatic(SouthboundMapper.class);
when(SouthboundMapper.createDatapathType(anyString()))
.thenAnswer(new Answer<Class<? extends DatapathTypeBase>>() {
- public Class<? extends DatapathTypeBase> answer(InvocationOnMock invocation) throws Throwable {
+ public Class<? extends DatapathTypeBase> answer(InvocationOnMock invocation) throws Exception {
return DatapathTypeSystem.class;
}
});
PowerMockito.mockStatic(SouthboundMapper.class);
PowerMockito.when(SouthboundMapper.createInterfaceType(anyString()))
.thenAnswer(new Answer<Class<? extends InterfaceTypeBase>>() {
- public Class<? extends InterfaceTypeBase> answer(InvocationOnMock invocation) throws Throwable {
+ public Class<? extends InterfaceTypeBase> answer(InvocationOnMock invocation) throws Exception {
return InterfaceTypeInternal.class;
}
});