/** * @since 1.14 */ public default String build(final OperationType operationType) { return this.build(operationType.getModifiers(), operationType.getReturnType(), operationType.getName(), operationType.getParameterTypes()); }
@Override public void extract(final OperationType operationType) { // BETTER Implement new and do not rely on the class in kieker.common final ClassOperationSignaturePair classSignaturePair = ClassOperationSignaturePair.splitOperationSignatureStr(operationType.getSignature()); final Signature signature = classSignaturePair.getSignature(); operationType.setName(signature.getName()); operationType.setReturnType(signature.getReturnType()); for (final String modifier : signature.getModifier()) { if (!modifier.isEmpty()) { operationType.getModifiers().add(modifier); } } for (final String parameterType : signature.getParamTypeList()) { if (!parameterType.isEmpty()) { operationType.getParameterTypes().add(parameterType); } } }
private OperationType buildOperationTypeBySiganture(final String signature) { final OperationType operationType = TypeFactory.eINSTANCE.createOperationType(); operationType.setSignature(signature); return operationType; }
@Override public String toString() { return String.format("%s: %s", this.getClass().getName(), assemblyOperation.getOperationType().getSignature()); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OperationType getOperationType() { if (operationType != null && operationType.eIsProxy()) { InternalEObject oldOperationType = (InternalEObject)operationType; operationType = (OperationType)eResolveProxy(oldOperationType); if (operationType != oldOperationType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, AssemblyPackage.ASSEMBLY_OPERATION__OPERATION_TYPE, oldOperationType, operationType)); } } return operationType; }
@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 void printOperation(final DeployedOperation operation) { final String name = operation.getAssemblyOperation().getOperationType().getSignature(); this.printStream.println(INSERTION + INSERTION + name); }
private void testExtraction(final List<String> modifiers, final String returnType, final String name, final List<String> parameters) { // NOPMD (assert for other // tests) final OperationType operationType = this.buildComponentTypeByNames(modifiers, returnType, name, parameters); this.signatureExtractor.extract(operationType); final List<String> extractedModifiers = operationType.getModifiers(); final String extractedReturnType = operationType.getReturnType(); final String extractedName = operationType.getName(); final List<String> extractedParameters = operationType.getParameterTypes(); Assert.assertEquals(modifiers, extractedModifiers); Assert.assertEquals(returnType, extractedReturnType); Assert.assertEquals(name, extractedName); Assert.assertEquals(parameters, extractedParameters); }
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 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 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; }
/** * 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)); }
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; }
/** * 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()); 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; }
@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(); contextSubgraph.setName(context.getName()); 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()); final IGraph componentSubgraph = componentVertex.addChildGraphIfAbsent(); componentSubgraph.setName(component.getAssemblyComponent().getComponentType().getName()); final int operationId = this.identifierRegistry.getIdentifier(operation); final IVertex operationVertex = componentSubgraph.addVertexIfAbsent(operationId); operationVertex.setPropertyIfAbsent(PropertyKeys.TYPE, VertexType.DEPLOYED_OPERATION); operationVertex.setPropertyIfAbsent(PropertyKeys.NAME, operation.getAssemblyOperation().getOperationType().getName()); operationVertex.setPropertyIfAbsent(PropertyKeys.RETURN_TYPE, operation.getAssemblyOperation().getOperationType().getReturnType()); operationVertex.setPropertyIfAbsent(PropertyKeys.MODIFIERS, operation.getAssemblyOperation().getOperationType().getModifiers()); operationVertex.setPropertyIfAbsent(PropertyKeys.PARAMETER_TYPES, operation.getAssemblyOperation().getOperationType().getParameterTypes()); this.responseTimeDecorator.decorate(operationVertex, operation); return operationVertex; }