-/*\r
- * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.nemo.user.vnspacemanager.structurestyle.updateintent;\r
-import org.opendaylight.nemo.user.vnspacemanager.structurestyle.updateintent.UpdateFlow;\r
-\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.*;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;\r
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;\r
-import org.opendaylight.nemo.user.tenantmanager.TenantManage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.Users;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Objects;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.FlowBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.FlowKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.users.User;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.users.UserKey;\r
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;\r
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;\r
-import com.google.common.util.concurrent.CheckedFuture;\r
-import com.google.common.util.concurrent.FutureCallback;\r
-import com.google.common.util.concurrent.Futures;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public class UpdateFlowTest {\r
-\r
- private UpdateFlow updateFlow;\r
-\r
- private DataBroker dataBroker;\r
- private TenantManage tenantManage;\r
- private UserId userId;\r
- private Flow flow;\r
- \r
- @org.junit.Before\r
- public void setUp() throws Exception {\r
- dataBroker = mock(DataBroker.class);\r
- tenantManage = mock(TenantManage.class);\r
- userId = mock(UserId.class);\r
- flow = mock(Flow.class);\r
- \r
- updateFlow = new UpdateFlow(dataBroker, tenantManage);\r
- }\r
-\r
- @org.junit.Test\r
- public void testFlowHandling() throws Exception {\r
- \r
- String errorDefinition = new String("The match item has not been defined.");\r
- \r
- CheckedFuture connectiondefinitionFuture = mock(CheckedFuture.class);\r
- ReadOnlyTransaction readOnlyTransaction = mock(ReadOnlyTransaction.class);\r
- when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);\r
- when(readOnlyTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn(connectiondefinitionFuture); \r
- \r
- Assert.assertEquals(updateFlow.FlowHandling(userId,flow),errorDefinition);\r
- \r
- }\r
+/*
+ * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.nemo.user.vnspacemanager.structurestyle.updateintent;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.nemo.user.tenantmanager.TenantManage;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.nemo.user.tenantmanager.TenantManage;
+import org.opendaylight.nemo.user.vnspacemanager.languagestyle.NEMOConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.MatchItemName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.Users;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Objects;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.users.User;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.users.UserKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.MatchItemDefinitions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.flow.instance.MatchItem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.definitions.MatchItemDefinition;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.MatchItemValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.FlowId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.FlowName;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.LinkedList;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import java.util.*;
+import java.util.List;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import com.google.common.util.concurrent.CheckedFuture;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by ldzd11 on 2015/12/22.
+ */
+public class UpdateFlowTest {
+
+ private UpdateFlow updateFlow;
+ private DataBroker dataBroker;
+ private TenantManage tenantManage;
+ private MatchItemName matchItemName;
+ private MatchItemName matchItemName2;
+ private MatchItem matchItem;
+ private List<MatchItem> matchItemList;
+ private List<MatchItem> matchItemListnull;
+ private User user;
+ private UserId userId;
+ private Objects objects;
+ private List<Flow> flowList;
+ private FlowId flowId;
+ private FlowName flowName;
+ private FlowName flowName2;
+
+
+
+ private MatchItemValue matchItemValue;
+ private Flow flow;
+ private Flow flow2;
+
+ @Before
+ public void setUp() throws Exception {
+ dataBroker = mock(DataBroker.class);
+ tenantManage = mock(TenantManage.class);
+ matchItemName = mock(MatchItemName.class);
+ matchItemName2= mock(MatchItemName.class);
+ matchItem = mock(MatchItem.class);
+ matchItemList = new ArrayList<MatchItem>(1);
+ matchItemListnull = new ArrayList<MatchItem>();
+ userId = mock(UserId.class);
+ user = mock(User.class);
+ matchItemList.add(matchItem);
+ flow = mock(Flow.class);
+ flow2 = mock(Flow.class);
+ flowId = mock(FlowId.class);
+ flowName = mock(FlowName.class);
+ flowName2 = mock(FlowName.class);
+
+ matchItemValue = mock(MatchItemValue.class);
+ objects = mock(Objects.class);
+ flowList = new ArrayList<Flow>(1);
+ flowList.add(flow2);
+
+ updateFlow = new UpdateFlow(dataBroker,tenantManage);
+
+ }
+
+
+
+
+ @Test
+ public void testFlowHandling() throws Exception {
+ //into checkdefinition for error = null
+ CheckedFuture matchitemdefinitionFuture = mock(CheckedFuture.class);
+ ReadOnlyTransaction readOnlyTransaction = mock(ReadOnlyTransaction.class);
+ when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
+ when(readOnlyTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn(matchitemdefinitionFuture);
+
+ List<MatchItemDefinition> matchItemDefinitions = new ArrayList<MatchItemDefinition>();
+ MatchItemDefinition matchItemDefinition = mock(MatchItemDefinition.class);
+ matchItemDefinitions.add(matchItemDefinition);
+ when(matchItemDefinition.getMatchItemName()).thenReturn(matchItemName);
+
+ Class<UpdateFlow> class1 = UpdateFlow.class;
+ Class<GetDefinitions> class2 = GetDefinitions.class;
+ Field field = class1.getDeclaredField("getDefinitions");
+ field.setAccessible(true);
+ Field field1 = class2.getDeclaredField("matchItemDefinitionList");
+ field1.setAccessible(true);
+
+ field1.set(field.get(updateFlow), matchItemDefinitions);
+ when(flow.getMatchItem()).thenReturn(null);
+ //into checkinstance for error = null
+ when(tenantManage.getUser()).thenReturn(null);
+
+ WriteTransaction writeTransaction = mock(WriteTransaction.class);
+ when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction);
+ when(flow.getFlowId()).thenReturn(flowId);
+ when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction);
+ CheckedFuture<Void, TransactionCommitFailedException> f;
+ f=mock(CheckedFuture.class);
+ when(writeTransaction.submit()).thenReturn(f);
+
+ Assert.assertEquals(updateFlow.FlowHandling(userId, flow), null);
+
+
+
+
+ }
+
+ @Test
+ public void testcheckInstance() throws Exception {
+ Class<UpdateFlow> class1 = UpdateFlow.class;
+ Method method = class1.getDeclaredMethod("checkInstance",new Class[]{UserId.class,Flow.class});
+ method.setAccessible(true);
+
+ when(tenantManage.getUser()).thenReturn(user);
+ when(user.getObjects()).thenReturn(objects);
+ when(user.getObjects().getFlow()).thenReturn(flowList);
+
+ when(flow2.getFlowId()).thenReturn(flowId);
+ when(flow.getFlowId()).thenReturn(flowId);
+ when(flow2.getFlowName()).thenReturn(flowName2);
+ when(flow.getFlowName()).thenReturn(flowName);
+ Assert.assertEquals(method.invoke(updateFlow, userId, flow), "The flow name should not be changed.");
+
+
+
+
+ }
+
+ @Test
+ public void testcheckDefinition() throws Exception {
+ Class<UpdateFlow> class3 = UpdateFlow.class;
+ Method method = class3.getDeclaredMethod("checkDefinition",new Class[]{Flow.class});
+ method.setAccessible(true);
+
+ CheckedFuture matchitemdefinitionFuture = mock(CheckedFuture.class);
+ ReadOnlyTransaction readOnlyTransaction = mock(ReadOnlyTransaction.class);
+ when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
+ when(readOnlyTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn(matchitemdefinitionFuture);
+
+
+ List<MatchItemDefinition> matchItemDefinitions = new ArrayList<MatchItemDefinition>();
+ List<MatchItemDefinition> matchItemDefinitionsnull = new ArrayList<MatchItemDefinition>();
+ MatchItemDefinition matchItemDefinition = mock(MatchItemDefinition.class);
+ matchItemDefinitions.add(matchItemDefinition);
+ when(matchItemDefinition.getMatchItemName()).thenReturn(matchItemName);
+
+
+ Class<UpdateFlow> class1 = UpdateFlow.class;
+ Class<GetDefinitions> class2 = GetDefinitions.class;
+ Field field = class1.getDeclaredField("getDefinitions");
+ field.setAccessible(true);
+ Field field1 = class2.getDeclaredField("matchItemDefinitionList");
+ field1.setAccessible(true);
+
+ //the else
+ field1.set(field.get(updateFlow), matchItemDefinitions);
+ when(flow.getMatchItem()).thenReturn(matchItemList);
+ when(matchItem.getMatchItemName()).thenReturn(matchItemName2);
+ Assert.assertEquals(method.invoke(updateFlow, flow), "The match item has not been defined.");
+
+ //the upper
+ field1.set(field.get(updateFlow), matchItemDefinitionsnull);
+ Assert.assertEquals(method.invoke(updateFlow, flow), "The match item has not been defined.");
+
+ //the if errorInfo == null into checkPredefine
+ field1.set(field.get(updateFlow), matchItemDefinitions);
+ when(flow.getMatchItem()).thenReturn(matchItemListnull);
+ //into checkPredefine
+ Assert.assertEquals(method.invoke(updateFlow, flow), null);
+
+
+
+
+ }
+
+ @Test
+ public void testcheckPredefine() throws Exception {
+ Class<UpdateFlow> class1 = UpdateFlow.class;
+ Method method = class1.getDeclaredMethod("checkPredefine",new Class[]{List.class});
+ method.setAccessible(true);
+
+ when(matchItem.getMatchItemName()).thenReturn(matchItemName);
+ when(matchItem.getMatchItemName().getValue()).thenReturn(new String("src-ip"));
+ when(matchItem.getMatchItemValue()).thenReturn(matchItemValue);
+
+ //stringValues.contains("/")
+ when(matchItem.getMatchItemValue().getStringValue()).thenReturn(new String("110/"));
+ //into checkIpPrefix(stringvalues) legalValue=false
+ Assert.assertEquals(method.invoke(updateFlow, matchItemList),"The " + NEMOConstants.ip_address + " is not legal.");
+
+ when(matchItem.getMatchItemValue().getStringValue()).thenReturn(new String("110\\."));
+ //into checkip address
+ Assert.assertEquals(method.invoke(updateFlow, matchItemList),"The " + NEMOConstants.ip_address + " is not legal.");
+
+
+ when(matchItem.getMatchItemName().getValue()).thenReturn(new String("src-mac"));
+ when(matchItem.getMatchItemValue()).thenReturn(matchItemValue);
+ when(matchItem.getMatchItemValue().getStringValue()).thenReturn(new String("110:"));
+ //into valuecheck.checkMac
+ Assert.assertEquals(method.invoke(updateFlow, matchItemList), "The " + NEMOConstants.mac_address + " is not legal.");
+
+
+
+
+
+
+
+
+
+
+
+ }
}
\ No newline at end of file
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.nemo.user.vnspacemanager.structurestyle.updateintent;
-import org.opendaylight.nemo.user.vnspacemanager.structurestyle.updateintent.UpdateIntent;
-import org.opendaylight.nemo.user.tenantmanager.TenantManage;
-import org.opendaylight.nemo.user.vnspacemanager.structurestyle.updateintent.UpdateIntent;
+import org.junit.Before;
+import org.junit.Test;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.nemo.user.tenantmanager.AAA;
import org.opendaylight.nemo.user.tenantmanager.TenantManage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Objects;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.StructureStyleNemoUpdateInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Results;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Connection;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.operations.Operation;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;
+
+import java.util.List;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.LinkedList;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import java.util.*;
+import java.util.List;
-public class UpdateIntentTest {
-
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import com.google.common.util.concurrent.CheckedFuture;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Operations;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.Results;
+import static org.junit.Assert.*;
- UpdateIntent updateIntent;
+/**
+ * Created by ldzd11 on 2015/12/22.
+ */
+public class UpdateIntentTest {
+ private UpdateIntent updateIntent;
private DataBroker dataBroker;
private TenantManage tenantManage;
- private UpdateNode updateNode;
- private UpdateConnection updateConnection;
- private UpdateFlow updateFlow;
- private UpdateOperation updateOperation;
- private UpdateResult updateResult;
private AAA aaa;
+ private UserId userId;
+ private Objects objects;
+ private Node node;
+ private List<Node> nodeList;
+ private Connection connection;
+ private List<Connection> connectionList;
+ private Flow flow;
+ private List<Flow> flowList;
+ private Operations operations;
+ private Operation operation;
+ private List<Operation> operationList;
+ private Results results;
private StructureStyleNemoUpdateInput structureStyleNemoUpdateInput;
-
- @org.junit.Before
+ @Before
public void setUp() throws Exception {
-
dataBroker = mock(DataBroker.class);
tenantManage = mock(TenantManage.class);
- updateNode = mock(UpdateNode.class);
- updateConnection = mock(UpdateConnection.class);
- updateFlow = mock(UpdateFlow.class);
- updateOperation = mock(UpdateOperation.class);
- updateResult = mock(UpdateResult.class);
aaa = mock(AAA.class);
structureStyleNemoUpdateInput = mock(StructureStyleNemoUpdateInput.class);
-
- updateIntent = new UpdateIntent(dataBroker, tenantManage);
+ userId = mock(UserId.class);
+ objects = mock(Objects.class);
+ node = mock(Node.class);
+ nodeList = new ArrayList<Node>(1);
+ nodeList.add(node);
+ operations = mock(Operations.class);
+ operation = mock(Operation.class);
+ operationList = new ArrayList<Operation>(1);
+ operationList.add(operation);
+
+ connection = mock(Connection.class);
+ connectionList = new ArrayList<Connection>(1);
+ connectionList.add(connection);
+ results = mock(Results.class);
+
+ flow = mock(Flow.class);
+ flowList = new ArrayList<Flow>(1);
+ flowList.add(flow);
+
+
+
+ updateIntent = new UpdateIntent(dataBroker,tenantManage);
+
}
- @org.junit.Test
+ @Test
public void testUpdateIntent() throws Exception {
-
- String erroInfo = new String("Case 0");
- when(aaa.checkUser(structureStyleNemoUpdateInput.getUserId())).thenReturn(erroInfo);
- Assert.assertEquals(updateIntent.updateIntent(aaa,structureStyleNemoUpdateInput),erroInfo);
-
- when(structureStyleNemoUpdateInput.getObjects()).thenReturn(null);
-
- Assert.assertNotNull(updateIntent.updateIntent(aaa,structureStyleNemoUpdateInput));
+ when(structureStyleNemoUpdateInput.getUserId()).thenReturn(userId);
+ when(aaa.checkUser(structureStyleNemoUpdateInput.getUserId())).thenReturn(null);
+ //else
+ when(structureStyleNemoUpdateInput.getObjects()).thenReturn(objects);
+ //node
+ when(structureStyleNemoUpdateInput.getObjects().getNode()).thenReturn(nodeList);
+ ///////test//////
+ Class<UpdateIntent> class_1 = UpdateIntent.class;
+ Field field_1 = class_1.getDeclaredField("updateNode");
+ field_1.setAccessible(true);
+
+ UpdateNode updateNode_1 = mock(UpdateNode.class);
+ field_1.set(updateIntent,updateNode_1);
+ when(updateNode_1.NodeHandling(userId,node)).thenReturn(new String("node success"));
+ Assert.assertEquals(updateIntent.updateIntent(aaa, structureStyleNemoUpdateInput), "node success");
+
+ //connection
+ when(structureStyleNemoUpdateInput.getObjects().getNode()).thenReturn(null);
+ when(structureStyleNemoUpdateInput.getObjects().getConnection()).thenReturn(connectionList);
+
+ Field field_2 = class_1.getDeclaredField("updateConnection");
+ field_2.setAccessible(true);
+ UpdateConnection updateConnection = mock(UpdateConnection.class);
+ field_2.set(updateIntent, updateConnection);
+
+ when(updateConnection.ConnectionHandling(userId,connection)).thenReturn(new String("connection success"));
+ Assert.assertEquals(updateIntent.updateIntent(aaa, structureStyleNemoUpdateInput), "connection success");
+
+ //flow
+ when(structureStyleNemoUpdateInput.getObjects().getNode()).thenReturn(null);
+ when(structureStyleNemoUpdateInput.getObjects().getConnection()).thenReturn(null);
+ when(structureStyleNemoUpdateInput.getObjects().getFlow()).thenReturn(flowList);
+
+ Field field_3 = class_1.getDeclaredField("updateFlow");
+ field_3.setAccessible(true);
+ UpdateFlow updateFlow = mock(UpdateFlow.class);
+ field_3.set(updateIntent, updateFlow);
+ when(updateFlow.FlowHandling(userId,flow)).thenReturn(new String("flow success"));
+ Assert.assertEquals(updateIntent.updateIntent(aaa, structureStyleNemoUpdateInput), "flow success");
+
+ //operations
+ when(structureStyleNemoUpdateInput.getObjects()).thenReturn(null);
+ when(structureStyleNemoUpdateInput.getOperations()).thenReturn(operations);
+ when(structureStyleNemoUpdateInput.getOperations().getOperation()).thenReturn(operationList);
+
+
+ Field field_4 = class_1.getDeclaredField("updateOperation");
+ field_4.setAccessible(true);
+ UpdateOperation updateOperation = mock(UpdateOperation.class);
+ field_4.set(updateIntent, updateOperation);
+ when(updateOperation.OperationHandling(userId,operation)).thenReturn(new String("operation success"));
+ Assert.assertEquals(updateIntent.updateIntent(aaa, structureStyleNemoUpdateInput), "operation success");
+
+
+ //getResults
+ when(structureStyleNemoUpdateInput.getObjects()).thenReturn(null);
+ when(structureStyleNemoUpdateInput.getOperations()).thenReturn(null);
+ when(structureStyleNemoUpdateInput.getResults()).thenReturn(results);
+
+ Field field_5 = class_1.getDeclaredField("updateResult");
+ field_5.setAccessible(true);
+ UpdateResult updateResult = mock(UpdateResult.class);
+ field_5.set(updateIntent, updateResult);
+ when(updateResult.ResultHandling(userId, results)).thenReturn(new String("result success"));
+ Assert.assertEquals(updateIntent.updateIntent(aaa, structureStyleNemoUpdateInput), "result success");
+
+
+
+
+
+
+
+
}
}
\ No newline at end of file