You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by wi...@apache.org on 2005/10/06 21:08:41 UTC

svn commit: r306844 - /webservices/muse/trunk/client/src/test/org/apache/ws/client/muse/client/impl/notification/SubscriptionManagerImplTest.java

Author: wire
Date: Thu Oct  6 12:08:37 2005
New Revision: 306844

URL: http://svn.apache.org/viewcvs?rev=306844&view=rev
Log:
new

Added:
    webservices/muse/trunk/client/src/test/org/apache/ws/client/muse/client/impl/notification/SubscriptionManagerImplTest.java

Added: webservices/muse/trunk/client/src/test/org/apache/ws/client/muse/client/impl/notification/SubscriptionManagerImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/client/src/test/org/apache/ws/client/muse/client/impl/notification/SubscriptionManagerImplTest.java?rev=306844&view=auto
==============================================================================
--- webservices/muse/trunk/client/src/test/org/apache/ws/client/muse/client/impl/notification/SubscriptionManagerImplTest.java (added)
+++ webservices/muse/trunk/client/src/test/org/apache/ws/client/muse/client/impl/notification/SubscriptionManagerImplTest.java Thu Oct  6 12:08:37 2005
@@ -0,0 +1,188 @@
+package org.apache.ws.client.muse.client.impl.notification;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Calendar;
+import java.util.Observable;
+import java.util.Observer;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.client.muse.client.NotificationConsumer;
+import org.apache.ws.client.muse.client.impl.exceptions.FaultException;
+import org.apache.ws.client.muse.client.impl.exceptions.UnexpectedServerResponseException;
+import org.apache.ws.client.muse.client.model.Query;
+import org.apache.ws.client.muse.client.model.SubscriptionManager;
+import org.apache.ws.client.muse.client.model.TopicExpression;
+import org.apache.ws.util.test.axis.MuseClientTestCase;
+import org.apache.xmlbeans.XmlException;
+
+public class SubscriptionManagerImplTest extends MuseClientTestCase implements Observer {
+
+	private static String id="0001";
+	private String eprTxt; 
+	private URL testAddress;
+	private NotifyableResourceImpl testResource;
+	private NotificationConsumer testConsumer;
+	private SubscriptionManager subscriptionResource;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		this.testAddress=new URL(getAxisBaseUrl().toExternalForm()+"TestResource");
+		this.eprTxt = eprFromAddessandId(this.testAddress.toString(),id);
+		this.testResource = new NotifyableResourceImpl(
+						eprTxt); 
+		
+		TopicExpression[] topics = testResource.getTopics();
+		testConsumer = new NotificationConsumerImpl(8085,20000);
+		subscriptionResource = testResource.subscribe(topics[3],testConsumer.getEndpointReference());
+		assertNotNull(subscriptionResource);
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.getConsumerReference()'
+	 */
+	public void testGetConsumerReference() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		EndpointReference ref = subscriptionResource.getConsumerReference();
+		assertNotNull(ref);
+		assertNotNull(ref.getAddress());
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.getTopicExpression()'
+	 */
+	public void testGetTopicExpression() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		TopicExpression topicExpression = subscriptionResource.getTopicExpression();
+		assertNotNull(topicExpression);
+		assertEquals("http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple",topicExpression.getDialect());
+		assertEquals(new QName("http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2-events.xml","TestMetricMonitorChannel"),topicExpression.getName());
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.isUseNotify()'
+	 */
+	public void testIsUseNotify() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		assertTrue(!subscriptionResource.isUseNotify());
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.getPrecondition()'
+	 */
+	public void testGetPrecondition() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		try{
+			Query preCond = subscriptionResource.getPrecondition();
+		} catch (UnexpectedServerResponseException e){
+			return;
+		}
+		fail("The unit test example does not contain a precondition but one was discovered.");		
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.getSelector()'
+	 */
+	public void testGetSelector() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		
+		try{
+			subscriptionResource.getSelector();		} catch (UnexpectedServerResponseException e){
+			return;
+		}
+		fail("The unit test example does not contain a selector but one was discovered.");		
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.getSubscriptionPolicy()'
+	 */
+	public void testGetSubscriptionPolicy() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		
+		try{
+			subscriptionResource.getSubscriptionPolicy();
+		} catch (UnexpectedServerResponseException e){
+			return;
+		}
+		fail("No Policy was present in the unit test exanple but one was discovered.");		
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.getCreationTime()'
+	 */
+	public void testGetCreationTime() throws FaultException, URISyntaxException, IOException, XmlException, UnexpectedServerResponseException {
+		Calendar time=subscriptionResource.getCreationTime();
+		assertNotNull(time);		
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setConsumerReference(EndpointReference)'
+	 */
+	public void testSetConsumerReference() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setTopicExpression(TopicExpression)'
+	 */
+	public void testSetTopicExpression() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setUseNotify(boolean)'
+	 */
+	public void testSetUseNotify() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setPrecondition(Query)'
+	 */
+	public void testSetPrecondition() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setSelector(Query)'
+	 */
+	public void testSetSelector() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setSubscriptionPolicy(XmlObject)'
+	 */
+	public void testSetSubscriptionPolicy() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.setCreationTime(Calendar)'
+	 */
+	public void testSetCreationTime() {
+		// TODO: This unit test has not been written yet because the effect of this operation is not clear
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.pauseSubscription()'
+	 */
+	public void testPauseSubscription() throws URISyntaxException, IOException, XmlException, UnexpectedServerResponseException, FaultException {
+		subscriptionResource.pauseSubscription();
+	}
+
+	/*
+	 * Test method for 'org.apache.ws.client.muse.client.impl.notification.SubscriptionManagerImpl.resumeSubscription()'
+	 */
+	public void testResumeSubscription() throws URISyntaxException, IOException, XmlException, UnexpectedServerResponseException, FaultException {
+		subscriptionResource.pauseSubscription();
+		subscriptionResource.resumeSubscription();
+	}
+
+	public void update(Observable o, Object arg) {
+		
+		
+	}
+
+}