Exemplo n.º 1
0
 // 调试用
 @Ignore
 @Test
 public void rawTestWsClient() {
   JaxWsProxyFactoryBean bean = new JaxWsProxyFactoryBean();
   bean.setAddress(
       "http://10.17.35.103:8080/dubbo-test/services/vision.apollo.jaxws.HelloService");
   bean.setServiceClass(HelloService.class);
   bean.getHandlers().add(TraceHandler.getSingleton());
   HelloService s = (HelloService) bean.create();
   String r = s.sayHello("ZHAHH");
   System.out.println(r);
 }
Exemplo n.º 2
0
  @Test
  public void testAllClients() {
    {
      System.out.println("======== 测试 sayHello =========");
      String result = helloService.sayHello("Jiyi");
      System.out.println(result);
      assertEquals("Hello,Jiyi", result);

      result = helloServiceWs.sayHello("Rensu");
      System.out.println(result);
      assertEquals("Hello,Rensu", result);
    }

    {
      System.out.println("======== 测试 REST/JSON 下插入 =========");
      int id = peopleService.create(new People("*****@*****.**", "Yi", "Ji"));
      System.out.println("Created People id=" + id);
      assertTrue(id > 0);
    }

    {
      System.out.println("======== 测试 REST/JSON 下读取 =========");
      List<People> peoples = peopleService.getAll();
      System.out.println("目前库中有" + peoples.size() + "个用户。");
      for (People p : peoples) {
        System.out.println(p);
      }
      assertFalse(peoples.isEmpty());
    }

    {
      System.out.println("======== 测试 REST/XML 下插入 =========");
      int id = peopleServiceXml.create(new People("*****@*****.**", "Yi", "Ji"));
      System.out.println("Created People id=" + id);
      assertTrue(id > 0);
    }

    {
      System.out.println("======== 测试 REST/XML 下读取 =========");
      List<People> peoples = peopleServiceXml.getAll();
      System.out.println("目前库中有" + peoples.size() + "个用户。");
      for (People p : peoples) {
        System.out.println(p);
      }
      assertFalse(peoples.isEmpty());
    }

    {
      System.out.println("======== 测试 REST接口类直接发布为WebService后下的插入 =========");
      int id = peopleServiceWs.create(new People("*****@*****.**", "Yi", "Ji"));
      System.out.println("Created People id=" + id);
      assertTrue(id > 0);
    }

    {
      System.out.println("======== 测试 REST接口类直接发布为WebService后下的读取 =========");
      List<People> peoples = peopleServiceWs.getAll();
      System.out.println("目前库中有" + peoples.size() + "个用户。");
      for (People p : peoples) {
        System.out.println(p);
      }
      assertFalse(peoples.isEmpty());
    }
  }