Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ljvis to version 6 and fix for formatted response #13

Merged
merged 6 commits into from
May 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.List;

import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheck;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckDocument.PreRegCheck;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckResponseItemType;
import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.stereotype.Service;

import com.nortal.jroad.client.emtav6.database.EmtaV6XRoadDatabase;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheck;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckDocument.PreRegCheck;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckResponseItemType;
import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;
import com.nortal.jroad.client.service.XRoadDatabaseService;
Expand Down
76 changes: 37 additions & 39 deletions client-service/emtav6/src/main/resources/emtav6.wsdl
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://emta-v6.x-road.eu" xmlns:xrd="http://x-road.eu/xsd/xroad.xsd"
targetNamespace="http://emta-v6.x-road.eu" name="mkrliides">
<?xml version="1.0" encoding="utf-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://emta-v6.x-road.eu" xmlns:xrd="http://x-road.eu/xsd/xroad.xsd" name="mkrliides" targetNamespace="http://emta-v6.x-road.eu">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://emta-v6.x-road.eu">
<import namespace="http://x-road.eu/xsd/xroad.xsd" schemaLocation="http://x-road.eu/xsd/xroad.xsd"/>
<complexType name="preRegCheck">
<sequence>
<element name="item" type="tns:PreRegCheckRequestItemType" maxOccurs="20"/>
</sequence>
</complexType>
<element name="preRegCheck">
<complexType>
<sequence>
<element maxOccurs="20" name="item" type="tns:PreRegCheckRequestItemType"/>
</sequence>
</complexType>
</element>
<complexType name="PreRegCheckRequestItemType">
<sequence>
<element name="application" type="tns:ArisApplicationType"/>
<element name="vechicle" type="tns:ArisVechicleType"/>
<element name="vendor" type="tns:ArisVendorType"/>
<element name="buyer" type="tns:ArisBuyerType"/>
<element name="applicationSubmitter" type="tns:ArisApplicationSubmitterType"/>
<element minOccurs="0" name="applicationSubmitter" type="tns:ArisApplicationSubmitterType"/>
<element name="transaction" type="tns:ArisTransactionType"/>
<element name="documentFiles" minOccurs="0">
<element minOccurs="0" name="documentFiles">
<complexType>
<sequence>
<element name="file" type="tns:ArisDocumentFileType" maxOccurs="unbounded"/>
<element maxOccurs="unbounded" name="file" type="tns:ArisDocumentFileType"/>
</sequence>
</complexType>
</element>
Expand Down Expand Up @@ -63,14 +63,14 @@
</appinfo>
</annotation>
</element>
<element name="applicantEmail" type="string" minOccurs="0">
<element minOccurs="0" name="applicantEmail" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Meiliaadress</xrd:title>
</appinfo>
</annotation>
</element>
<element name="applicantPhone" type="string" minOccurs="0">
<element minOccurs="0" name="applicantPhone" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Telefon</xrd:title>
Expand Down Expand Up @@ -116,7 +116,7 @@
</appinfo>
</annotation>
</element>
<element name="firstRegDate" type="date" minOccurs="0">
<element minOccurs="0" name="firstRegDate" type="date">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Esmane registreerimine</xrd:title>
Expand All @@ -137,7 +137,7 @@
</appinfo>
</annotation>
</element>
<element name="previousRegCountry" type="string" minOccurs="0">
<element minOccurs="0" name="previousRegCountry" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Riigi kood</xrd:title>
Expand All @@ -162,21 +162,21 @@
</appinfo>
</annotation>
</element>
<element name="code" type="string" minOccurs="0">
<element minOccurs="0" name="code" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Müüja kood</xrd:title>
</appinfo>
</annotation>
</element>
<element name="vendorType" type="tns:ArisClientType" minOccurs="0">
<element minOccurs="0" name="vendorType" type="tns:ArisClientType">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Müüja tüüp</xrd:title>
</appinfo>
</annotation>
</element>
<element name="vatNr" type="string" minOccurs="0">
<element minOccurs="0" name="vatNr" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">VAT number</xrd:title>
Expand All @@ -201,7 +201,7 @@
</simpleType>
<complexType name="ArisBuyerType">
<sequence>
<element name="firstName" type="string" minOccurs="0">
<element minOccurs="0" name="firstName" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Ostja eesnimi</xrd:title>
Expand Down Expand Up @@ -237,7 +237,7 @@
</appinfo>
</annotation>
</element>
<element name="nonResidentAddress" type="string" minOccurs="0">
<element minOccurs="0" name="nonResidentAddress" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Aadress</xrd:title>
Expand All @@ -248,21 +248,21 @@
</complexType>
<complexType name="ArisApplicationSubmitterType">
<sequence>
<element name="firstName" type="string" minOccurs="0">
<element minOccurs="0" name="firstName" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Taotluse esitaja eesnimi</xrd:title>
</appinfo>
</annotation>
</element>
<element name="lastName" type="string" minOccurs="0">
<element minOccurs="0" name="lastName" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Taotluse esitaja perenimi</xrd:title>
</appinfo>
</annotation>
</element>
<element name="code" type="string" minOccurs="0">
<element minOccurs="0" name="code" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Taotluse esitaja kood</xrd:title>
Expand Down Expand Up @@ -355,7 +355,7 @@
</appinfo>
</annotation>
</element>
<element name="documentTypes" type="tns:ArisDocumentType" maxOccurs="unbounded"/>
<element name="documentTypes" type="tns:ArisDocumentType"/>
</sequence>
</complexType>
<simpleType name="ArisFileStatusType">
Expand All @@ -368,7 +368,7 @@
</simpleType>
<complexType name="ArisDocumentType">
<sequence>
<element name="documentType" type="string">
<element maxOccurs="unbounded" name="documentType" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Dokumendi liik</xrd:title>
Expand All @@ -377,12 +377,13 @@
</element>
</sequence>
</complexType>

