Bladeren bron

Switched to Apache CXF for JAX-WS implementation (Metro is truly horrible).

Upgraded Spring, Hibernate, ActiveMQ etc to latest releases, cleaned up the pom a bit. Lived through the farce that is Java logging frameworks, once again...

Some restructuring of web service related classes.
peter_backlund 18 jaren geleden
bovenliggende
commit
619804c7fa

+ 57
- 116
dddsample/pom.xml Bestand weergeven

@@ -1,4 +1,5 @@
1
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2 3
   <modelVersion>4.0.0</modelVersion>
3 4
   <groupId>se.citerus</groupId>
4 5
   <artifactId>dddsample</artifactId>
@@ -15,7 +16,7 @@
15 16
       <url>scp://shell.sf.net/home/groups/d/dd/dddsample/htdocs</url>
16 17
     </site>
17 18
   </distributionManagement>
18
-  <ciManagement />
19
+  <ciManagement/>
19 20
   <repositories>
20 21
     <repository>
21 22
       <id>maven2-repository.dev.java.net</id>
@@ -91,7 +92,8 @@
91 92
     <url>http://ddd.sventon.org</url>
92 93
   </scm>
93 94
   <properties>
94
-    <spring.version>2.5.1</spring.version>
95
+    <spring.version>2.5.6</spring.version>
96
+    <cxf.version>2.1.3</cxf.version>
95 97
   </properties>
96 98
   <build>
97 99
     <plugins>
@@ -115,25 +117,34 @@
115 117
         </configuration>
116 118
       </plugin>
117 119
 
118
-      <!-- JAX-WS generation plugin -->
120
+      <!-- Generates WSDL from Java -->
119 121
       <plugin>
120
-        <groupId>org.codehaus.mojo</groupId>
121
-        <artifactId>jaxws-maven-plugin</artifactId>
122
-        <version>1.9</version>
122
+        <groupId>org.apache.cxf</groupId>
123
+        <artifactId>cxf-java2ws-plugin</artifactId>
124
+        <version>${cxf.version}</version>
125
+        <dependencies>
126
+          <dependency>
127
+            <groupId>org.apache.cxf</groupId>
128
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
129
+            <version>${cxf.version}</version>
130
+          </dependency>
131
+        </dependencies>
123 132
         <executions>
124 133
           <execution>
134
+            <phase>process-classes</phase>
135
+            <configuration>
136
+              <className>se.citerus.dddsample.interfaces.handling.ws.HandlingReportService</className>
137
+              <genWsdl>true</genWsdl>
138
+              <verbose>true</verbose>
139
+            </configuration>
125 140
             <goals>
126
-              <goal>wsgen</goal>
141
+              <goal>java2ws</goal>
127 142
             </goals>
128 143
           </execution>
129 144
         </executions>
130
-        <configuration>
131
-          <sei>se.citerus.dddsample.interfaces.handling.ws.HandlingReportServiceImpl</sei>
132
-          <genWsdl>true</genWsdl>
133
-        </configuration>
134 145
       </plugin>
135 146
 
136
-      <!-- Jar plugin for generation of WS Client classes -->
147
+      <!-- Package WS api classes -->
137 148
       <plugin>
138 149
         <artifactId>maven-jar-plugin</artifactId>
139 150
         <executions>
@@ -145,13 +156,14 @@
145 156
             <configuration>
146 157
               <classifier>ws-client</classifier>
147 158
               <includes>
