/**
*
* Copyright 2004 Protique Ltd
*
* Licensed 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
*
* 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.servicemix.ws.notification.impl;
import org.servicemix.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType;
import org.servicemix.ws.xmlbeans.notification.base.NotifyDocument;
import org.codehaus.activesoap.SoapService;
import org.codehaus.activesoap.handler.xmlbeans.XMLBeansRegistry;
import org.codehaus.activesoap.transport.LocalTransportClient;
import org.servicemix.ws.notification.impl.ActiveMQNotificationBroker;
import org.servicemix.ws.notification.impl.invoke.ActiveSOAPNotificationConsumer;
/**
* @version $Revision: 468 $
*/
public class ActiveSOAPNotificationBrokerTest extends TestSupport {
public void testSubscribeWithSOAPEndpoint() throws Exception {
StubNotificationConsumer service = new StubNotificationConsumer();
XMLBeansRegistry registry = new XMLBeansRegistry();
registry.registerService(service);
final SoapService serverSide = new SoapService(registry);
serverSide.setRepairingNamespace(true);
ActiveMQNotificationBroker broker = new ActiveMQNotificationBroker() {
protected org.servicemix.ws.notification.NotificationConsumer createNotificationConsumer(EndpointReferenceType consumerReference) {
return ActiveSOAPNotificationConsumer.newSoapInstance(new LocalTransportClient(serverSide));
}
};
addSubscription(broker);
sendNotification(broker);
NotifyDocument subNotifyDoc = (NotifyDocument) service.getResult().poll(2000);
System.out.println("Got Notify: "+subNotifyDoc);
assertValidMessage(subNotifyDoc);
}
}