Package org.apache.ws.notification

Examples of org.apache.ws.notification.PortListen


      EndpointReferenceType subRef = sub_response.getSubscriptionReference(  );
      assertNotNull( subRef );
      assertTrue( AxisGenTypesUtils.getResourceId( subRef ).length(  ) != 0 );

      //test as a listener for events
      PortListen notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, LISTENER_TIMEOUT );

      // destroy the resource - a notification should get emitted!
      m_stub.destroy( new Destroy(  ) );

      // wait for that termination notification
      String incomingMessage = notificationListener.waitForIncomingMessage(  );

      //validate the incoming notification is really in there!
      validateNotificationMessage( incomingMessage );

      // simple test just to verify the termination notification was in the notification
View Full Code Here


    */
   public void testDestroySubscription(  )
   throws Exception
   {
      //test as a listener for events
      PortListen         notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, LISTENER_TIMEOUT );

      SubscribeResponse sub_response =
         subscribe( ExampleConstants.RESOURCE_PROP_QNAME_BLOCK_SIZE,
                    "http://127.0.0.1:" + NOTIFICATION_LISTENER_PORT );

      testDiskPortSetResourcePropertiesUpdate(  );
      String incomingMessage = notificationListener.waitForIncomingMessage(  );
      assertFalse( "Incoming Message started with an Error.",
                   incomingMessage.startsWith( "ERROR" ) );

      EndpointReferenceType              subscriptionReference = sub_response.getSubscriptionReference(  );
      SubscriptionManagerHttpBindingStub subMgrBinding = getSubMgrBinding(  );
      assertNotNull( subMgrBinding );

      subMgrBinding.setResourceId( AxisGenTypesUtils.getResourceId( subscriptionReference ) );

      subMgrBinding.destroy( null );

      notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, 5000 );

      testDiskPortSetResourcePropertiesUpdate(  );
      String response = notificationListener.waitForIncomingMessage(  );
      assertTrue( "Incoming Message did not start with an Error.",
                  response.startsWith( "ERROR" ) );
   }
View Full Code Here

      EndpointReferenceType subRef = sub_response.getSubscriptionReference(  );

      assertNotNull( subRef );

      //test as a listener for events
      PortListen notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, LISTENER_TIMEOUT );
      assertTrue( AxisGenTypesUtils.getResourceId( subRef ).length(  ) != 0 );

      String incomingMessage = notificationListener.waitForIncomingMessage(  );

      //validate the incoming notification is really in there!
      validateNotificationMessage( incomingMessage );

      // Call GetCurrentMessage to assure that the BadSector message is available.
View Full Code Here

      // The two subscription references should be equal except for the ResourceID property
      assertTrue( rsSubRef.getAddress(  ).toString(  ).compareTo( bsSubRef.getAddress(  ).toString(  ) ) == 0 );
      assertTrue( rsSubRef.getPortType(  ).toString(  ).compareTo( bsSubRef.getPortType(  ).toString(  ) ) == 0 );

      //test as a listener for events
      PortListen notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, LISTENER_TIMEOUT );
      assertTrue( AxisGenTypesUtils.getResourceId( rsSubRef ).compareTo( AxisGenTypesUtils.getResourceId( bsSubRef ) ) != 0 );

      // Update the BlockSize to initiate the Notification
      testDiskPortSetResourcePropertiesUpdate(  );

      String incomingMessage = notificationListener.waitForIncomingMessage(  );

      //validate the incoming notification is really in there!
      validateNotificationMessage( incomingMessage );

      // Call GetCurrentMessage to assure that the BlockSize message is available.
View Full Code Here

   public void testPauseResumeSubscription(  )
   throws Exception,
          RemoteException
   {
      //test as a listener for events
      PortListen         notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, 5000 );

      SubscribeResponse sub_response =
         subscribe( ExampleConstants.RESOURCE_PROP_QNAME_BLOCK_SIZE,
                    "http://127.0.0.1:" + NOTIFICATION_LISTENER_PORT );

      EndpointReferenceType              subscriptionReference = sub_response.getSubscriptionReference(  );

      SubscriptionManagerHttpBindingStub subMgrBinding = getSubMgrBinding(  );
      assertNotNull( subMgrBinding );

      subMgrBinding.setResourceId( AxisGenTypesUtils.getResourceId( subscriptionReference ) );
      subMgrBinding.pauseSubcription( null );

      testDiskPortSetResourcePropertiesUpdate(  );

      String incomingMessage = notificationListener.waitForIncomingMessage(  );
      assertTrue( incomingMessage.startsWith( "ERROR:java.net.SocketTimeoutException: Accept timed out" ) );
      notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, 5000 );
      subMgrBinding.resumeSubscription( null );

      testDiskPortSetResourcePropertiesUpdate(  );
      String response = notificationListener.waitForIncomingMessage(  );
      assertFalse( response.startsWith( "ERROR" ) );
   }
View Full Code Here

    */
   public void testSetTerminationTimeSubscription(  )
   throws Exception
   {
      //test as a listener for events
      PortListen         notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, 15000 );

      SubscribeResponse sub_response =
         subscribe( ExampleConstants.RESOURCE_PROP_QNAME_BLOCK_SIZE,
                    "http://127.0.0.1:" + NOTIFICATION_LISTENER_PORT );

      testDiskPortSetResourcePropertiesUpdate(  );
      String incomingMessage = notificationListener.waitForIncomingMessage(  );
      assertFalse( incomingMessage.startsWith( "ERROR" ) );

      EndpointReferenceType              subscriptionReference = sub_response.getSubscriptionReference(  );
      SubscriptionManagerHttpBindingStub subMgrBinding = getSubMgrBinding(  );
      assertNotNull( subMgrBinding );

      subMgrBinding.setResourceId( AxisGenTypesUtils.getResourceId( subscriptionReference ) );

      SetTerminationTime termTime = new SetTerminationTime(  );
      Calendar            calendar = Calendar.getInstance(  );

      //set to the start of time ;-) ..its already expired
      calendar.setTimeInMillis( 0 );
      termTime.setRequestedTerminationTime( calendar );
      subMgrBinding.setTerminationTime( termTime );

      notificationListener = new PortListen( NOTIFICATION_LISTENER_PORT, 5000 );

      testDiskPortSetResourcePropertiesUpdate(  );
      String response = notificationListener.waitForIncomingMessage(  );
      assertTrue( response.startsWith( "ERROR" ) );
   }
View Full Code Here

TOP

Related Classes of org.apache.ws.notification.PortListen

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.