Giter Club home page Giter Club logo

vision-software-backend's Introduction

Intro

Para la resolución de la prueba se utilizo Java 8. Es importante que se despliegue el war sobre un servidor JBOSS Widifly 8.x que soporta precisamente Java 8; evidentemente de lo contrario el despliegue será erróneo. Sin embargo para más comodidad los servicios de validación de reglas se encuentran expuestos sobre la ip: http://54.200.93.241:8080.

Sin embargo si quiere probarlo en un servidor local, aquí encuentra el war de la aplicación.

Herramientas utilizadas

  1. JBOSS Widifly 8.x: Para el despliegue de la aplicación.
  2. Java 8: Se utilizan defaults, lambdas y Optionals extensivamente.
  3. JEE 6: Se utilizaron inyecciones de dependencia y anotaciones propias de esta versión del Java empresarial.
  4. Advanced REST Client Para Chrome: En vez de implementar un cliente front-end (teniendo en cuenta que la prueba es de backend) se puede utilizar un cliente existente. Más adelante se explicará como usarlo para probar los servicios REST.
  5. JUnit: Para las pruebas unitarias.
  6. Maven: Para la descripción del proyecto.
  7. REST: Se siguió este estilo arquitectural para la implementación de los servicios REST requeridos.

Endpoints

Si bien la aplicación valida reglas; hay tres sabores para validar estas reglas:

Se prueban todas las reglas existentes para el proceso XML suministrado

Se prueban las reglas indicadas en el Query Parameter names. Se deben separar por comas como está en el ejemplo.

Se prueban la regla indicada sobre el proceso.

En 2 y 3 los nombres de las reglas disponibles deben ser como se indican a continuación:

Nombre que se debe usar Descripción
BPMN_102 All flow objects other than end events and compensating activities must have an outgoing sequence flow, if the process level includes any start or end events.
STYLE_104 Two activities in the same process should not have the same name.
STYLE_115 A throwing intermediate event should be labeled.
STYLE_122 A catching Message event should have incoming message flow.
STYLE_123 A throwing Message event should have outgoing message flow

Uso

Para consumir los servicios REST utilice Advanced REST Client siguiendo los ejemplos que se indican a continuación:

  1. POST http://54.200.93.241:8080:8080/validation/rules/all:

Para consumir todas las reglas abra el Advanced REST en Chrome. Luego tendrá que hacer algo como esto:

All

Fíjarse en que se agrega un File .xpdl con el nombre file; de lo contrario obtendrá un error. SIEMPRE UTILICE EL NOMBRE file para todos los archivos que suba.

Usted obtendrá un JSON indicando los errores teniendo en cuenta todas las reglas. Esta respuesta será recurrente en los otros dos servicios por lo que se omitirá dicha respuesta en esos apartados.

[{
    "specificErrorMessages": [{
        "elementId": "fb4d6618-fce1-491e-95ea-a61c945aa510",
        "message": "There was an error in the event because: All flow objects other than end events and compensating activities must have an outgoing sequence flow, if the process level includes any start or end events.",
        "elementName": "A"
    }, {
        "elementId": "be9fa0a8-8b6b-479e-8c60-832f8b0e469b",
        "message": "There was an error in the event because: All flow objects other than end events and compensating activities must have an outgoing sequence flow, if the process level includes any start or end events.",
        "elementName": "C"
    }, {
        "elementId": "bb6f3a3e-acff-48a8-bafa-c406b2114c2b",
        "message": "There was an error in the event because: All flow objects other than end events and compensating activities must have an outgoing sequence flow, if the process level includes any start or end events.",
        "elementName": "S"
    }, {
        "elementId": "c18b9d3a-e828-43d7-bda9-794c8fc79e7a",
        "message": "There was an error in the event because: All flow objects other than end events and compensating activities must have an outgoing sequence flow, if the process level includes any start or end events.",
        "elementName": ""
    }, {
        "elementId": "6082a312-32d1-44bd-90a0-a055fd22f1b1",
        "message": "There was an error in the event because: All flow objects other than end events and compensating activities must have an outgoing sequence flow, if the process level includes any start or end events.",
        "elementName": ""
    }]
}, {
    "specificErrorMessages": [{
        "elementId": "c18b9d3a-e828-43d7-bda9-794c8fc79e7a",
        "message": "There was an error in the event because: A throwing intermediate event should be labeled.",
        "elementName": ""
    }, {
        "elementId": "6082a312-32d1-44bd-90a0-a055fd22f1b1",
        "message": "There was an error in the event because: A throwing intermediate event should be labeled.",
        "elementName": ""
    }]
}, {
    "specificErrorMessages": [{
        "elementId": "c18b9d3a-e828-43d7-bda9-794c8fc79e7a",
        "message": "There was an error in the event because: A catching Message event should have incoming message flow.",
        "elementName": ""
    }, {
        "elementId": "6082a312-32d1-44bd-90a0-a055fd22f1b1",
        "message": "There was an error in the event because: A catching Message event should have incoming message flow.",
        "elementName": ""
    }]
}, {
    "specificErrorMessages": [{
        "elementId": "c18b9d3a-e828-43d7-bda9-794c8fc79e7a",
        "message": "There was an error in the event because: A throwing Message event should have outgoing message flow",
        "elementName": ""
    }]
}]
  1. POST http://54.200.93.241:8080:8080/validation/rules?names=STYLE_122,STYLE_123:

Este servicio valida las reglas indicadas en names. En el caso del ejemplo se validan las reglas STYLE_122 y STYLE_123. Este seguro de utilizar los nombres indicados con anterioridad.

Some

  1. POST http://54.200.93.241:8080:8080/validation/rules/BPMN_102

Este servicio valida la regla indicada en el Path Param de la URL. En este caso se valida la regla BPMN_102. Reemplazarla a conveniencia.

Specific

Decisiones de diseño de software

Usted podrá encontrar entre otras una Factoría para crear las reglas, un Agregador para validar múltiples reglas, expresiones lambda que permiten simular mejor el comportamiento del patrón Command. Del mismo modo se usan Optionals que son una Mónada (en programación funcional) que vendría a hacer el equivalente al patrón Decorador pero mucho más simple.

Finalmente usted podrá encontrar que el parseador expresa buen SRP.

vision-software-backend's People

Contributors

ftrianakast avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.