<complexType name="preRegCheckResponse">
<sequence>
<element name="item" type="tns:PreRegCheckResponseItemType" maxOccurs="20"/>
</sequence>
</complexType>
<element name="preRegCheckResponse">
<complexType>
<sequence>
<element maxOccurs="20" name="item" type="tns:PreRegCheckResponseItemType"/>
</sequence>
</complexType>
</element>
<complexType name="PreRegCheckResponseItemType">
<sequence>
<element name="arisId" type="long">
Expand All @@ -402,7 +403,7 @@
</appinfo>
</annotation>
</element>
<element name="error" type="string" minOccurs="0">
<element minOccurs="0" name="error" type="string">
<annotation>
<appinfo>
<xrd:title xml:lang="et">Viga</xrd:title>
Expand All @@ -420,8 +421,7 @@
</simpleType>
</schema>
</wsdl:types>

<wsdl:message name="preRegCheckRequest">
<wsdl:message name="preRegCheck">
<wsdl:part element="tns:preRegCheck" name="parameters"/>
</wsdl:message>
<wsdl:message name="preRegCheckResponse">
Expand All @@ -432,9 +432,9 @@
<wsdl:part element="xrd:service" name="service"/>
<wsdl:part element="xrd:id" name="id"/>
<wsdl:part element="xrd:userId" name="userId"/>
<wsdl:part element="xrd:issue" name="issue"/>
<wsdl:part element="xrd:protocolVersion" name="protocolVersion"/>
</wsdl:message>

<wsdl:portType name="webServiceInterface">
<wsdl:operation name="preRegCheck">
<wsdl:documentation>
Expand All @@ -443,11 +443,10 @@
Sõidukite registreerimiseelse kontrolli taotlused Maanteeametist.
</xrd:notes>
</wsdl:documentation>
<wsdl:input message="tns:preRegCheckRequest"/>
<wsdl:input message="tns:preRegCheck"/>
<wsdl:output message="tns:preRegCheckResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="soapBindings" type="tns:webServiceInterface">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="preRegCheck">
Expand All @@ -471,10 +470,9 @@
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="webService">
<wsdl:port binding="tns:soapBindings" name="port">
<soap:address location="http://SERVER_URL"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
</wsdl:definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;

