Exemplo n.º 1
0
  @org.junit.Test
  public void testCheckAllLayer3OperatingMode() throws Exception {

    when(subNode.getNodeId()).thenReturn(nodeId);
    NodeId otherid;
    otherid = mock(NodeId.class);
    when(node.getNodeId()).thenReturn(otherid);
    Assert.assertEquals(
        intentResolverUtils.checkAllLayer3OperatingMode(subNodeList, nodeList), false);

    when(node.getNodeId()).thenReturn(nodeId);
    when(subNode.getNodeId()).thenReturn(nodeId);
    // into getNodeProperty
    when(node.getProperty()).thenReturn(propertyList);
    propertyName = new PropertyName("operating-other");
    when(property.getPropertyName()).thenReturn(propertyName);
    Assert.assertEquals(
        intentResolverUtils.checkAllLayer3OperatingMode(subNodeList, nodeList), false);

    when(node.getNodeId()).thenReturn(nodeId);
    when(subNode.getNodeId()).thenReturn(nodeId);
    when(node.getProperty()).thenReturn(propertyList);
    propertyName = new PropertyName("operating-mode");
    when(property.getPropertyName()).thenReturn(propertyName);
    when(property.getPropertyValues()).thenReturn(propertyValues);
    when(property.getPropertyValues().getStringValue()).thenReturn(stringValueList);
    when(property.getPropertyValues().getStringValue().get(0).getValue())
        .thenReturn(new String("layer3"));

    Assert.assertEquals(
        intentResolverUtils.checkAllLayer3OperatingMode(subNodeList, nodeList), true);
  }
Exemplo n.º 2
0
  @org.junit.Test
  public void testGetObject() throws Exception {
    when(objects.getNode()).thenReturn(nodeList);
    when(objectId.getValue()).thenReturn(new String("00001111-0000-0000-0000-000011112222"));
    NodeId nodeId2 = new NodeId(objectId.getValue());
    // into getnode
    when(node.getNodeId()).thenReturn(nodeId2);
    Assert.assertEquals(intentResolverUtils.getObject(objects, objectId), node);

    when(objects.getNode()).thenReturn(nodeListnull);
    when(objects.getConnection()).thenReturn(connectionList);
    when(objectId.getValue()).thenReturn(new String("00001111-0000-0000-0000-000011112222"));
    ConnectionId connectionId2 = new ConnectionId(objectId.getValue());
    // into getconnection
    when(connection.getConnectionId()).thenReturn(connectionId2);
    Assert.assertEquals(intentResolverUtils.getObject(objects, objectId), connection);

    when(objects.getNode()).thenReturn(nodeListnull);
    when(objects.getConnection()).thenReturn(connectionListnull);
    when(objects.getFlow()).thenReturn(flowList);
    when(objectId.getValue()).thenReturn(new String("00001111-0000-0000-0000-000011112222"));
    FlowId flowId2 = new FlowId(objectId.getValue());
    // into getflow
    when(flow.getFlowId()).thenReturn(flowId2);
    Assert.assertEquals(intentResolverUtils.getObject(objects, objectId), flow);
  }
Exemplo n.º 3
0
 @org.junit.Test
 public void testGetIntentVnMappingResult() throws Exception {
   when(intentVnMappingResult.getIntentId()).thenReturn(intentId);
   Assert.assertEquals(
       intentResolverUtils.getIntentVnMappingResult(intentVnMappingResultList, intentId),
       intentVnMappingResult);
 }
Exemplo n.º 4
0
 @org.junit.Test
 public void testGetConnectionProperty() throws Exception {
   when(propertyconnection.getPropertyName()).thenReturn(propertyName);
   Assert.assertEquals(
       intentResolverUtils.getConnectionProperty(propertyListconnection, propertyName),
       propertyconnection);
 }
Exemplo n.º 5
0
 @org.junit.Test
 public void testGetVirtualLink() throws Exception {
   when(virtualLink.getSrcNodeId()).thenReturn(srcVirtualNodeId);
   when(virtualLink.getDestNodeId()).thenReturn(destVirtualNodeId);
   Assert.assertEquals(
       intentResolverUtils.getVirtualLink(virtualLinkList, srcVirtualNodeId, destVirtualNodeId),
       virtualLink);
 }
