Examples of ErlangBinding


Examples of org.apache.tuscany.sca.binding.erlang.ErlangBinding

  /**
   * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#read(javax.xml.stream.XMLStreamReader)
   */
  public ErlangBinding read(XMLStreamReader reader)
      throws ContributionReadException, XMLStreamException {
    ErlangBinding binding = new ErlangBindingImpl();

    // Read the policies
    policyProcessor.readPolicies(binding, reader);

    binding.setNode(reader.getAttributeValue(null, ATTR_NODE));

    String mboxValue = reader.getAttributeValue(null, ATTR_MBOX);

    if (mboxValue != null && mboxValue.length() > 0) {
      try {
        binding.setMbox(Boolean.parseBoolean(mboxValue));
      } catch (Exception e) {
      }
    }

    try {
      binding.setTimeout(Long.parseLong(reader.getAttributeValue(null,
          ATTR_TIMEOUT)));
    } catch (NumberFormatException e) {
    }

    binding.setModule(reader.getAttributeValue(null, ATTR_MODULE));

    binding.setCookie(reader.getAttributeValue(null, ATTR_COOKIE));

    try {
      binding.setServiceThreadPool(Integer.parseInt(reader
          .getAttributeValue(null, ATTR_SERVICE_THREAD_POOL)));
    } catch (NumberFormatException e) {
    }

    return binding;
View Full Code Here

Examples of org.apache.tuscany.sca.binding.erlang.ErlangBinding

  @Test
  public void testLoadValidComposite() throws Exception {
    XMLStreamReader reader = inputFactory
        .createXMLStreamReader(new StringReader(COMPOSITE));
    Composite composite = (Composite) staxProcessor.read(reader);
    ErlangBinding binding = (ErlangBinding) composite.getComponents()
        .get(0).getServices().get(0).getBindings().get(0);
    assertEquals("SomeNode", binding.getNode());
    assertEquals(1000, binding.getTimeout());
    assertEquals("cookie", binding.getCookie());
    assertEquals(true, binding.hasTimeout());
    assertEquals(true, binding.hasCookie());
    assertEquals(1, binding.getServiceThreadPool());
    assertEquals(false, binding.isDefaultServiceThreadPool());
    assertEquals(false, binding.isDefaultTimeout());
  }
View Full Code Here

Examples of org.apache.tuscany.sca.binding.erlang.ErlangBinding

  public void testLoadDefaultTimeout() throws Exception {
    XMLStreamReader reader = inputFactory
        .createXMLStreamReader(new StringReader(
            COMPOSITE_DEFAULT_TIMEOUT));
    Composite composite = (Composite) staxProcessor.read(reader);
    ErlangBinding binding = (ErlangBinding) composite.getComponents()
        .get(0).getServices().get(0).getBindings().get(0);
    assertEquals(ErlangBindingImpl.NO_TIMEOUT, binding.getTimeout());
    assertEquals(null, binding.getCookie());
    assertEquals(false, binding.hasTimeout());
    assertEquals(false, binding.hasCookie());
    assertEquals(ErlangBinding.DEFAULT_THREAD_POOL, binding
        .getServiceThreadPool());
    assertEquals(true, binding.isDefaultServiceThreadPool());
    assertEquals(true, binding.isDefaultTimeout());
  }
View Full Code Here

Examples of org.apache.tuscany.sca.binding.erlang.ErlangBinding

  @Ignore("unbound namespace problem")
  //FIXME: fix it
  public void testWrite() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));      
        Composite composite = (Composite)staxProcessor.read(reader);
        ErlangBinding binding1 = (ErlangBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);      
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
       
        staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
       
        XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));      
        Composite composite2 = (Composite)staxProcessor.read(reader2);
        ErlangBinding binding2 = (ErlangBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);      
       
        //compare binding1 to binding2
  }
View Full Code Here

Examples of org.apache.tuscany.sca.binding.erlang.ErlangBinding

        sendMessage(connection, senderPid, senderRef,
            MessageHelper.ATOM_BADRPC, errorMsg);
      } else {
        // module found, looking for operation
        RuntimeComponentService service = nodeElement.getService();
        ErlangBinding binding = nodeElement.getBinding();
        List<Operation> operations = service.getInterfaceContract()
            .getInterface().getOperations();
        Operation operation = null;
        for (Operation o : operations) {
          if (o.getName().equals(function)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.