/*
* Created on Jun 7, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.apache.interop.smgr;
import javax.xml.namespace.QName;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
import org.apache.ws.muws.interop.client.AbstractWsdmInteropTestCase;
import org.apache.ws.muws.interop.client.FaultException;
import org.apache.ws.muws.interop.client.ResourceStub;
import org.apache.ws.muws.interop.client.ServiceStub;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
/**
* @author wire
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class TestSubscribe extends AbstractWsdmInteropTestCase {
private PortListen m_listener;
private ServiceStub m_service;
private ResourceStub m_resource;
private static final String ADM_URL = null;
private String URL="http://66.57.65.244:4400/ettk/wsdm/services/ADMSubscribePort";
private String Rid=null;
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
//m_service = new ServiceStub( new URL( ADM_URL ) );
m_resource = new ResourceStub( getEpr(URL, Rid) );
m_listener=new PortListen(8000,600000);
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
}
public void testSubscribe() throws FaultException{
EndpointReference response = m_resource.subscribe("http://12.35.246.160:8001/bogasendpoint",new QName("http://rim.pda","CodeModuleSize"));
assertNotNull(response);
System.out.println("Waiting for a message");
String mess = m_listener.waitForIncomingMessage();
assertNotNull(mess);
System.out.println("Message:\n"+mess);
}
private EndpointReference getEpr(String URL, String Rid) throws XmlException{
XmlBeansEndpointReference x=new XmlBeansEndpointReference(URL,AddressingConstants.NSURI_ADDRESSING_SCHEMA);
if(Rid!=null)
x.setReferenceProperties(new XmlObject[]{(XmlObject)XmlObject.Factory.parse("<svr:ResourceIdentifier xmlns:svr=\"http://wsdmdemo.org/service/weather-client-config\">"+Rid+"</svr:ResourceIdentifier>")});
return x;
}
}