Exemplo n.º 6
0
  @org.junit.Test
  public void testSortSubNodes() throws Exception {
    Assert.assertEquals(intentResolverUtils.sortSubNodes(subNodeList), subNodeList);

    List<SubNode> sortedSubNodes = new ArrayList<SubNode>(subNodeList2.size());
    sortedSubNodes.addAll(subNodeList2);

    long a = 1;
    long b = 0;
    when(subNode.getOrder()).thenReturn(a);
    when(subNode2.getOrder()).thenReturn(b);

    List<SubNode> sortedSubNodes2 = new ArrayList<SubNode>(subNodeList2.size());
    sortedSubNodes2.add(subNode2);
    sortedSubNodes2.add(subNode);

    Assert.assertEquals(intentResolverUtils.sortSubNodes(subNodeList2), sortedSubNodes2);
  }
Exemplo n.º 7
0
 @org.junit.Test
 public void testGeneratePhysicalNodeIdFromNodeLocationProperty() throws Exception {
   when(property.getPropertyValues()).thenReturn(propertyValues);
   when(property.getPropertyValues().getStringValue()).thenReturn(stringValueList);
   when(property.getPropertyValues().getStringValue().get(0).getValue())
       .thenReturn(new String("test:"));
   Assert.assertEquals(
       intentResolverUtils.generatePhysicalNodeIdFromNodeLocationProperty(property),
       new PhysicalNodeId(new String("test")));
 }
Exemplo n.º 8
0
 @org.junit.Test
 public void testGetPhysicalHost() throws Exception {
   when(node.getNodeId()).thenReturn(nodeId);
   when(node.getNodeId().getValue())
       .thenReturn(new String("00001111-0000-0000-0000-000011112222"));
   physicalHostId = new PhysicalHostId(node.getNodeId().getValue());
   // into getPhysicalHost
   when(physicalHost.getHostId()).thenReturn(physicalHostId);
   Assert.assertEquals(intentResolverUtils.getPhysicalHost(physicalHostList, node), physicalHost);
 }
Exemplo n.º 9
0
  @org.junit.Test
  public void testCheckExternalLayer3Group() throws Exception {
    when(node.getProperty()).thenReturn(propertyList);
    // into getNodeProperty
    propertyName = new PropertyName("ac-info-network");
    when(property.getPropertyName()).thenReturn(propertyName);
    when(property.getPropertyValues()).thenReturn(propertyValues);
    when(property.getPropertyValues().getStringValue()).thenReturn(stringValueList);
    when(property.getPropertyValues().getStringValue().get(0).getValue())
        .thenReturn(new String("layer3"));

    Assert.assertEquals(intentResolverUtils.checkExternalLayer3Group(node), true);
  }
Exemplo n.º 10
0
 @org.junit.Test
 public void testGetConflictingOperations() throws Exception {
   Assert.assertEquals(
       intentResolverUtils.getConflictingOperations(operationList, operation), null);
 }
Exemplo n.º 11
0
 @org.junit.Test
 public void testGetGreaterAndEqualPriorityOperations() throws Exception {
   intentResolverUtils.getGreaterAndEqualPriorityOperations(
       operationList, operation, operationList, operationList);
 }
Exemplo n.º 12
0
 @org.junit.Test
 public void testGetSameTargetObjectOperations() throws Exception {
   Assert.assertEquals(
       intentResolverUtils.getSameTargetObjectOperations(operationList, operation),
       operationListnull);
 }
Exemplo n.º 13
0
 @org.junit.Test
 public void testGetNode() throws Exception {
   when(node.getNodeId()).thenReturn(nodeId);
   Assert.assertEquals(intentResolverUtils.getNode(nodeList, nodeId), node);
 }
Exemplo n.º 14
0
 @org.junit.Test
 public void testGetNodeProperty() throws Exception {
   when(property.getPropertyName()).thenReturn(propertyName);
   Assert.assertEquals(intentResolverUtils.getNodeProperty(propertyList, propertyName), property);
 }