148
-                <include>**/se/citerus/dddsample/application/ws/**</include>
159
+                <include>**/se/citerus/dddsample/interfaces/handling/ws/*</include>
149 160
               </includes>
150 161
             </configuration>
151 162
           </execution>
152 163
         </executions>
153 164
       </plugin>
154 165
 
166
+      <!-- Assembly -->
155 167
       <plugin>
156 168
         <artifactId>maven-assembly-plugin</artifactId>
157 169
         <configuration>
@@ -203,18 +215,30 @@
203 215
     </dependency>
204 216
     <dependency>
205 217
       <groupId>org.hibernate</groupId>
206
-      <artifactId>hibernate</artifactId>
207
-      <version>3.2.5.ga</version>
218
+      <artifactId>hibernate-core</artifactId>
219
+      <version>3.3.1.GA</version>
220
+      <!-- God, what is it with Java and logging frameworks... http://forum.hibernate.org/viewtopic.php?p=2401380 -->
221
+      <exclusions>
222
+        <exclusion>
223
+          <groupId>org.slf4j</groupId>
224
+          <artifactId>slf4j-api</artifactId>
225
+        </exclusion>
226
+      </exclusions>
208 227
     </dependency>
209 228
     <dependency>
210
-      <groupId>org.hibernate</groupId>
211
-      <artifactId>hibernate-annotations</artifactId>
212
-      <version>3.3.0.ga</version>
229
+      <groupId>org.slf4j</groupId>
230
+      <artifactId>slf4j-log4j12</artifactId>
231
+      <version>1.5.6</version>
232
+    </dependency>
233
+    <dependency>
234
+      <groupId>javassist</groupId>
235
+      <artifactId>javassist</artifactId>
236
+      <version>3.8.0.GA</version>
213 237
     </dependency>
214 238
     <dependency>
215 239
       <groupId>org.hibernate</groupId>
216
-      <artifactId>hibernate-commons-annotations</artifactId>
217
-      <version>3.3.0.ga</version>
240
+      <artifactId>hibernate-annotations</artifactId>
241
+      <version>3.4.0.GA</version>
218 242
     </dependency>
219 243
     <dependency>
220 244
       <groupId>commons-lang</groupId>
@@ -227,21 +251,6 @@
227 251
       <version>1.3.1</version>
228 252
     </dependency>
229 253
     <dependency>
230
-      <groupId>commons-logging</groupId>
231
-      <artifactId>commons-logging</artifactId>
232
-      <version>1.1</version>
233
-      <exclusions>
234
-        <exclusion>
235
-          <groupId>avalon-framework</groupId>
236
-          <artifactId>avalon-framework</artifactId>
237
-        </exclusion>
238
-        <exclusion>
239
-          <groupId>logkit</groupId>
240
-          <artifactId>logkit</artifactId>
241
-        </exclusion>
242
-      </exclusions>
243
-    </dependency>
244
-    <dependency>
245 254
       <groupId>commons-dbcp</groupId>
246 255
       <artifactId>commons-dbcp</artifactId>
247 256
       <version>1.2.2</version>
@@ -276,23 +285,12 @@
276 285
     <dependency>
277 286
       <groupId>org.apache.activemq</groupId>
278 287
       <artifactId>activemq-core</artifactId>
279
-      <version>5.0.0</version>
280
-      <exclusions>
281
-        <!--
282
-          This is a snapshot dependency, with no published pom.
283
-          It does not appear to be needed either:
284
-          
285
-          http://mail-archives.apache.org/mod_mbox/activemq-commits/200610.mbox/%3C20061005025744.0C6591A981A@eris.apache.org%3E
286
-        -->
287
-        <exclusion>
288
-          <groupId>org.apache.activemq</groupId>
289
-          <artifactId>activeio-core</artifactId>
290
-        </exclusion>
291
-        <exclusion>
292
-          <groupId>javax.xml</groupId>
293
-          <artifactId>jaxb-api</artifactId>
294
-        </exclusion>
295
-      </exclusions>
288
+      <version>5.2.0</version>
289
+    </dependency>
290
+    <dependency>
291
+      <groupId>org.apache.xbean</groupId>
292
+      <artifactId>xbean-spring</artifactId>
293
+      <version>3.4.3</version>
296 294
     </dependency>
297 295
     <dependency>
298 296
       <groupId>org.easymock</groupId>
@@ -300,72 +298,15 @@
300 298
       <version>2.3</version>
301 299
       <scope>test</scope>
302 300
     </dependency>
303
-
304
-    <!-- JAX-WS integration with Spring. Lots of broken pom files unfortunately,
305
-      so we need a few excluded-and-overridden dependencies.
306
-      This problem will mostly go away when we move to Java 6.
307
-
308
-      javax.activation is excluded because of class loading issues with Jetty:
309
-      http://jira.codehaus.org/browse/JETTY-420
310
-      -->
311
-    <dependency>
312
-      <groupId>org.jvnet.jax-ws-commons.spring</groupId>
313
-      <artifactId>jaxws-spring</artifactId>
314
-      <version>1.8</version>
315
-      <exclusions>
316
-        <exclusion>
317
-          <groupId>org.springframework</groupId>
318
-          <artifactId>spring</artifactId>
319
-        </exclusion>
320
-        <exclusion>
321
-          <groupId>com.sun.xml.stream.buffer</groupId>
322
-          <artifactId>streambuffer</artifactId>
323
-        </exclusion>
324
-        <exclusion>
325
-          <groupId>org.jvnet.staxex</groupId>
326
-          <artifactId>stax-ex</artifactId>
327
-        </exclusion>
328
-        <exclusion>
329
-          <groupId>javax.activation</groupId>
330
-          <artifactId>activation</artifactId>
331
-        </exclusion>
332
-      </exclusions>
333
-    </dependency>
334
-    <dependency>
335
-      <groupId>org.jvnet.staxex</groupId>
336
-      <artifactId>stax-ex</artifactId>
337
-      <version>1.2</version>
338
-      <scope>runtime</scope>
339
-      <exclusions>
340
-        <exclusion>
341
-          <groupId>javax.activation</groupId>
342
-          <artifactId>activation</artifactId>
343
-        </exclusion>
344
-      </exclusions>
345
-    </dependency>
346 301
     <dependency>
347
-      <groupId>com.sun.xml.stream.buffer</groupId>
348
-      <artifactId>streambuffer</artifactId>
349
-      <version>0.7</version>
350
-      <scope>runtime</scope>
351
-      <exclusions>
352
-        <exclusion>
353
-          <groupId>javax.activation</groupId>
354
-          <artifactId>activation</artifactId>
355
-        </exclusion>
356
-      </exclusions>
302
+      <groupId>org.apache.cxf</groupId>
303
+      <artifactId>cxf-rt-frontend-jaxws</artifactId>
304
+      <version>${cxf.version}</version>
357 305
     </dependency>
358 306
     <dependency>
359
-      <groupId>com.sun.xml.ws</groupId>
360
-      <artifactId>jaxws-rt</artifactId>
361
-      <version>2.1.3</version>
362
-      <scope>runtime</scope>
363
-    </dependency>
364
-    <dependency>
365
-      <groupId>com.sun.istack</groupId>
366
-      <artifactId>istack-commons-runtime</artifactId>
367
-      <version>1.0</version>
368
-      <scope>runtime</scope>
307
+      <groupId>org.apache.cxf</groupId>
308
+      <artifactId>cxf-rt-transports-http</artifactId>
309
+      <version>${cxf.version}</version>
369 310
     </dependency>
370 311
   </dependencies>
371 312
 

+ 4
- 3
dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/RegistrationParser.java Bestand weergeven

@@ -9,7 +9,8 @@ import se.citerus.dddsample.domain.model.cargo.TrackingId;
9 9
 import se.citerus.dddsample.domain.model.carrier.VoyageNumber;
10 10
 import se.citerus.dddsample.domain.model.handling.HandlingEvent;
11 11
 import se.citerus.dddsample.domain.model.location.UnLocode;
12
-import se.citerus.dddsample.interfaces.handling.ws.HandlingReportServiceImpl;
12
+import se.citerus.dddsample.interfaces.handling.ws.HandlingReportErrors;
13
+import se.citerus.dddsample.interfaces.handling.ws.impl.HandlingReportServiceImpl;
13 14
 
14 15
 import java.text.ParseException;
15 16
 import java.text.SimpleDateFormat;
@@ -24,7 +25,7 @@ public class RegistrationParser {
24 25
   
25 26
   private static final Log logger = LogFactory.getLog(RegistrationParser.class);
26 27
 
27
-  public void convertAndSend(String completionTime, String trackingId, String voyageNumberString, String unlocode, String eventType) throws RegistrationFailure {
28
+  public void convertAndSend(String completionTime, String trackingId, String voyageNumberString, String unlocode, String eventType) throws HandlingReportErrors {
28 29
     final List<String> errors = new ArrayList<String>();
29 30
 
30 31
     final Date date = parseDate(completionTime, errors);
@@ -38,7 +39,7 @@ public class RegistrationParser {
38 39
       systemEvents.receivedHandlingEventRegistrationAttempt(attempt);
39 40
     } else {
40 41
       logger.warn("Handling event registration attempt failed: " + errors);
41
-      throw new RegistrationFailure(errors);
42
+      throw new HandlingReportErrors(errors);
42 43
     }
43 44
   }
44 45
 

dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/file/PartialRegistrationFailureException.java → dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/file/PartialRegistrationFailure.java Bestand weergeven

@@ -2,11 +2,11 @@ package se.citerus.dddsample.interfaces.handling.file;
2 2
 
3 3
 import java.util.List;
4 4
 
5
-public class PartialRegistrationFailureException extends Exception {
5
+public class PartialRegistrationFailure extends Exception {
6 6
 
7 7
   private final List<String> rejectedLines;
8 8
 
9
-  public PartialRegistrationFailureException(List<String> rejectedLines) {
9
+  public PartialRegistrationFailure(List<String> rejectedLines) {
10 10
     this.rejectedLines = rejectedLines;
11 11
   }
12 12
 

+ 3
- 3
dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/file/UploadDirectoryScanner.java Bestand weergeven

@@ -4,8 +4,8 @@ import org.apache.commons.io.FileUtils;
4 4
 import org.apache.commons.logging.Log;
5 5
 import org.apache.commons.logging.LogFactory;
6 6
 import org.springframework.beans.factory.InitializingBean;
7
-import se.citerus.dddsample.interfaces.handling.RegistrationFailure;
8 7
 import se.citerus.dddsample.interfaces.handling.RegistrationParser;
8
+import se.citerus.dddsample.interfaces.handling.ws.HandlingReportErrors;
9 9
 
10 10
 import java.io.File;
11 11
 import java.io.IOException;
@@ -42,7 +42,7 @@ public class UploadDirectoryScanner extends TimerTask implements InitializingBea
42 42
     }
43 43
   }
44 44
 
45
-  private void parse(final File file) throws IOException, RegistrationFailure {
45
+  private void parse(final File file) throws IOException, HandlingReportErrors {
46 46
     final List<String> lines = FileUtils.readLines(file);
47 47
     final List<String> rejectedLines = new ArrayList<String>();
48 48
     for (String line : lines) {
@@ -68,7 +68,7 @@ public class UploadDirectoryScanner extends TimerTask implements InitializingBea
68 68
     );
69 69
   }
70 70
 
71
-  private void parseLine(final String line) throws RegistrationFailure {
71
+  private void parseLine(final String line) throws HandlingReportErrors {
72 72
     final String[] columns = line.split("\t");
73 73
     if (columns.length == 5) {
74 74
       registrationParser.convertAndSend(

+ 9
- 10
dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReport.java Bestand weergeven

@@ -16,25 +16,16 @@ import javax.xml.datatype.XMLGregorianCalendar;
16 16
  */