import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.ArisApplicationType;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheck;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckDocument.PreRegCheck;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckRequestItemType;
import com.nortal.jroad.client.emtav6.types.eu.x_road.emta_v6.PreRegCheckResponseItemType;
import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;
Expand All @@ -21,13 +21,13 @@ public class EmtaV6XRoadServiceImplTest extends BaseXRoadServiceImplTest {
@Resource
private EmtaV6XRoadServiceImpl emtav6xTeeServiceImpl;

// Need to mock soapUI service with preRegCheckV1Response.xml
@Test
public void preRegCheckV1() throws XRoadServiceConsumptionException {
PreRegCheck preRegCheck = PreRegCheck.Factory.newInstance();
PreRegCheckRequestItemType itemType = preRegCheck.addNewItem();
ArisApplicationType applicationType = itemType.addNewApplication();
applicationType.setApplicantEmail("test@test.ee");
applicationType.setArisId(arisId);
applicationType.setApplicantEmail("test.wsdl@test.wsdl.ee");
applicationType.setApplicantPhone("12335465");
List<PreRegCheckResponseItemType> itemList = emtav6xTeeServiceImpl.preRegCheckV1(preRegCheck);
Assert.assertEquals(arisId, itemList.get(0).getArisId());
Expand Down
17 changes: 17 additions & 0 deletions client-service/jvis/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>xtee-client-jvis</artifactId>
<name>Jvis client services</name>

<parent>
<groupId>com.nortal.jroad</groupId>
<artifactId>xtee-client-service</artifactId>
<version>4.2.0</version>
</parent>

<properties>
<package>jvis</package>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.nortal.jroad.client.jvis;

import java.util.Date;

import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.IsikuVedurijuhilubaVastusDocument.IsikuVedurijuhilubaVastus;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaTaotlusParingDocument.VedurijuhiloaTaotlusParing;

public interface Jvisv6XRoadService {

IsikuVedurijuhilubaVastus getIsikuVedurijuhiluba(String isikukood) throws XRoadServiceConsumptionException;

String sendIsikuVedurijuhilubaTaotlus(VedurijuhiloaTaotlusParing paring) throws XRoadServiceConsumptionException;

String sendVedurijuhiloaEksam(String isikukood, long sooritatud, Date kuupaev) throws XRoadServiceConsumptionException;

String sendVedurijuhiloaKatteandmine(String isikukood, String loaNumber, Date kattesaamiseKuupaev) throws XRoadServiceConsumptionException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.nortal.jroad.client.jvis;

import java.math.BigInteger;
import java.util.Calendar;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;
import com.nortal.jroad.client.jvis.database.Jvisv6XRoadDatabase;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.IsikuVedurijuhilubaParingDocument.IsikuVedurijuhilubaParing;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.IsikuVedurijuhilubaVastusDocument.IsikuVedurijuhilubaVastus;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaEksamParingDocument.VedurijuhiloaEksamParing;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaEksamVastusDocument.VedurijuhiloaEksamVastus;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaKatteandmineParingDocument.VedurijuhiloaKatteandmineParing;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaKatteandmineVastusDocument.VedurijuhiloaKatteandmineVastus;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaTaotlusParingDocument.VedurijuhiloaTaotlusParing;
import com.nortal.jroad.client.jvis.types.eu.x_road.jvisv6.producer.VedurijuhiloaTaotlusVastusDocument.VedurijuhiloaTaotlusVastus;

@Service("jvisv6XTeeService")
public class Jvisv6XRoadServiceImpl implements Jvisv6XRoadService {

@Resource
private Jvisv6XRoadDatabase jvisv6XRoadDatabase;

public IsikuVedurijuhilubaVastus getIsikuVedurijuhiluba(String isikukood) throws XRoadServiceConsumptionException {
IsikuVedurijuhilubaParing paring = IsikuVedurijuhilubaParing.Factory.newInstance();
paring.setIsikukood(isikukood);
return jvisv6XRoadDatabase.isikuVedurijuhilubaV1(paring);
}

public String sendIsikuVedurijuhilubaTaotlus(VedurijuhiloaTaotlusParing paring) throws XRoadServiceConsumptionException {
VedurijuhiloaTaotlusVastus vastus = jvisv6XRoadDatabase.vedurijuhiloaTaotlusV1(paring);
return vastus.getVastuskood();
}

public String sendVedurijuhiloaEksam(String isikukood, long sooritatud, Date kuupaev) throws XRoadServiceConsumptionException {
VedurijuhiloaEksamParing paring = getVedurijuhiloaEksamParing(isikukood, sooritatud, kuupaev);
VedurijuhiloaEksamVastus vastus = jvisv6XRoadDatabase.vedurijuhiloaEksamV1(paring);
return vastus.getVastuskood();
}

private VedurijuhiloaEksamParing getVedurijuhiloaEksamParing(String isikukood, long sooritatud, Date kuupaev) {
VedurijuhiloaEksamParing paring = VedurijuhiloaEksamParing.Factory.newInstance();
paring.setIsikukood(isikukood);
paring.setSooritatud(BigInteger.valueOf(sooritatud));
paring.setKuupaev(getCalendarFromDate(kuupaev));
return paring;
}

private Calendar getCalendarFromDate(Date kuupaev) {
Calendar calDate = Calendar.getInstance();
calDate.setTime(kuupaev);
return calDate;
}

public String sendVedurijuhiloaKatteandmine(String isikukood, String loaNumber, Date kattesaamiseKuupaev) throws XRoadServiceConsumptionException {
VedurijuhiloaKatteandmineParing paring = VedurijuhiloaKatteandmineParing.Factory.newInstance();
paring.setIsikukood(isikukood);
paring.setLoaNumber(loaNumber);
paring.setKatteandmiseKuupaev(getCalendarFromDate(kattesaamiseKuupaev));
VedurijuhiloaKatteandmineVastus vastus = jvisv6XRoadDatabase.vedurijuhiloaKatteandmineV1(paring);
return vastus.getVastuskood();
}

}
Loading