@Test public void testSetUserDeleteIntent() throws Exception { UserId userId = mock(UserId.class); String type = "type"; String objectId = "objectId"; Map<UserId, Map<String, String>> userDeleteIntent = mock(Map.class); Assert.assertTrue(((Map) field_userDeleteIntent.get(tenantManage)).isEmpty()); tenantManage.setUserDeleteIntent(userId, type, objectId); Assert.assertTrue(!((Map) field_userDeleteIntent.get(tenantManage)).isEmpty()); field_userDeleteIntent.set(tenantManage, userDeleteIntent); when(userDeleteIntent.containsKey(userId)).thenReturn(true); when(userDeleteIntent.get(userId)).thenReturn(new HashMap<String, String>()); tenantManage.setUserDeleteIntent(userId, type, objectId); verify(userDeleteIntent).get(userId); }
public void setUserDeleteIntent(UserId userId, String type, String objectId){ if (userDeleteIntent.containsKey(userId)){ Map<String, String> deleteObject = userDeleteIntent.get(userId); deleteObject.put(objectId,type); } else { Map<String, String> deleteObject = new HashMap<String, String>(); deleteObject.put(objectId,type); userDeleteIntent.put(userId, deleteObject); } }
TenantManage { public void setUserDeleteIntent(UserId userId, String type, String objectId){ if (userDeleteIntent.containsKey(userId)){ Map<String, String> deleteObject = userDeleteIntent.get(userId); deleteObject.put(objectId,type); } else { Map<String, String> deleteObject = new HashMap<String, String>(); deleteObject.put(objectId,type); userDeleteIntent.put(userId, deleteObject); } } }
TenantManage { public void setUserDeleteIntent(UserId userId, String type, String objectId){ if (userDeleteIntent.containsKey(userId)){ Map<String, String> deleteObject = userDeleteIntent.get(userId); deleteObject.put(objectId,type); } else { Map<String, String> deleteObject = new HashMap<String, String>(); deleteObject.put(objectId,type); userDeleteIntent.put(userId, deleteObject); } } TenantManage(DataBroker dataBroker); }
TenantManage { public void setUserDeleteIntent(UserId userId, String type, String objectId){ if (userDeleteIntent.containsKey(userId)){ Map<String, String> deleteObject = userDeleteIntent.get(userId); deleteObject.put(objectId,type); } else { Map<String, String> deleteObject = new HashMap<String, String>(); deleteObject.put(objectId,type); userDeleteIntent.put(userId, deleteObject); } } TenantManage(DataBroker dataBroker); User getUser(); Map<UserRoleName, UserRole> getUserRoles(); Map<UserId, User> getUsers(); void fetchVNSpace(UserId userId); void addUser(RegisterUserInput registerUserInput); void transactionHandling(UserId userId); void setNode(UserId userId, NodeId nodeId, Node node); Map<NodeId, Node> getNode(UserId userId); void setConnection(UserId userId, ConnectionId connectionId, Connection connection); Map<ConnectionId, Connection> getConnection(UserId userId); void setFlow(UserId userId, FlowId flowId, Flow flow); Map<FlowId,Flow> getFlow(UserId userId); void setOperation(UserId userId, OperationId operationId, Operation operation); Map<OperationId, Operation> getOperation(UserId userId); void setTemplateDefinition(UserId userId,TemplateName templateName, TemplateDefinition definition); Map<TemplateName, TemplateDefinition> getTempalteDefinition(UserId userId); void setUserTemplateInstance(UserId userId, TemplateInstanceId instanceId, TemplateInstance instance); Map<TemplateInstanceId, TemplateInstance> getTemplateInstance(UserId userId); void setUserDeleteIntent(UserId userId, String type, String objectId); void setUserNameIdMap(UserId userId, String name, String objectId); Map<String, String> getUserNameIdMap(UserId userId); String getObjectId(UserId userId, String name); String getName(UserId userId, String objectId); Map<NodeId, Node> getNodeDataStore(UserId userId); Map<ConnectionId, Connection> getConnectionDataStore(UserId userId); Map<FlowId, Flow> getFlowDataStore(UserId userId); Map<OperationId, Operation> getOperationDataStore(UserId userId); Map<TemplateName, TemplateDefinition> getDefinitionDataStore(UserId userId); Map<TemplateInstanceId, TemplateInstance> getInstanceDataStore(UserId userId); }
TenantManage { public void setUserDeleteIntent(UserId userId, String type, String objectId){ if (userDeleteIntent.containsKey(userId)){ Map<String, String> deleteObject = userDeleteIntent.get(userId); deleteObject.put(objectId,type); } else { Map<String, String> deleteObject = new HashMap<String, String>(); deleteObject.put(objectId,type); userDeleteIntent.put(userId, deleteObject); } } TenantManage(DataBroker dataBroker); User getUser(); Map<UserRoleName, UserRole> getUserRoles(); Map<UserId, User> getUsers(); void fetchVNSpace(UserId userId); void addUser(RegisterUserInput registerUserInput); void transactionHandling(UserId userId); void setNode(UserId userId, NodeId nodeId, Node node); Map<NodeId, Node> getNode(UserId userId); void setConnection(UserId userId, ConnectionId connectionId, Connection connection); Map<ConnectionId, Connection> getConnection(UserId userId); void setFlow(UserId userId, FlowId flowId, Flow flow); Map<FlowId,Flow> getFlow(UserId userId); void setOperation(UserId userId, OperationId operationId, Operation operation); Map<OperationId, Operation> getOperation(UserId userId); void setTemplateDefinition(UserId userId,TemplateName templateName, TemplateDefinition definition); Map<TemplateName, TemplateDefinition> getTempalteDefinition(UserId userId); void setUserTemplateInstance(UserId userId, TemplateInstanceId instanceId, TemplateInstance instance); Map<TemplateInstanceId, TemplateInstance> getTemplateInstance(UserId userId); void setUserDeleteIntent(UserId userId, String type, String objectId); void setUserNameIdMap(UserId userId, String name, String objectId); Map<String, String> getUserNameIdMap(UserId userId); String getObjectId(UserId userId, String name); String getName(UserId userId, String objectId); Map<NodeId, Node> getNodeDataStore(UserId userId); Map<ConnectionId, Connection> getConnectionDataStore(UserId userId); Map<FlowId, Flow> getFlowDataStore(UserId userId); Map<OperationId, Operation> getOperationDataStore(UserId userId); Map<TemplateName, TemplateDefinition> getDefinitionDataStore(UserId userId); Map<TemplateInstanceId, TemplateInstance> getInstanceDataStore(UserId userId);  }