17 17
 public class HandlingReport {
18 18
 
19
-  @XmlElement(required = true)
20 19
   private String[] trackingIds;
21
-
22
-  @XmlElement(required = true)
23 20
   private String unLocode;
24
-
25
-  @XmlElement(required = false)
26 21
   private String voyageNumber;
27
-
28
-  @XmlSchemaType(name="dateTime")
29
-  @XmlElement(required = true)
30 22
   private XMLGregorianCalendar completionTime;
31
-
32
-  @XmlElement(required = true)
33 23
   private String type;
34 24
 
35 25
   /**
36 26
    * @return tracking ids of cargos that have been handled (the same way)
37 27
    */
28
+  @XmlElement(required = true)
38 29
   public String[] getTrackingIds() {
39 30
     return trackingIds;
40 31
   }
@@ -46,6 +37,7 @@ public class HandlingReport {
46 37
   /**
47 38
    * @return United Nations Location Code for the location where the event occured
48 39
    */
40
+  @XmlElement(required = true)
49 41
   public String getUnLocode() {
50 42
     return unLocode;
51 43
   }
@@ -59,6 +51,8 @@ public class HandlingReport {
59 51
    * 
60 52
    * @return voyage number, if applicable
61 53
    */
54
+
55
+  @XmlElement(required = false)
62 56
   public String getVoyageNumber() {
63 57
     return voyageNumber;
64 58
   }
@@ -70,6 +64,9 @@ public class HandlingReport {
70 64
   /**
71 65
    * @return time when event occured, for example a the loading of cargo was completed
72 66
    */
67
+
68
+  @XmlSchemaType(name="dateTime")
69
+  @XmlElement(required = true)
73 70
   public XMLGregorianCalendar getCompletionTime() {
74 71
     return completionTime;
75 72
   }
@@ -81,6 +78,8 @@ public class HandlingReport {
81 78
   /**
82 79
    * @return type of event
83 80
    */
81
+
82
+  @XmlElement(required = true)
84 83
   public String getType() {
85 84
     return type;
86 85
   }

dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/RegistrationFailure.java → dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportErrors.java Bestand weergeven

@@ -1,20 +1,23 @@
1
-package se.citerus.dddsample.interfaces.handling;
1
+package se.citerus.dddsample.interfaces.handling.ws;
2 2
 
3
+import javax.xml.bind.annotation.XmlElement;
3 4
 import java.util.Arrays;
4 5
 import java.util.List;
5 6
 
6
-public class RegistrationFailure extends Exception {
7
+public class HandlingReportErrors extends Exception {
7 8
   private final String[] errors;
8 9
 
9
-  public RegistrationFailure(final List<String> errors) {
10
+  public HandlingReportErrors(final List<String> errors) {
10 11
     this.errors = errors.toArray(new String[errors.size()]);
11 12
   }
12 13
 
14
+  @XmlElement(required = true)
13 15
   public String[] getErrors() {
14 16
     return errors;
15 17
   }
16 18
 
17 19
   @Override
20
+  @XmlElement(required = true)
18 21
   public String getMessage() {
19 22
     return "Reistration failure: " + Arrays.toString(errors);
20 23
   }

+ 2
- 4
dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportService.java Bestand weergeven

@@ -1,7 +1,5 @@
1 1
 package se.citerus.dddsample.interfaces.handling.ws;
2 2
 
3
-import se.citerus.dddsample.interfaces.handling.RegistrationFailure;
4
-
5 3
 import javax.jws.WebService;
6 4
 
7 5
 /**
@@ -14,8 +12,8 @@ public interface HandlingReportService {
14 12
    * Submits a report of handled cargos.
15 13
    *
16 14
    * @param handlingReport
17
-   * @throws se.citerus.dddsample.interfaces.handling.RegistrationFailure
15
+   * @throws HandlingReportErrors
18 16
    */
19
-  void submitReport(HandlingReport handlingReport) throws RegistrationFailure;
17
+  void submitReport(HandlingReport handlingReport) throws HandlingReportErrors;
20 18
 
21 19
 }

dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportServiceImpl.java → dddsample/src/main/java/se/citerus/dddsample/interfaces/handling/ws/impl/HandlingReportServiceImpl.java Bestand weergeven

@@ -1,9 +1,11 @@
1
-package se.citerus.dddsample.interfaces.handling.ws;
1
+package se.citerus.dddsample.interfaces.handling.ws.impl;
2 2
 
3 3
 import org.apache.commons.logging.Log;
4 4
 import org.apache.commons.logging.LogFactory;
5
-import se.citerus.dddsample.interfaces.handling.RegistrationFailure;
6 5
 import se.citerus.dddsample.interfaces.handling.RegistrationParser;
6
+import se.citerus.dddsample.interfaces.handling.ws.HandlingReport;
7
+import se.citerus.dddsample.interfaces.handling.ws.HandlingReportErrors;
8
+import se.citerus.dddsample.interfaces.handling.ws.HandlingReportService;
7 9
 
8 10
 import javax.jws.WebService;
9 11
 import java.util.Date;
@@ -23,7 +25,7 @@ public class HandlingReportServiceImpl implements HandlingReportService {
23 25
   public static final String ISO_8601_FORMAT = "yyyy-mm-dd HH:MM:SS.SSS";
24 26
 
25 27
   @Override
26
-  public void submitReport(HandlingReport handlingReport) throws RegistrationFailure {
28
+  public void submitReport(HandlingReport handlingReport) throws HandlingReportErrors {
27 29
     Date date = handlingReport.getCompletionTime().toGregorianCalendar().getTime();
28 30
     for (String trackingId : handlingReport.getTrackingIds()) {
29 31
       registrationParser.convertAndSend(

+ 8
- 8
dddsample/src/main/resources/context-messaging-jms.xml Bestand weergeven

@@ -2,25 +2,25 @@
2 2
 
3 3
 <beans xmlns="http://www.springframework.org/schema/beans"
4 4
        xmlns:jms="http://www.springframework.org/schema/jms"
5
-       xmlns:amq="http://activemq.org/config/1.0"
5
+       xmlns:amq="http://activemq.apache.org/schema/core"
6 6
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7 7
        xsi:schemaLocation="
8
-        http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd
8
+        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd
9 9
         http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
10 10
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
11 11
 
12 12
 
13 13
   <amq:connectionFactory id="jmsConnectionFactory" brokerURL="vm://localhost?broker.persistent=false"/>
14 14
 
15
-  <amq:topic id="cargoHandledTopic" name="CargoHandledTopic"/>
16
-  <amq:topic id="misdirectedCargoTopic" name="MisdirectedCargoTopic"/>
17
-  <amq:topic id="deliveredCargoTopic" name="DeliveredCargoTopic"/>
18
-  <amq:queue id="handlingEventRegistrationAttemptQueue" name="HandlingEventRegistrationAttemptQueue"/>
19
-  <amq:queue id="rejectedRegistrationAttemptsQueue" name="RejectedRegistrationAttemptsQueue"/>
15
+  <amq:topic id="cargoHandledTopic" name="CargoHandledTopic" physicalName="CargoHandledTopic"/>
16
+  <amq:topic id="misdirectedCargoTopic" name="MisdirectedCargoTopic" physicalName="MisdirectedCargoTopic"/>
17
+  <amq:topic id="deliveredCargoTopic" name="DeliveredCargoTopic" physicalName="DeliveredCargoTopic"/>
18
+  <amq:queue id="handlingEventRegistrationAttemptQueue" name="HandlingEventRegistrationAttemptQueue" physicalName="HandlingEventRegistrationAttemptQueue"/>
19
+  <amq:queue id="rejectedRegistrationAttemptsQueue" name="RejectedRegistrationAttemptsQueue" physicalName="RejectedRegistrationAttemptsQueue"/>
20 20
 
21 21
   <jms:listener-container connection-factory="jmsConnectionFactory">
22 22
     <jms:listener destination="cargoHandledTopic" ref="cargoHandledConsumer" />
23
-    <!-- TODO subscribers
23
+    <!-- TODO subscribers for these topics/queues
24 24
     <jms:listener destination="misdirectedCargoTopic" ref="TODO"/>
25 25
     <jms:listener destination="deliveredCargoTopic" ref="TODO"/>
26 26
     -->

+ 10
- 17
dddsample/src/main/resources/context-remote.xml Bestand weergeven

@@ -1,27 +1,20 @@
1 1
 <?xml version="1.0"?>
2 2
 
3 3
 <beans xmlns="http://www.springframework.org/schema/beans"
4
-       xmlns:ws="http://jax-ws.dev.java.net/spring/core"
5
-       xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
6 4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7
-       xsi:schemaLocation="
8
-        http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd
9
-        http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd
10
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
5
+	     xmlns:jaxws="http://cxf.apache.org/jaxws"
6
+       xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
7
+                           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
8
+
9
+  <import resource="classpath:META-INF/cxf/cxf.xml"/>
10
+  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
11
+  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
11 12
 
12 13
   <!-- Handling event registration web service -->
13 14
 
14
-  <wss:bindings id="jax-ws.http">
15
-    <wss:bindings>
16
-      <wss:binding url="/ws/RegisterEvent">
17
-        <wss:service>
18
-          <ws:service bean="#handlingEventServiceEndpoint"/>
19
-        </wss:service>
20
-      </wss:binding>
21
-    </wss:bindings>
22
-  </wss:bindings>
23
-
24
-  <bean id="handlingEventServiceEndpoint" class="se.citerus.dddsample.interfaces.handling.ws.HandlingReportServiceImpl">
15
+  <jaxws:endpoint id="jax-ws.http" implementor="#handlingReportService" address="/ws/RegisterEvent"/>
16
+
17
+  <bean id="handlingReportService" class="se.citerus.dddsample.interfaces.handling.ws.impl.HandlingReportServiceImpl">
25 18
     <property name="registrationParser" ref="registrationParser"/>
26 19
   </bean>
27 20
 

+ 3
- 3
dddsample/src/main/webapp/WEB-INF/web.xml Bestand weergeven

@@ -38,12 +38,12 @@
38 38
   </servlet-mapping>
39 39
 
40 40
   <servlet>
41
-    <servlet-name>jaxws-servlet</servlet-name>
42
-    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
41
+    <servlet-name>jaxws</servlet-name>
42
+    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
43 43
   </servlet>
44 44
 
45 45
   <servlet-mapping>
46
-    <servlet-name>jaxws-servlet</servlet-name>
46
+    <servlet-name>jaxws</servlet-name>
47 47
     <url-pattern>/ws/*</url-pattern>
48 48
   </servlet-mapping>
49 49
 

+ 9
- 3
dddsample/src/test/java/se/citerus/dddsample/infrastructure/persistence/hibernate/CargoRepositoryTest.java Bestand weergeven

@@ -3,7 +3,6 @@ package se.citerus.dddsample.infrastructure.persistence.hibernate;
3 3
 import se.citerus.dddsample.application.util.SampleDataGenerator;
4 4
 import se.citerus.dddsample.domain.model.cargo.*;
5 5
 import static se.citerus.dddsample.domain.model.carrier.SampleVoyages.CM004;
6
-import static se.citerus.dddsample.domain.model.carrier.SampleVoyages.HELSINKI_TO_HONGKONG;
7 6
 import se.citerus.dddsample.domain.model.carrier.Voyage;
8 7
 import se.citerus.dddsample.domain.model.carrier.VoyageNumber;
9 8
 import se.citerus.dddsample.domain.model.carrier.VoyageRepository;
@@ -53,7 +52,14 @@ public class CargoRepositoryTest extends AbstractRepositoryTest {
53 52
 
54 53
     HandlingEvent secondEvent = events.get(1);
55 54
 
56
-    assertHandlingEvent(cargo, secondEvent, LOAD, HONGKONG, 150, 110, HELSINKI_TO_HONGKONG);
55
+    Voyage hongkongMelbourneTokyoAndBack = new Voyage.Builder(
56
+      new VoyageNumber("0303"), HONGKONG).
57
+      addMovement(MELBOURNE, new Date(), new Date()).
58
+      addMovement(TOKYO, new Date(), new Date()).
59
+      addMovement(HONGKONG, new Date(), new Date()).
60
+      build();
61
+    
62
+    assertHandlingEvent(cargo, secondEvent, LOAD, HONGKONG, 150, 110, hongkongMelbourneTokyoAndBack);
57 63
 
58 64
     List<Leg> legs = cargo.itinerary().legs();
59 65
     assertEquals(3, legs.size());
@@ -77,7 +83,7 @@ public class CargoRepositoryTest extends AbstractRepositoryTest {
77 83
 
78 84
     Date expectedRegistrationTime = SampleDataGenerator.offset(registrationTimeMs);
79 85
     assertEquals(expectedRegistrationTime, event.registrationTime());
80
-    
86
+
81 87
     assertEquals(voyage, event.voyage());
82 88
     assertEquals(cargo, event.cargo());
83 89
   }

+ 0
- 1
dddsample/src/test/resources/hibernate.properties Bestand weergeven

@@ -1 +0,0 @@
1
-hibernate.hbm2ddl.auto=create-drop