+ @Test
+ void testGetInterfaceAsMapWithMilestones() {
+ Component component = new Resource();
+ component.setNormalizedName("normalizedComponentName");
+ InterfaceDefinition addedInterface = new InterfaceDefinition();
+ addedInterface.setToscaResourceName("com.some.resource.or.other.resourceName");
+ addedInterface.setType("com.some.resource.or.other.resourceName");
+ addOperationsToInterface(component, addedInterface, 2, 0, false, false, false, true);
+ final String interfaceType = "normalizedComponentName-interface";
+ component.setInterfaces(new HashMap<>());
+ component.getInterfaces().put(interfaceType, addedInterface);
+ final var interfacesMap = interfacesOperationsConverter.getInterfacesMap(component, null, component.getInterfaces(), dataTypes, false);
+ assertNotNull(interfacesMap);
+ assertEquals(1, interfacesMap.size());
+ assertTrue(interfacesMap.containsKey("resourceName"));
+ Object resourceName = interfacesMap.get("resourceName");
+ assertNotNull(resourceName);
+ assertTrue(resourceName instanceof Map);
+ assertEquals(3, ((Map) resourceName).size());
+ Map<String, Object> resource = (Map<String, Object>) resourceName;
+ assertTrue(resource.containsKey("name_for_op_0"));
+ Map<String, Object> operation0 = (Map<String, Object>) resource.get("name_for_op_0");
+ assertTrue(operation0.containsKey("milestones"));
+ Map<String, Object> operation0Milestones = (Map<String, Object>) operation0.get("milestones");
+ assertTrue(operation0Milestones.containsKey(MilestoneTypeEnum.ON_ENTRY.getValue()));
+ Map<String, Object> milestone = (Map<String, Object>) operation0Milestones.get(MilestoneTypeEnum.ON_ENTRY.getValue());
+ assertTrue(milestone.containsKey("activities"));
+ List<Map<String, Object>> activities = (List<Map<String, Object>>) milestone.get("activities");
+ assertEquals(1, activities.size());
+ Map<String, Object> activity = activities.get(0);
+ assertEquals(1, activities.size());
+ assertTrue(activity.containsKey("delegate"));
+ Map<String, String> activityVariables = (Map<String, String>) activity.get("delegate");
+ assertTrue(activityVariables.containsKey("workflow"));
+ assertEquals("workflow1", activityVariables.get("workflow"));
+ }
+