forked from nortal/j-road
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
junit test for StandardXRoadConsumerMessageExtractor, which fixes jro…
…ad issue nortal#12
- Loading branch information
Anton Anikin
committed
Oct 11, 2017
1 parent
f1f305f
commit 4df121f
Showing
6 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
.../com/nortal/jroad/client/service/extractor/StandardXRoadConsumerMessageExtractorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.nortal.jroad.client.service.extractor; | ||
|
||
|
||
import com.nortal.jroad.model.XmlBeansXRoadMetadata; | ||
import org.junit.Test; | ||
import org.springframework.core.io.ClassPathResource; | ||
import org.springframework.ws.soap.saaj.SaajSoapMessage; | ||
|
||
import javax.xml.soap.MessageFactory; | ||
import javax.xml.soap.SOAPException; | ||
import javax.xml.soap.SOAPMessage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class StandardXRoadConsumerMessageExtractorTest { | ||
|
||
|
||
private SOAPMessage getMessageFromString(String filename) throws SOAPException, IOException { | ||
InputStream is = (new ClassPathResource(filename)).getInputStream(); | ||
|
||
return MessageFactory.newInstance().createMessage(null, is); | ||
} | ||
|
||
|
||
@Test | ||
public void testExtractData() throws IOException, SOAPException { | ||
StandardXRoadConsumerMessageExtractor extractor = | ||
new StandardXRoadConsumerMessageExtractor(new XmlBeansXRoadMetadata("operation", | ||
"b", | ||
"request", | ||
"d", | ||
"response", | ||
"f", | ||
"1")); | ||
|
||
|
||
// xml elements in a single row, but base64binary part on different rows | ||
extractor.extractData(new SaajSoapMessage(getMessageFromString("extractor/EarestFail1.xml"))); | ||
|
||
// manually formated file with whitespaces between elements without new row | ||
extractor.extractData(new SaajSoapMessage(getMessageFromString("extractor/EarestFail2.xml"))); | ||
|
||
// menually formated file without whitespaces between elements and without new row | ||
extractor.extractData(new SaajSoapMessage(getMessageFromString("extractor/EarestFail3.xml"))); | ||
|
||
// whole file in a single row | ||
extractor.extractData(new SaajSoapMessage(getMessageFromString("extractor/EarestFail4.xml"))); | ||
|
||
// menually formated file with whitespaces between elements and without new row | ||
extractor.extractData(new SaajSoapMessage(getMessageFromString("extractor/EarestFail5.xml"))); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
client-transport/src/test/resources/extractor/EarestFail1.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ear="http://earest.x-road.eu/" xmlns:id="http://x-road.eu/xsd/identifiers" xmlns:xroad="http://x-road.eu/xsd/xroad.xsd"><SOAP-ENV:Header><xroad:userId>70000349</xroad:userId><xroad:id>15d11af556270000349-1423336605</xroad:id><xroad:protocolVersion>4.0</xroad:protocolVersion><xroad:client id:objectType="SUBSYSTEM"><id:xRoadInstance>ee-dev</id:xRoadInstance><id:memberClass>GOV</id:memberClass><id:memberCode>70000349</id:memberCode><id:subsystemCode>earest-client</id:subsystemCode></xroad:client><xroad:service id:objectType="SERVICE"><id:xRoadInstance>ee-dev</id:xRoadInstance><id:memberClass>GOV</id:memberClass><id:memberCode>70000310</id:memberCode><id:subsystemCode>earest</id:subsystemCode><id:serviceCode>MulleSaabunudAsjad</id:serviceCode><id:serviceVersion>v1</id:serviceVersion></xroad:service></SOAP-ENV:Header><SOAP-ENV:Body><era:MulleSaabunudAsjadResponse xmlns:era="http://earest.x-road.eu/"><request><ParinguKoostamiseAeg>2017-10-06T15:51:00</ParinguKoostamiseAeg></request><response><ArestiVastused><Vastus><IsikuOigusedKohustused><Akt><AlgParinguUnikaalneID>A801201702209240</AlgParinguUnikaalneID><VolitatudKasutajad><VolitatudKasutaja><VolituseLaad /><VolituseFailiNimi>jyritamm</VolituseFailiNimi><VolituseFail>JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu | ||
ZyhldC1FRSkgL1N0cnVjdFRyZWVSb290IDE1IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4+ | ||
CjE1MDc2Nw0KJSVFT0YNCnhyZWYNCjAgMA0KdHJhaWxlcg0KPDwvU2l6ZSAyNy9Sb290IDEgMCBS | ||
L0luZm8gMTQgMCBSL0lEWzxBNDQzRkEyNkVCQzM3RTRDODczOUFEQkYxNUEyRTZDRj48QTQ0M0ZB | ||
MjZFQkMzN0U0Qzg3MzlBREJGMTVBMkU2Q0Y+XSAvUHJldiAxNTA3NjcvWFJlZlN0bSAxNTA0NjM+ | ||
Pg0Kc3RhcnR4cmVmDQoxNTE0NjUNCiUlRU9G</VolituseFail></VolitatudKasutaja></VolitatudKasutajad></Akt></IsikuOigusedKohustused></Vastus></ArestiVastused></response></era:MulleSaabunudAsjadResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> |
54 changes: 54 additions & 0 deletions
54
client-transport/src/test/resources/extractor/EarestFail2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xroad="http://x-road.eu/xsd/xroad.xsd" xmlns:id="http://x-road.eu/xsd/identifiers" xmlns:ear="http://earest.x-road.eu/"> | ||
<SOAP-ENV:Header> | ||
<xroad:userId>70000349</xroad:userId> | ||
<xroad:id>15d11af556270000349-1423336605</xroad:id> | ||
<xroad:protocolVersion>4.0</xroad:protocolVersion> | ||
<xroad:client id:objectType="SUBSYSTEM"> | ||
<id:xRoadInstance>ee-dev</id:xRoadInstance> | ||
<id:memberClass>GOV</id:memberClass> | ||
<id:memberCode>70000349</id:memberCode> | ||
<id:subsystemCode>earest-client</id:subsystemCode> | ||
</xroad:client> | ||
<xroad:service id:objectType="SERVICE"> | ||
<id:xRoadInstance>ee-dev</id:xRoadInstance> | ||
<id:memberClass>GOV</id:memberClass> | ||
<id:memberCode>70000310</id:memberCode> | ||
<id:subsystemCode>earest</id:subsystemCode> | ||
<id:serviceCode>MulleSaabunudAsjad</id:serviceCode> | ||
<id:serviceVersion>v1</id:serviceVersion> | ||
</xroad:service> | ||
</SOAP-ENV:Header> | ||
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> | ||
|
||
|
||
|
||
<era:MulleSaabunudAsjadResponse xmlns:era="http://earest.x-road.eu/"> | ||
<request> | ||
<ParinguKoostamiseAeg>2017-10-06T15:51:00</ParinguKoostamiseAeg> | ||
</request> | ||
<response> | ||
<ArestiVastused> | ||
<Vastus> | ||
<IsikuOigusedKohustused> | ||
<Akt> | ||
<AlgParinguUnikaalneID>A801201702209240</AlgParinguUnikaalneID> | ||
<VolitatudKasutajad> | ||
<VolitatudKasutaja> | ||
<VolituseLaad/> | ||
<VolituseFailiNimi>jyritamm</VolituseFailiNimi> | ||
<VolituseFail>JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu | ||
ZyhldC1FRSkgL1N0cnVjdFRyZWVSb290IDE1IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4+ | ||
CjE1MDc2Nw0KJSVFT0YNCnhyZWYNCjAgMA0KdHJhaWxlcg0KPDwvU2l6ZSAyNy9Sb290IDEgMCBS | ||
L0luZm8gMTQgMCBSL0lEWzxBNDQzRkEyNkVCQzM3RTRDODczOUFEQkYxNUEyRTZDRj48QTQ0M0ZB | ||
MjZFQkMzN0U0Qzg3MzlBREJGMTVBMkU2Q0Y+XSAvUHJldiAxNTA3NjcvWFJlZlN0bSAxNTA0NjM+ | ||
Pg0Kc3RhcnR4cmVmDQoxNTE0NjUNCiUlRU9G</VolituseFail> | ||
</VolitatudKasutaja> | ||
</VolitatudKasutajad> | ||
</Akt> | ||
</IsikuOigusedKohustused> | ||
</Vastus> | ||
</ArestiVastused> | ||
</response> | ||
</era:MulleSaabunudAsjadResponse> | ||
</SOAP-ENV:Body> | ||
</SOAP-ENV:Envelope> |
50 changes: 50 additions & 0 deletions
50
client-transport/src/test/resources/extractor/EarestFail3.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xroad="http://x-road.eu/xsd/xroad.xsd" xmlns:id="http://x-road.eu/xsd/identifiers" xmlns:ear="http://earest.x-road.eu/"> | ||
<SOAP-ENV:Header> | ||
<xroad:userId>70000349</xroad:userId> | ||
<xroad:id>15d11af556270000349-1423336605</xroad:id> | ||
<xroad:protocolVersion>4.0</xroad:protocolVersion> | ||
<xroad:client id:objectType="SUBSYSTEM"> | ||
<id:xRoadInstance>ee-dev</id:xRoadInstance> | ||
<id:memberClass>GOV</id:memberClass> | ||
<id:memberCode>70000349</id:memberCode> | ||
<id:subsystemCode>earest-client</id:subsystemCode> | ||
</xroad:client> | ||
<xroad:service id:objectType="SERVICE"> | ||
<id:xRoadInstance>ee-dev</id:xRoadInstance> | ||
<id:memberClass>GOV</id:memberClass> | ||
<id:memberCode>70000310</id:memberCode> | ||
<id:subsystemCode>earest</id:subsystemCode> | ||
<id:serviceCode>MulleSaabunudAsjad</id:serviceCode> | ||
<id:serviceVersion>v1</id:serviceVersion> | ||
</xroad:service> | ||
</SOAP-ENV:Header> | ||
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><era:MulleSaabunudAsjadResponse xmlns:era="http://earest.x-road.eu/"> | ||
<request> | ||
<ParinguKoostamiseAeg>2017-10-06T15:51:00</ParinguKoostamiseAeg> | ||
</request> | ||
<response> | ||
<ArestiVastused> | ||
<Vastus> | ||
<IsikuOigusedKohustused> | ||
<Akt> | ||
<AlgParinguUnikaalneID>A801201702209240</AlgParinguUnikaalneID> | ||
<VolitatudKasutajad> | ||
<VolitatudKasutaja> | ||
<VolituseLaad/> | ||
<VolituseFailiNimi>jyritamm</VolituseFailiNimi> | ||
<VolituseFail>JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu | ||
ZyhldC1FRSkgL1N0cnVjdFRyZWVSb290IDE1IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4+ | ||
CjE1MDc2Nw0KJSVFT0YNCnhyZWYNCjAgMA0KdHJhaWxlcg0KPDwvU2l6ZSAyNy9Sb290IDEgMCBS | ||
L0luZm8gMTQgMCBSL0lEWzxBNDQzRkEyNkVCQzM3RTRDODczOUFEQkYxNUEyRTZDRj48QTQ0M0ZB | ||
MjZFQkMzN0U0Qzg3MzlBREJGMTVBMkU2Q0Y+XSAvUHJldiAxNTA3NjcvWFJlZlN0bSAxNTA0NjM+ | ||
Pg0Kc3RhcnR4cmVmDQoxNTE0NjUNCiUlRU9G</VolituseFail> | ||
</VolitatudKasutaja> | ||
</VolitatudKasutajad> | ||
</Akt> | ||
</IsikuOigusedKohustused> | ||
</Vastus> | ||
</ArestiVastused> | ||
</response> | ||
</era:MulleSaabunudAsjadResponse> | ||
</SOAP-ENV:Body> | ||
</SOAP-ENV:Envelope> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ear="http://earest.x-road.eu/" xmlns:id="http://x-road.eu/xsd/identifiers" xmlns:xroad="http://x-road.eu/xsd/xroad.xsd"><SOAP-ENV:Header><xroad:userId>70000349</xroad:userId><xroad:id>15d11af556270000349-1423336605</xroad:id><xroad:protocolVersion>4.0</xroad:protocolVersion><xroad:client id:objectType="SUBSYSTEM"><id:xRoadInstance>ee-dev</id:xRoadInstance><id:memberClass>GOV</id:memberClass><id:memberCode>70000349</id:memberCode><id:subsystemCode>earest-client</id:subsystemCode></xroad:client><xroad:service id:objectType="SERVICE"><id:xRoadInstance>ee-dev</id:xRoadInstance><id:memberClass>GOV</id:memberClass><id:memberCode>70000310</id:memberCode><id:subsystemCode>earest</id:subsystemCode><id:serviceCode>MulleSaabunudAsjad</id:serviceCode><id:serviceVersion>v1</id:serviceVersion></xroad:service></SOAP-ENV:Header><SOAP-ENV:Body><era:MulleSaabunudAsjadResponse xmlns:era="http://earest.x-road.eu/"><request><ParinguKoostamiseAeg>2017-10-06T15:51:00</ParinguKoostamiseAeg></request><response><ArestiVastused><Vastus><IsikuOigusedKohustused><Akt><AlgParinguUnikaalneID>A801201702209240</AlgParinguUnikaalneID><VolitatudKasutajad><VolitatudKasutaja><VolituseLaad /><VolituseFailiNimi>jyritamm</VolituseFailiNimi><VolituseFail>JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZyhldC1FRSkgL1N0cnVjdFRyZWVSb290IDE1IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4+CjE1MDc2Nw0KJSVFT0YNCnhyZWYNCjAgMA0KdHJhaWxlcg0KPDwvU2l6ZSAyNy9Sb290IDEgMCBSL0luZm8gMTQgMCBSL0lEWzxBNDQzRkEyNkVCQzM3RTRDODczOUFEQkYxNUEyRTZDRj48QTQ0M0ZBMjZFQkMzN0U0Qzg3MzlBREJGMTVBMkU2Q0YXSAvUHJldiAxNTA3NjcvWFJlZlN0bSAxNTA0NjM+Pg0Kc3RhcnR4cmVmDQoxNTE0NjUNCiUlRU9G</VolituseFail></VolitatudKasutaja></VolitatudKasutajad></Akt></IsikuOigusedKohustused></Vastus></ArestiVastused></response></era:MulleSaabunudAsjadResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> |
50 changes: 50 additions & 0 deletions
50
client-transport/src/test/resources/extractor/EarestFail5.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xroad="http://x-road.eu/xsd/xroad.xsd" xmlns:id="http://x-road.eu/xsd/identifiers" xmlns:ear="http://earest.x-road.eu/"> | ||
<SOAP-ENV:Header> | ||
<xroad:userId>70000349</xroad:userId> | ||
<xroad:id>15d11af556270000349-1423336605</xroad:id> | ||
<xroad:protocolVersion>4.0</xroad:protocolVersion> | ||
<xroad:client id:objectType="SUBSYSTEM"> | ||
<id:xRoadInstance>ee-dev</id:xRoadInstance> | ||
<id:memberClass>GOV</id:memberClass> | ||
<id:memberCode>70000349</id:memberCode> | ||
<id:subsystemCode>earest-client</id:subsystemCode> | ||
</xroad:client> | ||
<xroad:service id:objectType="SERVICE"> | ||
<id:xRoadInstance>ee-dev</id:xRoadInstance> | ||
<id:memberClass>GOV</id:memberClass> | ||
<id:memberCode>70000310</id:memberCode> | ||
<id:subsystemCode>earest</id:subsystemCode> | ||
<id:serviceCode>MulleSaabunudAsjad</id:serviceCode> | ||
<id:serviceVersion>v1</id:serviceVersion> | ||
</xroad:service> | ||
</SOAP-ENV:Header> | ||
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <era:MulleSaabunudAsjadResponse xmlns:era="http://earest.x-road.eu/"> | ||
<request> | ||
<ParinguKoostamiseAeg>2017-10-06T15:51:00</ParinguKoostamiseAeg> | ||
</request> | ||
<response> | ||
<ArestiVastused> | ||
<Vastus> | ||
<IsikuOigusedKohustused> | ||
<Akt> | ||
<AlgParinguUnikaalneID>A801201702209240</AlgParinguUnikaalneID> | ||
<VolitatudKasutajad> | ||
<VolitatudKasutaja> | ||
<VolituseLaad/> | ||
<VolituseFailiNimi>jyritamm</VolituseFailiNimi> | ||
<VolituseFail>JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu | ||
ZyhldC1FRSkgL1N0cnVjdFRyZWVSb290IDE1IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4+ | ||
CjE1MDc2Nw0KJSVFT0YNCnhyZWYNCjAgMA0KdHJhaWxlcg0KPDwvU2l6ZSAyNy9Sb290IDEgMCBS | ||
L0luZm8gMTQgMCBSL0lEWzxBNDQzRkEyNkVCQzM3RTRDODczOUFEQkYxNUEyRTZDRj48QTQ0M0ZB | ||
MjZFQkMzN0U0Qzg3MzlBREJGMTVBMkU2Q0Y+XSAvUHJldiAxNTA3NjcvWFJlZlN0bSAxNTA0NjM+ | ||
Pg0Kc3RhcnR4cmVmDQoxNTE0NjUNCiUlRU9G</VolituseFail> | ||
</VolitatudKasutaja> | ||
</VolitatudKasutajad> | ||
</Akt> | ||
</IsikuOigusedKohustused> | ||
</Vastus> | ||
</ArestiVastused> | ||
</response> | ||
</era:MulleSaabunudAsjadResponse> | ||
</SOAP-ENV:Body> | ||
</SOAP-ENV:Envelope> |