You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/10/11 18:40:30 UTC
svn commit: r1181881 [2/2] - in /cxf/trunk/services/wsn/wsn-core: ./
src/main/java/org/apache/cxf/wsn/ src/main/java/org/apache/cxf/wsn/client/
src/main/java/org/apache/cxf/wsn/jaxws/
src/main/java/org/apache/cxf/wsn/jms/ src/main/java/org/apache/cxf/w...
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPublisher.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPublisher.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPublisher.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPublisher.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.jms;
@@ -114,8 +116,9 @@ public abstract class JmsPublisher exten
}
@Override
- protected void validatePublisher(RegisterPublisher registerPublisherRequest) throws InvalidTopicExpressionFault,
- PublisherRegistrationFailedFault, PublisherRegistrationRejectedFault, ResourceUnknownFault,
+ protected void validatePublisher(RegisterPublisher registerPublisherRequest)
+ throws InvalidTopicExpressionFault, PublisherRegistrationFailedFault,
+ PublisherRegistrationRejectedFault, ResourceUnknownFault,
TopicNotSupportedFault {
super.validatePublisher(registerPublisherRequest);
try {
@@ -133,7 +136,8 @@ public abstract class JmsPublisher exten
producers = new HashMap<Destination, Object>();
advisories = new ArrayList<ConsumerEventSource>();
for (TopicExpressionType topic : this.topic) {
- ConsumerEventSource advisory = new ConsumerEventSource(connection, topicConverter.toActiveMQTopic(topic));
+ ConsumerEventSource advisory
+ = new ConsumerEventSource(connection, topicConverter.toActiveMQTopic(topic));
advisory.setConsumerListener(this);
advisory.start();
advisories.add(advisory);
@@ -165,7 +169,7 @@ public abstract class JmsPublisher exten
if (event.getConsumerCount() > 0) {
if (producer == null) {
// start subscription
- producer = startSubscription(topicConverter.toTopicExpression((Topic) event.getDestination()));
+ producer = startSubscription(topicConverter.toTopicExpression((Topic)event.getDestination()));
producers.put(event.getDestination(), producer);
}
} else {
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPullPoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPullPoint.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPullPoint.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsPullPoint.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.jms;
@@ -102,8 +104,8 @@ public class JmsPullPoint extends Abstra
}
@Override
- protected synchronized List<NotificationMessageHolderType> getMessages(int max) throws ResourceUnknownFault,
- UnableToGetMessagesFault {
+ protected synchronized List<NotificationMessageHolderType> getMessages(int max)
+ throws ResourceUnknownFault, UnableToGetMessagesFault {
try {
if (max == 0) {
max = 256;
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsSubscription.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.jms;
@@ -36,6 +38,9 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
import org.apache.cxf.wsn.AbstractSubscription;
import org.oasis_open.docs.wsn.b_2.InvalidTopicExpressionFaultType;
import org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType;
@@ -62,8 +67,6 @@ import org.oasis_open.docs.wsn.bw_2.Unre
import org.oasis_open.docs.wsn.bw_2.UnsupportedPolicyRequestFault;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
public abstract class JmsSubscription extends AbstractSubscription implements MessageListener {
@@ -181,8 +184,10 @@ public abstract class JmsSubscription ex
public void onMessage(Message jmsMessage) {
try {
TextMessage text = (TextMessage) jmsMessage;
- Notify notify = (Notify) jaxbContext.createUnmarshaller().unmarshal(new StringReader(text.getText()));
- for (Iterator<NotificationMessageHolderType> ith = notify.getNotificationMessage().iterator(); ith.hasNext();) {
+ Notify notify = (Notify) jaxbContext.createUnmarshaller()
+ .unmarshal(new StringReader(text.getText()));
+ for (Iterator<NotificationMessageHolderType> ith = notify.getNotificationMessage().iterator();
+ ith.hasNext();) {
NotificationMessageHolderType h = ith.next();
Object content = h.getMessage().getAny();
if (!(content instanceof Element)) {
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsTopicExpressionConverter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsTopicExpressionConverter.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsTopicExpressionConverter.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/jms/JmsTopicExpressionConverter.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.jms;
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/DOMUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/DOMUtil.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/DOMUtil.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/DOMUtil.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.util;
@@ -31,8 +33,6 @@ import javax.xml.transform.TransformerFa
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -40,6 +40,10 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* <p>
* A collection of W3C DOM helper methods.
@@ -203,7 +207,8 @@ public final class DOMUtil {
answer = element.getAttribute(attributeName);
} catch (Exception e) {
if (logger.isTraceEnabled()) {
- logger.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element + ". Cause: " + e, e);
+ logger.trace("Caught exception looking up attribute: " + attributeName
+ + " on element: " + element + ". Cause: " + e, e);
}
}
if (answer == null || answer.length() == 0) {
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java Tue Oct 11 16:40:29 2011
@@ -1,25 +1,23 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.util;
-/*
- * Copied from
- * http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java
- */
import java.net.InetAddress;
import java.net.ServerSocket;
@@ -75,7 +73,9 @@ public class IdGenerator {
try {
hostName = InetAddress.getLocalHost().getHostAddress();
ServerSocket ss = new ServerSocket(0);
- stub = hostName + "-" + Long.toHexString(ss.getLocalPort() ^ System.currentTimeMillis()) + "-";
+ stub = hostName + "-"
+ + Long.toHexString(ss.getLocalPort() ^ System.currentTimeMillis())
+ + "-";
Thread.sleep(100);
ss.close();
} catch (Exception ioe) {
Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn.util;
@@ -31,7 +33,8 @@ public abstract class WSNHelper {
public static <T> T getPort(EndpointReference ref, Class<T> serviceInterface) {
if (!(ref instanceof W3CEndpointReference)) {
- throw new IllegalArgumentException("Unsupported endpoint reference: " + (ref != null ? ref.toString() : "null"));
+ throw new IllegalArgumentException("Unsupported endpoint reference: "
+ + (ref != null ? ref.toString() : "null"));
}
W3CEndpointReference w3cEpr = (W3CEndpointReference) ref;
String address = getWSAAddress(w3cEpr);
Modified: cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/CxfTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/CxfTest.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/CxfTest.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/CxfTest.java Tue Oct 11 16:40:29 2011
@@ -1,27 +1,27 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn;
public class CxfTest extends WsnBrokerTest {
- @Override
- public void setUp() throws Exception {
- Thread.currentThread().setContextClassLoader(new FakeClassLoader("org.apache.cxf.jaxws22.spi.ProviderImpl"));
- super.setUp();
+ protected String getProviderImpl() {
+ return "org.apache.cxf.jaxws.spi.ProviderImpl";
}
}
Modified: cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/RiTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/RiTest.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/RiTest.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/RiTest.java Tue Oct 11 16:40:29 2011
@@ -1,26 +1,26 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn;
public class RiTest extends WsnBrokerTest {
- @Override
- public void setUp() throws Exception {
- Thread.currentThread().setContextClassLoader(new FakeClassLoader("com.sun.xml.ws.spi.ProviderImpl"));
- super.setUp();
+ protected String getProviderImpl() {
+ return "com.sun.xml.ws.spi.ProviderImpl";
}
}
Modified: cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java?rev=1181881&r1=1181880&r2=1181881&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java Tue Oct 11 16:40:29 2011
@@ -1,18 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.cxf.wsn;
@@ -55,28 +57,37 @@ public abstract class WsnBrokerTest exte
private int port1;
private int port2;
+
+ protected abstract String getProviderImpl();
+
@Override
public void setUp() throws Exception {
+ String impl = getProviderImpl();
+ Thread.currentThread()
+ .setContextClassLoader(new FakeClassLoader(impl));
+
+ System.setProperty("javax.xml.ws.spi.Provider", impl);
port1 = getFreePort();
port2 = getFreePort();
- System.setProperty("java.util.logging.config.file", getClass().getClassLoader().getResource("logging.properties").getPath());
+ System.setProperty("java.util.logging.config.file",
+ getClass().getClassLoader().getResource("logging.properties").getPath());
java.util.logging.LogManager.getLogManager().readConfiguration();
activemq = new ActiveMQConnectionFactory("vm:(broker:(tcp://localhost:6000)?persistent=false)");
notificationBrokerServer = new JaxwsNotificationBroker("WSNotificationBroker", activemq);
- notificationBrokerServer.setAddress("http://0.0.0.0:" + port1 + "/wsn/NotificationBroker");
+ notificationBrokerServer.setAddress("http://localhost:" + port1 + "/wsn/NotificationBroker");
notificationBrokerServer.init();
createPullPointServer = new JaxwsCreatePullPoint("CreatePullPoint", activemq);
- createPullPointServer.setAddress("http://0.0.0.0:" + port1 + "/wsn/CreatePullPoint");
+ createPullPointServer.setAddress("http://localhost:" + port1 + "/wsn/CreatePullPoint");
createPullPointServer.init();
- notificationBroker = new NotificationBroker("http://0.0.0.0:" + port1 + "/wsn/NotificationBroker");
- createPullPoint = new CreatePullPoint("http://0.0.0.0:" + port1 + "/wsn/CreatePullPoint");
+ notificationBroker = new NotificationBroker("http://localhost:" + port1 + "/wsn/NotificationBroker");
+ createPullPoint = new CreatePullPoint("http://localhost:" + port1 + "/wsn/CreatePullPoint");
}
private int getFreePort() throws IOException {
@@ -90,21 +101,25 @@ public abstract class WsnBrokerTest exte
public void tearDown() throws Exception {
notificationBrokerServer.destroy();
createPullPointServer.destroy();
+ System.clearProperty("javax.xml.ws.spi.Provider");
}
public void testBroker() throws Exception {
TestConsumer callback = new TestConsumer();
- Consumer consumer = new Consumer(callback, "http://0.0.0.0:" + port2 + "/test/consumer");
+ Consumer consumer = new Consumer(callback, "http://localhost:" + port2 + "/test/consumer");
Subscription subscription = notificationBroker.subscribe(consumer, "myTopic");
synchronized (callback.notifications) {
- notificationBroker.notify("myTopic", new JAXBElement(new QName("urn:test:org", "foo"), String.class, "bar"));
+ notificationBroker.notify("myTopic",
+ new JAXBElement<String>(new QName("urn:test:org", "foo"),
+ String.class, "bar"));
callback.notifications.wait(1000000);
}
assertEquals(1, callback.notifications.size());
NotificationMessageHolderType message = callback.notifications.get(0);
- assertEquals(WSNHelper.getWSAAddress(subscription.getEpr()), WSNHelper.getWSAAddress(message.getSubscriptionReference()));
+ assertEquals(WSNHelper.getWSAAddress(subscription.getEpr()),
+ WSNHelper.getWSAAddress(message.getSubscriptionReference()));
subscription.unsubscribe();
consumer.stop();
@@ -113,14 +128,16 @@ public abstract class WsnBrokerTest exte
public void testPullPoint() throws Exception {
PullPoint pullPoint = createPullPoint.create();
Subscription subscription = notificationBroker.subscribe(pullPoint, "myTopic");
- notificationBroker.notify("myTopic", new JAXBElement(new QName("urn:test:org", "foo"), String.class, "bar"));
+ notificationBroker.notify("myTopic",
+ new JAXBElement<String>(new QName("urn:test:org", "foo"),
+ String.class, "bar"));
boolean received = false;
for (int i = 0; i < 50; i++) {
List<NotificationMessageHolderType> messages = pullPoint.getMessages(10);
if (!messages.isEmpty()) {
received = true;
- break;
+ break;
}
Thread.sleep(100);
}
@@ -132,22 +149,26 @@ public abstract class WsnBrokerTest exte
public void testPublisher() throws Exception {
TestConsumer consumerCallback = new TestConsumer();
- Consumer consumer = new Consumer(consumerCallback, "http://0.0.0.0:" + port2 + "/test/consumer");
+ Consumer consumer = new Consumer(consumerCallback, "http://localhost:" + port2 + "/test/consumer");
Subscription subscription = notificationBroker.subscribe(consumer, "myTopic");
PublisherCallback publisherCallback = new PublisherCallback();
- Publisher publisher = new Publisher(publisherCallback, "http://0.0.0.0:" + port2 + "/test/publisher");
+ Publisher publisher = new Publisher(publisherCallback, "http://localhost:" + port2 + "/test/publisher");
Registration registration = notificationBroker.registerPublisher(publisher, "myTopic");
synchronized (consumerCallback.notifications) {
- notificationBroker.notify(publisher, "myTopic", new JAXBElement(new QName("urn:test:org", "foo"), String.class, "bar"));
+ notificationBroker.notify(publisher, "myTopic",
+ new JAXBElement<String>(new QName("urn:test:org", "foo"),
+ String.class, "bar"));
consumerCallback.notifications.wait(1000000);
}
assertEquals(1, consumerCallback.notifications.size());
NotificationMessageHolderType message = consumerCallback.notifications.get(0);
- assertEquals(WSNHelper.getWSAAddress(subscription.getEpr()), WSNHelper.getWSAAddress(message.getSubscriptionReference()));
- assertEquals(WSNHelper.getWSAAddress(publisher.getEpr()), WSNHelper.getWSAAddress(message.getProducerReference()));
+ assertEquals(WSNHelper.getWSAAddress(subscription.getEpr()),
+ WSNHelper.getWSAAddress(message.getSubscriptionReference()));
+ assertEquals(WSNHelper.getWSAAddress(publisher.getEpr()),
+ WSNHelper.getWSAAddress(message.getProducerReference()));
subscription.unsubscribe();
registration.destroy();
@@ -157,17 +178,21 @@ public abstract class WsnBrokerTest exte
public void testPublisherOnDemand() throws Exception {
TestConsumer consumerCallback = new TestConsumer();
- Consumer consumer = new Consumer(consumerCallback, "http://0.0.0.0:" + port2 + "/test/consumer");
+ Consumer consumer = new Consumer(consumerCallback, "http://localhost:" + port2 + "/test/consumer");
PublisherCallback publisherCallback = new PublisherCallback();
- Publisher publisher = new Publisher(publisherCallback, "http://0.0.0.0:" + port2 + "/test/publisher");
- Registration registration = notificationBroker.registerPublisher(publisher, Arrays.asList("myTopic1", "myTopic2"), true);
+ Publisher publisher = new Publisher(publisherCallback, "http://localhost:" + port2 + "/test/publisher");
+ Registration registration = notificationBroker.registerPublisher(publisher,
+ Arrays.asList("myTopic1",
+ "myTopic2"), true);
Subscription subscription = notificationBroker.subscribe(consumer, "myTopic1");
assertTrue(publisherCallback.subscribed.await(5, TimeUnit.SECONDS));
synchronized (consumerCallback.notifications) {
- notificationBroker.notify(publisher, "myTopic1", new JAXBElement(new QName("urn:test:org", "foo"), String.class, "bar"));
+ notificationBroker.notify(publisher, "myTopic1",
+ new JAXBElement<String>(new QName("urn:test:org", "foo"),
+ String.class, "bar"));
consumerCallback.notifications.wait(1000000);
}
@@ -182,7 +207,8 @@ public abstract class WsnBrokerTest exte
public static class TestConsumer implements Consumer.Callback {
- public final List<NotificationMessageHolderType> notifications = new ArrayList<NotificationMessageHolderType>();
+ public final List<NotificationMessageHolderType> notifications
+ = new ArrayList<NotificationMessageHolderType>();
public void notify(NotificationMessageHolderType message) {
synchronized (notifications) {