Search in sources :

Example 1 with IncidentType

use of org.citrusframework.schema.samples.incidentmanager.v1.IncidentType in project citrus-samples by christophd.

the class IncidentManagerService method openIncident.

@Override
public OpenIncidentResponse openIncident(@WebParam(partName = "parameters", name = "OpenIncident", targetNamespace = "http://www.citrusframework.org/schema/samples/IncidentManager/v1") OpenIncident in) throws IncidentFault_Exception {
    log.info(String.format("Received new incident request '%s'", in.getIncident().getTicketId()));
    AnalyseIncident analyseRequest = new AnalyseIncident();
    analyseRequest.setIncident(new IncidentType());
    analyseRequest.getIncident().setTicketId(in.getIncident().getTicketId());
    analyseRequest.getIncident().setDescription(in.getIncident().getDescription());
    analyseRequest.setNetwork(new NetworkType());
    analyseRequest.getNetwork().setLineId(UUID.randomUUID().toString());
    analyseRequest.getNetwork().setConnection(UUID.randomUUID().toString());
    analyseRequest.getNetwork().setType(NetworkComponentType.fromValue(in.getIncident().getComponent().name()));
    AnalyseIncidentResponse analyseIncidentResponse = networkService.analyse(analyseRequest);
    if (analyseIncidentResponse.getResult().isFieldForceRequired()) {
        OrderRequest ffOrder = new OrderRequest();
        ffOrder.setIncident(new org.citrusframework.schema.samples.fieldforceservice.v1.IncidentType());
        ffOrder.getIncident().setTicketId(in.getIncident().getTicketId());
        ffOrder.getIncident().setDescription(in.getIncident().getDescription());
        ffOrder.setCustomer(new CustomerType());
        ffOrder.getCustomer().setId(in.getCustomer().getId());
        ffOrder.getCustomer().setFirstname(in.getCustomer().getFirstname());
        ffOrder.getCustomer().setLastname(in.getCustomer().getLastname());
        ffOrder.getCustomer().setAddress(in.getCustomer().getAddress());
        ffOrder.setNetwork(new org.citrusframework.schema.samples.fieldforceservice.v1.NetworkType());
        ffOrder.getNetwork().setLineId(analyseRequest.getNetwork().getLineId());
        fieldForceService.placeOrder(ffOrder);
    }
    OpenIncidentResponse incidentResponse = new OpenIncidentResponse();
    incidentResponse.setTicketId(in.getIncident().getTicketId());
    incidentResponse.setScheduled(getScheduledTime());
    log.info(String.format("Successfully processed new incident request '%s'", in.getIncident().getTicketId()));
    return incidentResponse;
}
Also used : IncidentType(org.citrusframework.schema.samples.networkservice.v1.IncidentType) NetworkType(org.citrusframework.schema.samples.networkservice.v1.NetworkType) org.citrusframework.schema.samples.fieldforceservice.v1(org.citrusframework.schema.samples.fieldforceservice.v1) org.citrusframework.schema.samples.networkservice.v1(org.citrusframework.schema.samples.networkservice.v1) org.citrusframework.schema.samples.incidentmanager.v1(org.citrusframework.schema.samples.incidentmanager.v1) CustomerType(org.citrusframework.schema.samples.fieldforceservice.v1.CustomerType)

Example 2 with IncidentType

use of org.citrusframework.schema.samples.incidentmanager.v1.IncidentType in project citrus-samples by christophd.

the class IncidentManager_Http_IT method testIncidentManager_Http_SchemaInvalid.

@CitrusTest(name = "IncidentManager_Http_SchemaInvalid_IT")
public void testIncidentManager_Http_SchemaInvalid() {
    OpenIncident incident = new OpenIncident();
    incident.setIncident(new IncidentType());
    incident.getIncident().setCaptured(Calendar.getInstance());
    incident.getIncident().setComponent(ComponentType.SOFTWARE);
    incident.getIncident().setState(StateType.NEW);
    incident.getIncident().setDescription("Something missing!");
    assertSoapFault().faultCode("{http://schemas.xmlsoap.org/soap/envelope/}Client").faultString("@startsWith('Unmarshalling Error')@").when(send(incidentHttpClient).payloadModel(incident).header(SoapMessageHeaders.SOAP_ACTION, "/IncidentManager/openIncident"));
}
Also used : IncidentType(org.citrusframework.schema.samples.incidentmanager.v1.IncidentType) CitrusTest(com.consol.citrus.annotations.CitrusTest)

