@Test
  public void testClient() throws Exception {
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://IInterfaceService");
    proxyFac.setServiceClass(IInterfaceService.class);
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());

    IInterfaceService client = (IInterfaceService) proxyFac.create();

    IChild child = client.getChild();
    assertNotNull(child);
    assertEquals("child", child.getChildName());
    assertEquals("parent", child.getParentName());

    IParent parent = client.getChildViaParent();
    assertEquals("parent", parent.getParentName());
    assertFalse(parent instanceof IChild);

    IGrandChild grandChild = client.getGrandChild();
    assertEquals("parent", grandChild.getParentName());

    Document wsdl = getWSDLDocument("IInterfaceService");
    assertValid("//xsd:complexType[@name='IGrandChild']", wsdl);
    assertValid(
        "//xsd:complexType[@name='IGrandChild']//xsd:element[@name='grandChildName']", wsdl);
    assertValid("//xsd:complexType[@name='IGrandChild']//xsd:element[@name='childName'][1]", wsdl);
    assertInvalid(
        "//xsd:complexType[@name='IGrandChild']//xsd:element[@name='childName'][2]", wsdl);
    assertValid("//xsd:complexType[@name='IChild']", wsdl);
    assertValid("//xsd:complexType[@name='IParent']", wsdl);
    assertInvalid("//xsd:complexType[@name='IChild'][@abstract='true']", wsdl);
  }
Exemple #2
0
  @Test(expected = HelloException.class)
  @Ignore("Not working yet due to namespace things")
  public void testJaxwsServerSimpleClient() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    sfbean.setDataBinding(new AegisDatabinding());
    sfbean.setAddress("local://ExceptionServiceJaxWs1");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));

    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionServiceJaxWs1");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());

    ExceptionService clientInterface = proxyFac.create(ExceptionService.class);

    clientInterface.sayHiWithException();
  }
Exemple #3
0
  public static void main(String[] args) throws FileNotFoundException, IOException {

    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.setServiceClass(ServiceSEI.class);
    factory.setAddress("http://localhost:9191/BPMNServer");
    ServiceSEI client = (ServiceSEI) factory.create();

    //		String fileName =
    // Thread.currentThread().getContextClassLoader().getResource("bpmn20.input.xml").getFile();
    String fileName = "src/main/resources/bpmn20.input.xml";
    byte[] buffer = new byte[(int) new File(fileName).length()];
    BufferedInputStream f = new BufferedInputStream(new FileInputStream(fileName));
    f.read(buffer);
    String content = new String(buffer);
    content.replace("<", "&lt;");
    content.replace(">", "&gt;");

    String result = client.CompleteBPMN(content);

    System.out.println("The file " + content + " is completed" + result);
  }
Exemple #4
0
  @Test
  public void testHeaders() throws Exception {
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionService");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());

    ExceptionService client = proxyFac.create(ExceptionService.class);

    try {
      client.sayHiWithException();
      fail("Must throw exception!");
    } catch (HelloException e) {
      // nothing
    }

    // check to make sure the fault is an element
    Document wsdl = getWSDLDocument("ExceptionService");
    addNamespace("tns", "http://exception.aegis.cxf.apache.org");
    assertValid(
        "//wsdl:message[@name='HelloException']/wsdl:part[@name='HelloException']"
            + "[@element='tns:String']",
        wsdl);
  }