View Javadoc
1   /*
2    * Copyright 2014 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.tutorials.iheclient;
17  
18  import java.io.InputStream;
19  import java.nio.charset.Charset;
20  
21  import org.apache.commons.io.IOUtils;
22  import org.junit.Ignore;
23  import org.junit.Test;
24  import org.junit.runner.RunWith;
25  import org.springframework.beans.factory.annotation.Autowired;
26  import org.springframework.context.ApplicationContext;
27  import org.springframework.test.context.ContextConfiguration;
28  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
29  
30  import static org.junit.Assert.assertNotNull;
31  
32  @RunWith(SpringJUnit4ClassRunner.class)
33  @ContextConfiguration(locations = "classpath:context.xml")
34  public class IHEWebServiceClientTest {
35  
36      @Autowired
37      private IHEWebServiceClient iheClient;
38  
39      @Autowired
40      private ApplicationContext applicationContext;
41  
42      @Test
43      public void testSmoke() throws Exception {
44          assertNotNull(iheClient.getCamelContext());
45      }
46  
47      @Ignore
48      public void testIti47() throws Exception {
49          InputStream in = getClass().getResourceAsStream("/example-messages/PDQv3.xml");
50          String request = IOUtils.toString(in, Charset.defaultCharset());
51          String result = iheClient.iti47PatientDemographicsQuery(request, "localhost", 8080, "pix-xref-mgr/ws/iti47Service?secure=true", false);
52          System.out.println(result);
53      }
54  
55  }