Example 3 with IncidentType

use of org.citrusframework.schema.samples.incidentmanager.v1.IncidentType in project citrus-samples by christophd.

the class IncidentManager_Http_IT method createOpenIncidentTestRequest.

private OpenIncident createOpenIncidentTestRequest() {
    OpenIncident incident = new OpenIncident();
    incident.setIncident(new IncidentType());
    incident.getIncident().setTicketId(UUID.randomUUID().toString());
    incident.getIncident().setCaptured(Calendar.getInstance());
    incident.getIncident().setComponent(ComponentType.NETWORK);
    incident.getIncident().setState(StateType.NEW);
    incident.setCustomer(new CustomerType());
    incident.getCustomer().setId(1000);
    incident.getCustomer().setFirstname("Christoph");
    incident.getCustomer().setLastname("Deppisch");
    incident.getCustomer().setAddress("Franziskanerstr. 38, 80995 München");
    incident.getIncident().setDescription("Something went wrong!");
    return incident;
}
Also used : IncidentType(org.citrusframework.schema.samples.incidentmanager.v1.IncidentType)

Example 4 with IncidentType

use of org.citrusframework.schema.samples.incidentmanager.v1.IncidentType in project citrus-samples by christophd.

the class IncidentManager_Jms_IT method testIncidentManager_Jms_SchemaInvalid.

@CitrusTest(name = "IncidentManager_Jms_SchemaInvalid_IT")
public void testIncidentManager_Jms_SchemaInvalid() {
    OpenIncident incident = new OpenIncident();
    incident.setIncident(new IncidentType());
    incident.getIncident().setCaptured(Calendar.getInstance());
    incident.getIncident().setComponent(ComponentType.SOFTWARE);
    incident.getIncident().setState(StateType.NEW);
    incident.getIncident().setDescription("Something missing!");
    send(incidentJmsEndpoint).payloadModel(incident).header(SoapMessageHeaders.SOAP_ACTION, "/IncidentManager/openIncident");
    receive(incidentJmsEndpoint).payload("<SOAP-ENV:Fault xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<faultcode>@contains('Client')@</faultcode>" + "<faultstring>@startsWith('Unmarshalling Error')@</faultstring>" + "</SOAP-ENV:Fault>").header("SOAPJMS_isFault", "true");
}
Also used : IncidentType(org.citrusframework.schema.samples.incidentmanager.v1.IncidentType) CitrusTest(com.consol.citrus.annotations.CitrusTest)

Example 5 with IncidentType

use of org.citrusframework.schema.samples.incidentmanager.v1.IncidentType in project citrus-samples by christophd.

the class IncidentManager_Jms_IT method createOpenIncidentTestRequest.

private OpenIncident createOpenIncidentTestRequest() {
    OpenIncident incident = new OpenIncident();
    incident.setIncident(new IncidentType());
    incident.getIncident().setTicketId(UUID.randomUUID().toString());
    incident.getIncident().setCaptured(Calendar.getInstance());
    incident.getIncident().setComponent(ComponentType.NETWORK);
    incident.getIncident().setState(StateType.NEW);
    incident.setCustomer(new CustomerType());
    incident.getCustomer().setId(1000);
    incident.getCustomer().setFirstname("Christoph");
    incident.getCustomer().setLastname("Deppisch");
    incident.getCustomer().setAddress("Franziskanerstr. 38, 80995 München");
    incident.getIncident().setDescription("Something went wrong!");
    return incident;
}
Also used : IncidentType(org.citrusframework.schema.samples.incidentmanager.v1.IncidentType)

Aggregations

IncidentType (org.citrusframework.schema.samples.incidentmanager.v1.IncidentType)4 CitrusTest (com.consol.citrus.annotations.CitrusTest)2 org.citrusframework.schema.samples.fieldforceservice.v1 (org.citrusframework.schema.samples.fieldforceservice.v1)1 CustomerType (org.citrusframework.schema.samples.fieldforceservice.v1.CustomerType)1 org.citrusframework.schema.samples.incidentmanager.v1 (org.citrusframework.schema.samples.incidentmanager.v1)1 org.citrusframework.schema.samples.networkservice.v1 (org.citrusframework.schema.samples.networkservice.v1)1 IncidentType (org.citrusframework.schema.samples.networkservice.v1.IncidentType)1 NetworkType (org.citrusframework.schema.samples.networkservice.v1.NetworkType)1