Package org.apache.axis2.context

Examples of org.apache.axis2.context.ConfigurationContext


    String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
   
    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";

    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

    Options clientOptions = new Options ();
    clientOptions.setAction(pingAction);
    clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
   
    clientOptions.setTo(new EndpointReference (to));
   
    String sequenceKey = "sequence2";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    serviceClient.setOptions(clientOptions);
    try
    {
      serviceClient.fireAndForget(getPingOMBlock("ping1"));   
     
      //now deliver the next out of order
      clientOptions.setProperty(SandeshaClientConstants.MESSAGE_NUMBER,new Long(3));
      serviceClient.fireAndForget(getPingOMBlock("ping3"));
 
      String internalSequenceId = SandeshaUtil.getInternalSequenceID(to, sequenceKey);
      waitForMessageToBeAcked(serviceClient, internalSequenceId);
     
      StorageManager mgr = SandeshaUtil.getInMemoryStorageManager(configContext);
      Transaction t = mgr.getTransaction();
      String inboundSequenceID = SandeshaUtil.getSequenceIDFromInternalSequenceID(internalSequenceId,
          mgr);
      t.commit();
     
      SandeshaClient.forceDispatchOfInboundMessages(serverConfigCtx, inboundSequenceID, false);
     
      //check that the server is now expecting msg 4
      StorageManager serverMgr = SandeshaUtil.getInMemoryStorageManager(serverConfigCtx);
      t = serverMgr.getTransaction();
      RMDBean rMDBean = serverMgr.getRMDBeanMgr().retrieve(inboundSequenceID);
      assertNotNull(rMDBean);
      assertEquals(rMDBean.getNextMsgNoToProcess(), 4);
      t.commit();
    }
    finally{
      configContext.getListenerManager().stop();
      serviceClient.cleanup();     
    }

  }
View Full Code Here


   * @throws SandeshaException
   */
  private void waitForMessageToBeAcked(ServiceClient serviceClient, String internalSequenceId) throws SandeshaException
  {
    // Get the highest out message number
    ConfigurationContext context = serviceClient.getServiceContext().getConfigurationContext();
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context, context.getAxisConfiguration());
   
    // Get a transaction for the property finding
    Transaction transaction = storageManager.getTransaction();
   
    // Get the highest out message property
View Full Code Here

        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
        ConfigurationContext configCtx = new ConfigurationContext(axisConfig);

        ClassLoader classLoader = getClass().getClassLoader();
        parameter = new Parameter(Sandesha2Constants.MODULE_CLASS_LOADER,classLoader);
        axisConfig.addParameter(parameter);
       
View Full Code Here

    String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
   
    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
    ServiceClient serviceClient = new ServiceClient (configContext,null);

    Options clientOptions = new Options ();
    clientOptions.setAction(pingAction);
    clientOptions.setTo(new EndpointReference (to));
    clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE, "true");
    serviceClient.setOptions(clientOptions);
   
    serviceClient.fireAndForget(getPingOMBlock("echo1"));
   
    //assertions for the out sequence.
    SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
    assertTrue(sequenceReport.getCompletedMessages().isEmpty());
   
    //assertions for the in sequence
    List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
    assertTrue(inboundReports.isEmpty());
   
    configContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here

    String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
   
    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
    ServiceClient serviceClient = new ServiceClient (configContext,null);

    Options clientOptions = new Options ();
    clientOptions.setAction(echoAction);
    clientOptions.setTo(new EndpointReference (to));
    clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,"true");
    serviceClient.setOptions(clientOptions);
   
    OMElement result = serviceClient.sendReceive(getEchoOMBlock("echo1", "sync"));
   
    // Check the response
    String echoStr = checkEchoOMBlock(result);
    assertEquals(echoStr, "echo1");
   
    //assertions for the out sequence.
    SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
    assertTrue(sequenceReport.getCompletedMessages().isEmpty());
   
    //assertions for the in sequence
    List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
    assertTrue(inboundReports.isEmpty());
   
    configContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here

    String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
   
    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
    ServiceClient serviceClient = new ServiceClient (configContext,null);

    Options clientOptions = new Options ();
    clientOptions.setAction(echoAction);
    clientOptions.setTo(new EndpointReference (to));
    clientOptions.setProperty(SandeshaClientConstants.UNRELIABLE_MESSAGE,"true");
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setUseSeparateListener(true);
    serviceClient.setOptions(clientOptions);
   
    TestCallback callback1 = new TestCallback ("Callback 1");
    serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1", "async"),callback1);

    long limit = System.currentTimeMillis() + waitTime;
    Error lastError = null;
    while(System.currentTimeMillis() < limit) {
      Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
     
      try {
        //assertions for the out sequence.
        SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
        assertTrue(sequenceReport.getCompletedMessages().isEmpty());
       
        assertTrue(callback1.isComplete());
        assertEquals(callback1.getResult(),"echo1");
       
        //assertions for the in sequence
        List inboundReports = SandeshaClient.getIncomingSequenceReports(configContext);
        assertTrue(inboundReports.isEmpty());
       
        lastError = null;
        break;
      } catch(Error e) {
        lastError = e;
      }
    }

    if(lastError != null) throw lastError;

    configContext.getListenerManager().stop();
    serviceClient.cleanup();
  }
View Full Code Here

       
        if(args.length != 3) {
            System.out.println("Usage: $java Client endpoint_address client_repo_path policy_xml_path");
        }
       
        ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1], null);
       
        ServiceClient client = new ServiceClient(ctx, null);
        Options options = new Options();
        options.setAction("urn:echo");
        options.setTo(new EndpointReference(args[0]));
View Full Code Here

       
        if(args.length != 3) {
            System.out.println("Usage: $java Client endpoint_address client_repo_path policy_xml_path");
        }
       
        ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1], null);
       
        ServiceClient client = new ServiceClient(ctx, null);
        Options options = new Options();
        options.setAction("urn:echo");
        options.setTo(new EndpointReference(args[0]));
View Full Code Here

        String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
        if (soapAction == null) {
            soapAction = "\"\"";
        }

        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
       
        setMsgContextProperties(request, response, service, msgContext);

        ServiceContext serviceContext = msgContext.getServiceContext();
        serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);
View Full Code Here

                                     Response response,
                                     AxisService service,
                                     MessageContext msgContext) throws Exception {
        String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
       
        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
        configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
       
        setMsgContextProperties(request, response, service, msgContext);
       
        ServiceContext serviceContext = msgContext.getServiceContext();
        serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);
View Full Code Here

TOP

Related Classes of org.apache.axis2.context.ConfigurationContext

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.