Changeset 1913


Ignore:
Timestamp:
03/11/15 16:59:16 (10 years ago)
Author:
sherbold
Message:
  • extended SimpleSOAPEventType with clientName
  • modified UMLUtils.createInteraction... to use the client name to determine the source lifeline
  • updated UMLUtilsTest to work with new service name definitions
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/HTTPUtils.java

    r1635 r1913  
    143143                    SOAPEventType eventType = (SOAPEventType) event.getType(); 
    144144                    newSequence.add(new Event(new SimpleSOAPEventType(eventType.getCalledMethod(), 
    145                                                                       eventType.getServiceName()))); 
     145                                                                      eventType.getServiceName(), 
     146                                                                      eventType.getClientName()))); 
    146147                } 
    147148                else { 
  • trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/eventcore/SimpleSOAPEventType.java

    r1642 r1913  
    4444     */ 
    4545    private final String serviceName; 
     46     
     47    /** 
     48     * <p> 
     49     * the name of the client; this is either the host/ip and port of the sender or, if a path 
     50     * map is available, a human readable name that may be based also on the receiver 
     51     * </p> 
     52     */ 
     53    private final String clientName; 
    4654 
    4755    /** 
     
    5159     *  
    5260     */ 
    53     public SimpleSOAPEventType(String calledMethod, String serviceName) { 
     61    public SimpleSOAPEventType(String calledMethod, String serviceName, String clientName) { 
    5462        if (calledMethod == null) { 
    5563            throw new IllegalArgumentException("called method must not be null"); 
     
    5866            throw new IllegalArgumentException("serviceName must not be null"); 
    5967        } 
     68        if (clientName == null) { 
     69            throw new IllegalArgumentException("clientName must not be null"); 
     70        } 
    6071        this.calledMethod = calledMethod; 
    6172        this.serviceName = serviceName; 
     73        this.clientName = clientName; 
    6274    } 
    6375 
     
    8294    public String getServiceName() { 
    8395        return serviceName; 
     96    } 
     97     
     98    /** 
     99     * <p> 
     100     * the name of the client calling in this request 
     101     * </p> 
     102     * 
     103     * @return the name of the client calling in this request 
     104     */ 
     105    public String getClientName() { 
     106        return clientName; 
    84107    } 
    85108 
  • trunk/autoquest-plugin-uml-test/src/test/resources/ita_v2_servicenamemap.txt

    r1908 r1913  
    1 /ws/BusinessUnitReferenceImplementationService = materialSupplierService 
    2 /ws/WarehouseReferenceImplementationService = warehouseService 
    3 /ws/PointOfSaleReferenceImplementationService = pointOfSaleService 
    4 /ws/TransportReferenceImplementationService = TransportService 
     1serviceName.path./ws/BusinessUnitReferenceImplementationService = materialSupplierService 
     2serviceName.path./ws/WarehouseReferenceImplementationService = warehouseService 
     3serviceName.path./ws/PointOfSaleReferenceImplementationService = pointOfSaleService 
     4serviceName.path./ws/TransportReferenceImplementationService = TransportService 
     5clientName.receiver.port.8086 = warehouseService 
     6clientName.receiver.port.8087 = TransportService 
     7clientName.receiver.port.8088 = pointOfSaleService 
     8clientName.receiver.port.8089 = materialSupplierService 
     9clientName.receiver.port.8090 = TransportService 
     10clientName.receiver.port.8091 = pointOfSaleService 
     11clientName.receiver.port.8092 = materialSupplierService 
     12clientName.receiver.port.8093 = warehouseService 
     13clientName.receiver.port.8094 = pointOfSaleService 
     14clientName.receiver.port.8095 = materialSupplierService 
     15clientName.receiver.port.8096 = warehouseService 
     16clientName.receiver.port.8097 = TransportService 
     17clientName.default = Logistics_Environment 
     18 
  • trunk/autoquest-plugin-uml-test/src/test/resources/testCalculateUsageScore_1_properties.txt

    r1835 r1913  
    1 /midas/rlus/query/xdw = rlus_property 
    2 /midas/rlus/update/xdw = rlus_property 
    3 /midas/rlus/update/cda2report = rlus_property 
    4 /midas/ixsmq/update/pocdpatient = ixsmq_property 
    5 /midas/ixsmq/query/pocdpatient = ixsmq_property 
     1serviceName.path./midas/rlus/query/xdw = rlus_property 
     2serviceName.path./midas/rlus/update/xdw = rlus_property 
     3serviceName.path./midas/rlus/update/cda2report = rlus_property 
     4serviceName.path./midas/ixsmq/update/pocdpatient = ixsmq_property 
     5serviceName.path./midas/ixsmq/query/pocdpatient = ixsmq_property 
     6clientName.receiver.port.6000 = user 
  • trunk/autoquest-plugin-uml-test/src/test/resources/testCreateInteractionFromEventSequence_1_properties.txt

    r1835 r1913  
    1 /midas/rlus/query/xdw = rlus_property 
    2 /midas/rlus/update/xdw = rlus_property 
    3 /midas/rlus/update/cda2report = rlus_property 
    4 /midas/ixsmq/update/pocdpatient = ixsmq_property 
    5 /midas/ixsmq/query/pocdpatient = ixsmq_property 
     1serviceName.path./midas/rlus/query/xdw = rlus_property 
     2serviceName.path./midas/rlus/update/xdw = rlus_property 
     3serviceName.path./midas/rlus/update/cda2report = rlus_property 
     4serviceName.path./midas/ixsmq/update/pocdpatient = ixsmq_property 
     5serviceName.path./midas/ixsmq/query/pocdpatient = ixsmq_property 
     6clientName.receiver.port.6000 = user 
  • trunk/autoquest-plugin-uml-test/src/test/resources/testCreateInteractionFromEventSequence_2_properties.txt

    r1835 r1913  
    1 /ws/BusinessUnitBusinessService = materialSupplier 
    2 /ws/BusinessUnitWarehouseService = warehouse 
    3 /ws/BusinessUnitTransportService = transport 
    4 /ws/WarehouseWarehouseService = warehouse 
    5 /ws/WarehouseBusinessService = materialSupplier 
    6 /ws/WarehouseTransportService = transport 
    7 /ws/TransportTransportService = transport 
    8 /ws/PointOfSaleBusinessService = pointOfSale 
    9 /ws/PointOfSaleWarehouseService = pointOfSale 
    10 /ws/PointOfSaleTransportService = pointOfSale 
     1serviceName.path./ws/BusinessUnitBusinessService = materialSupplier 
     2serviceName.path./ws/BusinessUnitWarehouseService = warehouse 
     3serviceName.path./ws/BusinessUnitTransportService = transport 
     4serviceName.path./ws/WarehouseWarehouseService = warehouse 
     5serviceName.path./ws/WarehouseBusinessService = materialSupplier 
     6serviceName.path./ws/WarehouseTransportService = transport 
     7serviceName.path./ws/TransportTransportService = transport 
     8serviceName.path./ws/PointOfSaleBusinessService = pointOfSale 
     9serviceName.path./ws/PointOfSaleWarehouseService = pointOfSale 
     10serviceName.path./ws/PointOfSaleTransportService = pointOfSale 
     11clientName.receiver.port.9081 = warehouse 
     12clientName.receiver.port.9082 = transport 
     13clientName.receiver.port.9083 = warehouse 
     14clientName.receiver.port.9084 = warehouse 
  • trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java

    r1908 r1913  
    486486                String serviceName = getServiceNameFromEvent(event); 
    487487                String methodName = getCalledMethodFromEvent(event); 
     488                String clientName = getClientNameFromEvent(event); 
    488489                // determine lifelines 
    489490                Lifeline msgTargetLifeline; 
    490491                Lifeline msgSourceLifeline; 
    491  
    492                 if (serviceName.equals(userLifeline.getName())) { 
    493                     // message being send to user 
    494                     // currently we just select the first lifeline that is not the user 
    495                     // this, obviously, has to be replaced with the real service. 
    496                     // however, identification of the source of a message is still an open issue 
    497                     msgSourceLifeline = null; 
    498                     for (Lifeline lifeline : interaction.getLifelines()) { 
    499                         if (!lifeline.equals(userLifeline)) { 
    500                             msgSourceLifeline = lifeline; 
    501                             break; 
    502                         } 
    503                     } 
    504                     msgTargetLifeline = userLifeline; 
    505                 } 
    506                 else { 
    507                     msgSourceLifeline = userLifeline; 
    508                     msgTargetLifeline = interaction.getLifeline(serviceName); 
    509                 } 
     492                 
     493                msgSourceLifeline = interaction.getLifeline(clientName); 
     494                msgTargetLifeline = interaction.getLifeline(serviceName); 
     495                 
    510496                if (msgSourceLifeline == null) { 
    511497                    throw new RuntimeException( 
    512                                                "Error creating message: could not determine source lifeline."); 
     498                                               "Error creating message: could not determine source lifeline for component: " + clientName); 
    513499                } 
    514500                if (msgTargetLifeline == null) { 
    515501                    throw new RuntimeException( 
    516                                                "Error creating message: could not determine target lifeline."); 
     502                                               "Error creating message: could not determine target lifeline for component: " + serviceName); 
    517503                } 
    518504                // determine correct target interface 
     
    666652                            .getName(); 
    667653                } 
    668                 eventSequence.add(new Event(new SimpleSOAPEventType(methodName, serviceName))); 
     654                eventSequence.add(new Event(new SimpleSOAPEventType(methodName, serviceName,""))); // TODO add client name 
    669655            } 
    670656        } 
     
    809795        else if (event.getType() instanceof SimpleSOAPEventType) { 
    810796            return ((SimpleSOAPEventType) event.getType()).getCalledMethod(); 
     797        } 
     798        else { 
     799            throw new RuntimeException( 
     800                                       "Wrong event type. Only SOAPEventType and SimpleSOAPEventType supported but was: " + 
     801                                           event.getType().getClass().getName()); 
     802        } 
     803    } 
     804     
     805    /** 
     806     * <p> 
     807     * Helper function to get the name of a client from a SOAP event. 
     808     * </p> 
     809     *  
     810     * @param event 
     811     *            event for which the client name is retrieved 
     812     * @return service name 
     813     */ 
     814    protected static String getClientNameFromEvent(Event event) { 
     815        if (event.getType() instanceof SOAPEventType) { 
     816            return ((SOAPEventType) event.getType()).getClientName(); 
     817        } 
     818        else if (event.getType() instanceof SimpleSOAPEventType) { 
     819            return ((SimpleSOAPEventType) event.getType()).getClientName(); 
    811820        } 
    812821        else { 
     
    10131022        InstanceSpecification instSpec = (InstanceSpecification) serviceInstSpecPkg.createPackagedElement("instspec_"+type.getName(), UMLPackage.Literals.INSTANCE_SPECIFICATION); 
    10141023        instSpec.getClassifiers().add(type); 
    1015         System.out.println(type.getName()); 
    10161024        for( Property prop : type.getAllAttributes() ) { 
    10171025            // TODO handle multiplicity 
Note: See TracChangeset for help on using the changeset viewer.