예제 #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);
  }
예제 #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);
  }
예제 #3
0
 @org.junit.Test
 public void testGetIntentVnMappingResult() throws Exception {
   when(intentVnMappingResult.getIntentId()).thenReturn(intentId);
   Assert.assertEquals(
       intentResolverUtils.getIntentVnMappingResult(intentVnMappingResultList, intentId),
       intentVnMappingResult);
 }
예제 #4
0
 @org.junit.Test
 public void testGetConnectionProperty() throws Exception {
   when(propertyconnection.getPropertyName()).thenReturn(propertyName);
   Assert.assertEquals(
       intentResolverUtils.getConnectionProperty(propertyListconnection, propertyName),
       propertyconnection);
 }
예제 #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);
 }
예제 #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);
  }
예제 #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")));
 }
예제 #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);
 }
예제 #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);
  }
예제 #10
0
 @org.junit.Test
 public void testGetConflictingOperations() throws Exception {
   Assert.assertEquals(
       intentResolverUtils.getConflictingOperations(operationList, operation), null);
 }
예제 #11
0
 @org.junit.Test
 public void testGetGreaterAndEqualPriorityOperations() throws Exception {
   intentResolverUtils.getGreaterAndEqualPriorityOperations(
       operationList, operation, operationList, operationList);
 }
예제 #12
0
 @org.junit.Test
 public void testGetSameTargetObjectOperations() throws Exception {
   Assert.assertEquals(
       intentResolverUtils.getSameTargetObjectOperations(operationList, operation),
       operationListnull);
 }
예제 #13
0
 @org.junit.Test
 public void testGetNode() throws Exception {
   when(node.getNodeId()).thenReturn(nodeId);
   Assert.assertEquals(intentResolverUtils.getNode(nodeList, nodeId), node);
 }
예제 #14
0
 @org.junit.Test
 public void testGetNodeProperty() throws Exception {
   when(property.getPropertyName()).thenReturn(propertyName);
   Assert.assertEquals(intentResolverUtils.getNodeProperty(propertyList, propertyName), property);
 }