/** * @since 1.14 */ public default String build(final ComponentType componentType) { return this.build(componentType.getPackage(), componentType.getName()); }
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; }
@Override public void extract(final ComponentType componentType) { // BETTER code clean up, copied from old kieker analysis final String signature = componentType.getSignature(); final String packageName; final String name; if (signature.indexOf('.') != -1) { final String tmpComponentName = signature; int index = 0; for (index = tmpComponentName.length() - 1; index > 0; index--) { if (tmpComponentName.charAt(index) == '.') { break; } } packageName = tmpComponentName.substring(0, index); name = tmpComponentName.substring(index + 1); } else { packageName = ""; name = signature; } componentType.setName(name); componentType.setPackage(packageName); }
private void printComponent(final DeployedComponent component) { final String name = component.getAssemblyComponent().getComponentType().getSignature(); this.printStream.println(INSERTION + name); }
private ComponentType buildComponentTypeBySiganture(final String signature) { final ComponentType componentType = TypeFactory.eINSTANCE.createComponentType(); componentType.setSignature(signature); return componentType; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ComponentType getComponentType() { if (componentType != null && componentType.eIsProxy()) { InternalEObject oldComponentType = (InternalEObject)componentType; componentType = (ComponentType)eResolveProxy(oldComponentType); if (componentType != oldComponentType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, AssemblyPackage.ASSEMBLY_COMPONENT__COMPONENT_TYPE, oldComponentType, componentType)); } } return componentType; }
private void printHotspots() { final Map<OperationCall, Duration> sortedMap = HotspotDetectionStage.sortMapByValue(this.durationsWithoutChild); sortedMap.entrySet().stream().limit(this.maxOutput).map( e -> e.getKey().getOperation().getComponent().getAssemblyComponent().getComponentType().getSignature() + " " + e.getKey().getOperation().getAssemblyOperation().getOperationType().getSignature() + ": " + e.getValue().toString()) .forEach(this.printStream::println); }
private ComponentType addComponentType(final String componentSignature) { final String componentTypeKey = componentSignature; ComponentType componentType = this.typeModel.getComponentTypes().get(componentTypeKey); if (componentType == null) { componentType = this.factory.createComponentType(); componentType.setSignature(componentSignature); this.componentSignatureExtractor.extract(componentType); this.typeModel.getComponentTypes().put(componentTypeKey, componentType); } return componentType; }
@Override protected IVertex addVertex(final DeployedOperation deployedOperation) { final OperationType operation = deployedOperation.getAssemblyOperation().getOperationType(); final ComponentType component = operation.getComponentType(); final int componentId = this.identifierRegistry.getIdentifier(component); final IVertex componentVertex = this.graph.addVertexIfAbsent(componentId); componentVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.COMPONENT_TYPE); componentVertex.setPropertyIfAbsent(PropertyKeys.NAME, component.getName()); componentVertex.setPropertyIfAbsent(PropertyKeys.PACKAGE_NAME, component.getPackage()); this.responseTimeDecorator.decorate(componentVertex, component); return componentVertex; }
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(kieker.common.record.flow.IOperationRecord)}. */ @Test public void testComponentsExistsAfterAddRecordFromRecord() { 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().values().stream().map(c -> c.getSignature()).collect(Collectors.toList()); final List<String> expectedList = Arrays.asList(EXAMPLE_CLASS_SIGNATURE_1, EXAMPLE_CLASS_SIGNATURE_2); Collections.sort(actualList); Collections.sort(expectedList); Assert.assertTrue(actualList.equals(expectedList)); }
private void testExtraction(final String packageName, final String name) { // NOPMD (assert for other tests) final ComponentType componentType = this.buildComponentTypeByNames(packageName, name); this.signatureExtractor.extract(componentType); final String extractedPackage = componentType.getPackage(); final String extractedName = componentType.getName(); Assert.assertEquals(packageName, extractedPackage); Assert.assertEquals(name, extractedName); }
/** * 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)); }
@Override protected IVertex addVertex(final DeployedOperation deployedOperation) { final AssemblyOperation operation = deployedOperation.getAssemblyOperation(); final AssemblyComponent component = operation.getAssemblyComponent(); final int componentId = this.identifierRegistry.getIdentifier(component); final IVertex componentVertex = this.graph.addVertexIfAbsent(componentId); componentVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.ASSEMBLY_COMPONENT); componentVertex.setPropertyIfAbsent(PropertyKeys.NAME, component.getComponentType().getName()); componentVertex.setPropertyIfAbsent(PropertyKeys.PACKAGE_NAME, component.getComponentType().getPackage()); this.responseTimeDecorator.decorate(componentVertex, component); return componentVertex; }
/** * 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)); }
@Override protected IVertex addVertex(final DeployedOperation deployedOperation) { final DeployedOperation operation = deployedOperation; final DeployedComponent component = operation.getComponent(); final DeploymentContext context = component.getDeploymentContext(); final int contextId = this.identifierRegistry.getIdentifier(context); final IVertex contextVertex = this.graph.addVertexIfAbsent(contextId); contextVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.DEPLOYMENT_CONTEXT); contextVertex.setPropertyIfAbsent(PropertyKeys.NAME, context.getName()); final IGraph contextSubgraph = contextVertex.addChildGraphIfAbsent(); final int componentId = this.identifierRegistry.getIdentifier(component); final IVertex componentVertex = contextSubgraph.addVertexIfAbsent(componentId); componentVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.DEPLOYED_COMPONENT); componentVertex.setPropertyIfAbsent(PropertyKeys.NAME, component.getAssemblyComponent().getComponentType().getName()); componentVertex.setPropertyIfAbsent(PropertyKeys.PACKAGE_NAME, component.getAssemblyComponent().getComponentType().getPackage()); this.responseTimeDecorator.decorate(componentVertex, component); return componentVertex; }
/** * 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)); }
@Override protected IVertex addVertex(final DeployedOperation deployedOperation) { final OperationType operation = deployedOperation.getAssemblyOperation().getOperationType(); final ComponentType component = operation.getComponentType(); final int componentId = this.identifierRegistry.getIdentifier(component); final IVertex componentVertex = this.graph.addVertexIfAbsent(componentId); componentVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.COMPONENT_TYPE); componentVertex.setPropertyIfAbsent(PropertyKeys.NAME, component.getName()); componentVertex.setPropertyIfAbsent(PropertyKeys.PACKAGE_NAME, component.getPackage()); final IGraph componentSubgraph = componentVertex.addChildGraphIfAbsent(); final int operationId = this.identifierRegistry.getIdentifier(operation); final IVertex operationVertex = componentSubgraph.addVertexIfAbsent(operationId); operationVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.OPERATION_TYPE); operationVertex.setPropertyIfAbsent(PropertyKeys.NAME, operation.getName()); operationVertex.setPropertyIfAbsent(PropertyKeys.RETURN_TYPE, operation.getReturnType()); operationVertex.setPropertyIfAbsent(PropertyKeys.MODIFIERS, operation.getModifiers()); operationVertex.setPropertyIfAbsent(PropertyKeys.PARAMETER_TYPES, operation.getParameterTypes()); this.responseTimeDecorator.decorate(operationVertex, operation); return operationVertex; }
private IVertex addVertex(final OperationCall operationCall) { final int vertexId = this.objectIdentifierRegistry.getIdentifier(operationCall); final IVertex vertex = this.graph.addVertex(vertexId); final OperationType operationType = operationCall.getOperation().getAssemblyOperation().getOperationType(); final ComponentType componentType = operationType.getComponentType(); final DeploymentContext deploymentContext = operationCall.getOperation().getComponent().getDeploymentContext(); vertex.setProperty("name", operationType.getName()); vertex.setProperty("returnType", operationType.getReturnType()); vertex.setProperty("modifiers", operationType.getModifiers()); vertex.setProperty("parameterTypes", operationType.getParameterTypes()); vertex.setProperty("component", componentType.getName()); vertex.setProperty("package", componentType.getPackage()); vertex.setProperty("deploymentContext", deploymentContext.getName()); vertex.setProperty("stackDepth", operationCall.getStackDepth()); // ... maybe further parameters return vertex; }
@Override protected IVertex addVertex(final DeployedOperation deployedOperation) { final AssemblyOperation operation = deployedOperation.getAssemblyOperation(); final AssemblyComponent component = operation.getAssemblyComponent(); final int componentId = this.identifierRegistry.getIdentifier(component); final IVertex componentVertex = this.graph.addVertexIfAbsent(componentId); componentVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.ASSEMBLY_COMPONENT); componentVertex.setPropertyIfAbsent(PropertyKeys.NAME, component.getComponentType().getName()); componentVertex.setPropertyIfAbsent(PropertyKeys.PACKAGE_NAME, component.getComponentType().getPackage()); final IGraph componentSubgraph = componentVertex.addChildGraphIfAbsent(); final int operationId = this.identifierRegistry.getIdentifier(operation); final IVertex operationVertex = componentSubgraph.addVertexIfAbsent(operationId); operationVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.ASSEMBLY_OPERATION); operationVertex.setPropertyIfAbsent(PropertyKeys.NAME, operation.getOperationType().getName()); operationVertex.setPropertyIfAbsent(PropertyKeys.RETURN_TYPE, operation.getOperationType().getReturnType()); operationVertex.setPropertyIfAbsent(PropertyKeys.MODIFIERS, operation.getOperationType().getModifiers()); operationVertex.setPropertyIfAbsent(PropertyKeys.PARAMETER_TYPES, operation.getOperationType().getParameterTypes()); this.responseTimeDecorator.decorate(operationVertex, operation); return operationVertex; }