private OperationType addOperationType(final ComponentType componentType, final String operationSignature) { final String operationTypeKey = operationSignature; OperationType operationType = componentType.getProvidedOperations().get(operationSignature); if (operationType == null) { operationType = this.factory.createOperationType(); operationType.setSignature(operationSignature); this.operationSignatureExtractor.extract(operationType); componentType.getProvidedOperations().put(operationTypeKey, operationType); } return operationType; }
private AssemblyOperation addAssemblyOperation(final AssemblyComponent component, final String operationSignature) { final String operationKey = operationSignature; AssemblyOperation operation = component.getAssemblyOperations().get(operationKey); if (operation == null) { operation = this.factory.createAssemblyOperation(); component.getAssemblyOperations().put(operationKey, operation); final ComponentType componentType = component.getComponentType(); final String operationTypeKey = operationSignature; final OperationType operationType = componentType.getProvidedOperations().get(operationTypeKey); operation.setOperationType(operationType); } return operation; }
/** * Test method for {@link kieker.analysisteetime.model.TypeModelAssembler#addRecord(java.lang.String, java.lang.String)}. */ @Test public void testOperationExistsAfterAddRecordFromString() { final TypeModel typeModel = this.factory.createTypeModel(); final TypeModelAssembler typeModelAssembler = new TypeModelAssembler(typeModel, new JavaComponentSignatureExtractor(), new JavaOperationSignatureExtractor()); typeModelAssembler.addRecord(EXAMPLE_CLASS_SIGNATURE_1, EXAMPLE_OPERATION_SIGNATURE_1); typeModelAssembler.addRecord(EXAMPLE_CLASS_SIGNATURE_1, EXAMPLE_OPERATION_SIGNATURE_2); typeModelAssembler.addRecord(EXAMPLE_CLASS_SIGNATURE_2, EXAMPLE_OPERATION_SIGNATURE_3); final List<String> actualList = typeModel.getComponentTypes().get(EXAMPLE_CLASS_SIGNATURE_1).getProvidedOperations().values().stream() .map(c -> c.getSignature()).collect(Collectors.toList()); final List<String> expectedList = Arrays.asList(EXAMPLE_OPERATION_SIGNATURE_1, EXAMPLE_OPERATION_SIGNATURE_2); Collections.sort(actualList); Collections.sort(expectedList); Assert.assertTrue(actualList.equals(expectedList)); }
/** * Test method for {@link kieker.analysisteetime.model.TypeModelAssembler#addRecord(kieker.common.record.flow.IOperationRecord)}. */ @Test public void testOperationExistsAfterAddRecordFromRecord() { final TypeModel typeModel = this.factory.createTypeModel(); final TypeModelAssembler typeModelAssembler = new TypeModelAssembler(typeModel, new JavaComponentSignatureExtractor(), new JavaOperationSignatureExtractor()); typeModelAssembler.addRecord(this.beforeOperationEvent1); typeModelAssembler.addRecord(this.beforeOperationEvent2); typeModelAssembler.addRecord(this.beforeOperationEvent3); final List<String> actualList = typeModel.getComponentTypes().get(EXAMPLE_CLASS_SIGNATURE_1).getProvidedOperations().values().stream() .map(c -> c.getSignature()).collect(Collectors.toList()); final List<String> expectedList = Arrays.asList(EXAMPLE_OPERATION_SIGNATURE_1, EXAMPLE_OPERATION_SIGNATURE_2); Collections.sort(actualList); Collections.sort(expectedList); Assert.assertTrue(actualList.equals(expectedList)); }
/** * Test method for {@link kieker.analysisteetime.model.TypeModelAssembler#addRecord(kieker.common.record.flow.IOperationRecord)}. */ @Test public void testOperationKeysExistsAfterAddRecordFromRecord() { final TypeModel typeModel = this.factory.createTypeModel(); final TypeModelAssembler typeModelAssembler = new TypeModelAssembler(typeModel, new JavaComponentSignatureExtractor(), new JavaOperationSignatureExtractor()); typeModelAssembler.addRecord(this.beforeOperationEvent1); typeModelAssembler.addRecord(this.beforeOperationEvent2); typeModelAssembler.addRecord(this.beforeOperationEvent3); final List<String> actualList = new ArrayList<>(typeModel.getComponentTypes().get(EXAMPLE_CLASS_SIGNATURE_1).getProvidedOperations().keySet()); final List<String> expectedList = Arrays.asList(EXAMPLE_OPERATION_SIGNATURE_1, EXAMPLE_OPERATION_SIGNATURE_2); Collections.sort(actualList); Collections.sort(expectedList); Assert.assertTrue(actualList.equals(expectedList)); }