Package org.springframework.remoting.httpinvoker

Examples of org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean


  {
    File dataFile = new File("/Users/jwang/proj/bobo-trunk/cardata/facetvals.txt");
    RequestBuilder reqBuilder = new RequestBuilder(dataFile);
    final BrowseRequest[] reqs = reqBuilder.buildRequests();
   
    final HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();

    factoryBean.setServiceInterface(Browsable.class);
    factoryBean.setServiceUrl("http://localhost:8888/bobo-service/services/BrowseService");
    factoryBean.afterPropertiesSet();

    final Browsable svc = (Browsable) (factoryBean.getObject());

    int numThreads = 1;
   
    Thread[] threads = new Thread[numThreads];
    for (int i = 0; i < threads.length; ++i)
View Full Code Here


        // Start the JBI container
        container.start();

        // Set up the Spring bean to call into the URL specified for the consumer endpoint
        HttpInvokerProxyFactoryBean pfb = new HttpInvokerProxyFactoryBean();
        pfb.setServiceInterface(Person.class);
        pfb.setServiceUrl("http://localhost:8192/service/");
        pfb.setHttpInvokerRequestExecutor(new SimpleHttpInvokerRequestExecutor());
        pfb.afterPropertiesSet();

        // Grab the object via the proxy factory bean
        Person test = (Person) pfb.getObject();

        // Test getters
        assertEquals("Hunter", test.getGivenName());
        assertEquals("Thompson", test.getSurName());
        assertEquals(67, test.getAge());
View Full Code Here

    final CommonsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new CommonsHttpInvokerRequestExecutor();
    DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(10, false);
    httpInvokerRequestExecutor.getHttpClient().getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
    httpInvokerRequestExecutor.getHttpClient().getParams().setSoTimeout(1000*60*5);
    {
      HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
      httpInvokerProxyFactoryBean.setServiceUrl(serverAdress + "copperMonitoringService");
      httpInvokerProxyFactoryBean.setServiceInterface(LoginService.class);
      httpInvokerProxyFactoryBean.setServiceUrl(serverAdress + "loginService");
      httpInvokerProxyFactoryBean.afterPropertiesSet();
      httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
      loginService = (LoginService) httpInvokerProxyFactoryBean.getObject();
    }

    final String sessionId;
    if(secureConnect) {
      try {
        sessionId = loginService.doLogin(user, password);
      } catch (RemoteException e) {
        throw new RuntimeException(e);
      }
    } else {
      sessionId = "";
    }

    if (sessionId == null) {
      getIssueReporterSingleton().reportWarning("Invalid user/password", null, new Runnable() {
        @Override
        public void run() {
          createLoginForm().show();
        }
      });
    } else {
      HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
      httpInvokerProxyFactoryBean.setServiceUrl(serverAdress + "copperMonitoringService");
      httpInvokerProxyFactoryBean.setServiceInterface(CopperMonitoringService.class);
      RemoteInvocationFactory remoteInvocationFactory = secureConnect ?
          new SecureRemoteInvocationFactory(sessionId) : new DefaultRemoteInvocationFactory();
      httpInvokerProxyFactoryBean.setRemoteInvocationFactory(remoteInvocationFactory);
      httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
      httpInvokerProxyFactoryBean.afterPropertiesSet();
      final CopperMonitoringService copperMonitoringService = (CopperMonitoringService) httpInvokerProxyFactoryBean.getObject();

      final String serverAdressFinal = serverAdress;
      Platform.runLater(new Runnable() {
        @Override
        public void run() {
View Full Code Here

    }

    public void testHttpInvokeSpringService() throws Exception
    {
        ComplexData cd = new ComplexData("Foo", new Integer(13));
        HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean();
        invoker.setServiceInterface(WorkInterface.class);
        invoker.setServiceUrl(SPRING_HTTP_ENDPOINT);
        invoker.afterPropertiesSet();
        WorkInterface worker = (WorkInterface)invoker.getObject();
        ComplexData data = worker.executeComplexity(cd);
        assertNotNull(data);
        assertEquals(data.getSomeString(), "Foo Received");
        assertEquals(data.getSomeInteger(), new Integer(14));
    }
View Full Code Here

  public void init(ServletConfig config) throws ServletException
  {
    super.init(config);
    ServletContext ctx = config.getServletContext();
    _appCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(ctx);
    final HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();
    factoryBean.setServiceInterface(ZoieSearchService.class);
    factoryBean.setServiceUrl("http://localhost:8888/zoie-perf/services/SampleZoieService");
    factoryBean.afterPropertiesSet();
    _searchSvc = (ZoieSearchService) factoryBean.getObject();
  }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    final HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();

      factoryBean.setServiceInterface(ZoieSearchService.class);
      factoryBean.setServiceUrl("http://localhost:8888/zoie-perf/services/ZoieService");
      factoryBean.afterPropertiesSet();

      final ZoieSearchService svc = (ZoieSearchService) (factoryBean.getObject());
     
      SearchRequest req = new SearchRequest();
     // req.setQuery("java");
      SearchResult res = svc.search(req);

View Full Code Here

  @Test
  public void test_with_valid_user() throws Exception{
   
    String sessionId;
    {
      HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
      httpInvokerProxyFactoryBean.setServiceInterface(LoginService.class);
      httpInvokerProxyFactoryBean.setServiceUrl(LOGIN_SERVICE);
      httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
      httpInvokerProxyFactoryBean.afterPropertiesSet();
      LoginService loginService = (LoginService)httpInvokerProxyFactoryBean.getObject();
      sessionId = loginService.doLogin("user1", "pass1");
    }
 
    {
      final HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
      httpInvokerProxyFactoryBean.setServiceInterface(CopperMonitoringService.class);
      httpInvokerProxyFactoryBean.setServiceUrl(COPPER_MONITORING_SERVICE);
      httpInvokerProxyFactoryBean.setRemoteInvocationFactory(new SecureRemoteInvocationFactory(sessionId));
      httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
      httpInvokerProxyFactoryBean.afterPropertiesSet();
     
     
      CopperMonitoringService copperMonitorService = (CopperMonitoringService)httpInvokerProxyFactoryBean.getObject();
      assertNotNull(copperMonitorService);
      try {
        copperMonitorService.getSettings();
      } catch (RemoteException e) {
        throw new RuntimeException(e);
View Full Code Here

  @Test(expected=RemoteAccessException.class)
  public void test_with_invalid_user() throws Exception{
   
    String sessionId;
    {
      HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
      httpInvokerProxyFactoryBean.setServiceInterface(LoginService.class);
      httpInvokerProxyFactoryBean.setServiceUrl(LOGIN_SERVICE);
      httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
      httpInvokerProxyFactoryBean.afterPropertiesSet();
      LoginService loginService = (LoginService)httpInvokerProxyFactoryBean.getObject();
      sessionId = loginService.doLogin("userXXXX", "passXXXX");
      assertNull(sessionId);
    }
 
    {
      final HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
      httpInvokerProxyFactoryBean.setServiceInterface(CopperMonitoringService.class);
      httpInvokerProxyFactoryBean.setServiceUrl(COPPER_MONITORING_SERVICE);
      httpInvokerProxyFactoryBean.setRemoteInvocationFactory(new SecureRemoteInvocationFactory(sessionId));
      httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
      httpInvokerProxyFactoryBean.afterPropertiesSet();
     
     
      CopperMonitoringService copperMonitorService = (CopperMonitoringService)httpInvokerProxyFactoryBean.getObject();
      assertNotNull(copperMonitorService);
      try {
        copperMonitorService.getSettings();
      } catch (RemoteException e) {
        throw new RuntimeException(e);
View Full Code Here

  }
 
 
  @Test(expected=RemoteAccessException.class)
  public void test_without_user() throws RemoteException{
    HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean();
    httpInvokerProxyFactoryBean.setServiceInterface(CopperMonitoringService.class);
    httpInvokerProxyFactoryBean.setServiceUrl(COPPER_MONITORING_SERVICE);;
    httpInvokerProxyFactoryBean.setRemoteInvocationFactory(new SecureRemoteInvocationFactory("dgfdgdg"));
    httpInvokerProxyFactoryBean.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
    httpInvokerProxyFactoryBean.afterPropertiesSet();
     
    CopperMonitoringService copperMonitorService = (CopperMonitoringService)httpInvokerProxyFactoryBean.getObject();
    assertNotNull(copperMonitorService);
    copperMonitorService.getSettings();
  }
View Full Code Here

    @Test
    public void testHttpInvokeSpringService() throws Exception
    {
        ComplexData cd = new ComplexData("Foo", new Integer(13));
        HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean();
        invoker.setServiceInterface(WorkInterface.class);
        invoker.setServiceUrl(SPRING_HTTP_ENDPOINT);
        invoker.afterPropertiesSet();
        WorkInterface worker = (WorkInterface)invoker.getObject();
        ComplexData data = worker.executeComplexity(cd);
        assertNotNull(data);
        assertEquals(data.getSomeString(), "Foo Received");
        assertEquals(data.getSomeInteger(), new Integer(14));
    }
View Full Code Here

TOP

Related Classes of org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean

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.