Skip to content

Commit a74c1bf

Browse files
committed
#460: unit test
1 parent 20e7836 commit a74c1bf

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

platform-camel/ihe/hl7v3model/pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,42 @@
2323
<artifactId>ipf-platform-camel-ihe-hl7v3</artifactId>
2424
</dependency>
2525

26+
<!-- Dependencies for main -->
27+
<dependency>
28+
<groupId>org.openehealth.ipf.commons</groupId>
29+
<artifactId>ipf-commons-ihe-ws</artifactId>
30+
<version>${project.version}</version>
31+
<scope>test</scope>
32+
<type>test-jar</type>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.openehealth.ipf.platform-camel</groupId>
36+
<artifactId>ipf-platform-camel-ihe-ws</artifactId>
37+
<version>${project.version}</version>
38+
<scope>test</scope>
39+
<type>test-jar</type>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.eclipse.jetty</groupId>
43+
<artifactId>jetty-server</artifactId>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.eclipse.jetty.ee10</groupId>
48+
<artifactId>jetty-ee10-servlet</artifactId>
49+
<scope>test</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.springframework</groupId>
53+
<artifactId>spring-web</artifactId>
54+
<scope>test</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.apache.camel</groupId>
58+
<artifactId>camel-cxf-spring-soap</artifactId>
59+
<scope>test</scope>
60+
</dependency>
61+
2662
</dependencies>
2763

2864
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openehealth.ipf.platform.camel.ihe.hl7v3.core.converters;
17+
18+
import net.ihe.gazelle.hl7v3.datatypes.II;
19+
import org.apache.camel.Exchange;
20+
import org.apache.camel.support.DefaultExchange;
21+
import org.apache.cxf.transport.servlet.CXFServlet;
22+
import org.junit.jupiter.api.BeforeAll;
23+
import org.junit.jupiter.api.Test;
24+
import org.openehealth.ipf.commons.ihe.hl7v3.core.metadata.Device;
25+
import org.openehealth.ipf.commons.ihe.hl7v3.core.requests.PixV3QueryRequest;
26+
import org.openehealth.ipf.platform.camel.ihe.ws.StandardTestContainer;
27+
28+
import static org.junit.jupiter.api.Assertions.assertTrue;
29+
30+
public class TypeConversionTest extends StandardTestContainer {
31+
32+
@BeforeAll
33+
public static void beforeAll() {
34+
startServer(new CXFServlet(), "context.xml");
35+
}
36+
37+
@Test
38+
public void testPixV3QueryRequestTranslation() throws Exception {
39+
PixV3QueryRequest request = new PixV3QueryRequest();
40+
request.setReceiver(new Device());
41+
request.setSender(new Device());
42+
request.setQueryPatientId(new II("patient1", "3.14.15.926"));
43+
44+
Exchange exchange = new DefaultExchange(camelContext);
45+
exchange.getMessage().setBody(request);
46+
47+
String s = exchange.getMessage().getMandatoryBody(String.class);
48+
assertTrue(s.startsWith("<"));
49+
}
50+
51+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--
2+
~ Copyright 2024 the original author or authors.
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
<beans xmlns="http://www.springframework.org/schema/beans"
17+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xmlns:camel="http://camel.apache.org/schema/spring"
19+
xmlns:ipf="http://openehealth.org/schema/ipf-commons-core"
20+
xsi:schemaLocation="
21+
http://www.springframework.org/schema/beans
22+
http://www.springframework.org/schema/beans/spring-beans.xsd
23+
http://camel.apache.org/schema/spring
24+
http://camel.apache.org/schema/spring/camel-spring.xsd
25+
http://openehealth.org/schema/ipf-commons-core
26+
http://openehealth.org/schema/ipf-commons-core.xsd">
27+
28+
<import resource="classpath:META-INF/cxf/cxf.xml"/>
29+
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
30+
31+
<camel:camelContext id="camelContext">
32+
<camel:jmxAgent id="agent" disabled="false"/>
33+
</camel:camelContext>
34+
35+
<ipf:globalContext id="globalContext"/>
36+
37+
<bean id="auditContext" class="org.openehealth.ipf.commons.audit.DefaultAuditContext">
38+
<property name="auditEnabled" value="false"/>
39+
<property name="auditMessageQueue">
40+
<bean class="org.openehealth.ipf.commons.audit.queue.RecordingAuditMessageQueue"/>
41+
</property>
42+
</bean>
43+
44+
45+
</beans>

0 commit comments

Comments
 (0)