Package main.java.org.squidy

Examples of main.java.org.squidy.MuleConfig


  public void testAddWs() throws IOException, ParsingException
  {

    Document muleDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-1.xml"));
    Document expectedDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-1.xml"));
    MuleConfig mc1 = new MuleConfig(muleDoc);

    // Add a ws with a Mule name that already exists
    try
    {
      mc1.addWs(WS_1);
      fail(EXPECT_ILLEGAL_ARGUMENT_EXCEPTION);
    }
    catch (IllegalStateException e)
    {
    }
   
    // Add a ws with a Mule Endpoint that already exists
    try
    {
      mc1.addWs(WS_2);
      fail(EXPECT_ILLEGAL_ARGUMENT_EXCEPTION);
    }
    catch (IllegalStateException e)
    {
    }

    // Add a good ws with a description
    mc1.addWs(WS_3);
    assertEquals(mc1.getMuleNames(), NAMES_1_2);
    assertDocumentEquals(expectedDoc ,muleDoc);

    //add a WS with a description to an empty document
    Document doc = XmlUtil.loadDocument(MuleConfig.class.getResource("/main/resources/mule/mule-empty.xml"));
    MuleConfig mc2 = new MuleConfig(doc);

    mc2.addWs(WS_1);
    mc2.addWs(WS_2);
   
    Document expectedDoc2 = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-3.xml"));
    assertDocumentEquals(expectedDoc2, mc2.getDocument());
    assertEquals(NAMES_1_2, mc2.getMuleNames());

    //add a WS without a description to an empty document
    Document doc2 = XmlUtil.loadDocument(MuleConfig.class.getResource("/main/resources/mule/mule-empty.xml"));
    MuleConfig mc3 = new MuleConfig(doc2);

    mc3.addWs(WS_4);
    mc3.addWs(WS_1);
   
    Document expectedDoc3 = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-4.xml"));
    assertDocumentEquals(expectedDoc3, mc3.getDocument());   
  }
View Full Code Here


  public void testRemoveWs() throws IOException, ParsingException
  {
    Document muleDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-1.xml"));
    Document expectedDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-2.xml"));
    MuleConfig mc1 = new MuleConfig(muleDoc);

    // remove a ws that does not exist
    try
    {
      mc1.removeWs(WS_2);
      fail(EXPECT_ILLEGAL_ARGUMENT_EXCEPTION);
    }
    catch (IllegalStateException e)
    {
    }

    // remove an existing ws
    mc1.removeWs(WS_1);
    assertEquals(mc1.getMuleNames(), EMPTY_LIST);
    assertDocumentEquals(expectedDoc ,muleDoc);
  }
View Full Code Here


  public void testGetMuleInboundAddress() throws IOException, ParsingException
  {
    Document muleDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-1.xml"));
    MuleConfig mc1 = new MuleConfig(muleDoc);

    assertEquals(ENDPOINT_2 , mc1.getMuleInboundAddress(NAME_2));
  }
View Full Code Here


  public void testGetMuleOutboundAddress() throws IOException, ParsingException
  {
    Document muleDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-1.xml"));
    MuleConfig mc1 = new MuleConfig(muleDoc);

    assertEquals(CONTAINERADRESS_1 , mc1.getMuleOutboundAddress(NAME_2));
  }
View Full Code Here


  public void testGetMuleNames() throws IOException, ParsingException
  {
    Document muleDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-1.xml"));
    MuleConfig mc1 = new MuleConfig(muleDoc);

    assertEquals(NAMES_1_2 , mc1.getMuleNames());
  }
View Full Code Here


  public void testNewEmptyConfigration() throws IOException, ParsingException
  {
    Document expectedDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-empty-expected.xml"));
    MuleConfig mc = MuleConfig.newEmptyConfiguration();
    assertDocumentEquals(expectedDoc , mc.getDocument());
  }
View Full Code Here


  public void testGetMuleConfigDescription() throws IOException, ParsingException
  {
    Document expectedDoc = XmlUtil.loadDocument(MuleConfig.class.getResource("/test/resources/mule/mule-expected-3.xml"));
    MuleConfig mc = MuleConfig.newEmptyConfiguration();

    mc.addWs(WS_1);
    mc.addWs(WS_2);
   
    assertDocumentEquals(expectedDoc , mc.getDocument());

    final List<List<String>> expectedDescription = new LinkedList<List<String>>();
    expectedDescription.add(MULE_DESCRIPTION_1);
    expectedDescription.add(MULE_DESCRIPTION_2);

    assertEquals(expectedDescription , mc.getMuleConfigDescription());
   
  }
View Full Code Here

TOP

Related Classes of main.java.org.squidy.MuleConfig

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.