001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)TestJBIDescriptor.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.ui.common;
030:
031: import java.io.InputStream;
032: import java.io.InputStreamReader;
033: import java.util.Iterator;
034: import junit.framework.TestCase;
035:
036: /**
037: * test class
038: * @author Sun Microsystems, Inc.
039: */
040: public class TestJBIDescriptor extends TestCase {
041:
042: /**
043: * Creates a new instance of TestMgmtMessage
044: * @param aTestName name
045: */
046: public TestJBIDescriptor(String aTestName) {
047: super (aTestName);
048: }
049:
050: /**
051: * test sucess msg
052: * @throws Exception on error
053: */
054: public void testServiceAssemblyDD() throws Exception {
055: InputStream res = this .getClass().getResourceAsStream(
056: "test_jbi.xml");
057: InputStreamReader reader = new InputStreamReader(res);
058: JBIDescriptor dd = JBIDescriptor.createJBIDescriptor(reader);
059: this .assertTrue("Expected Service Assembly DD", dd
060: .isServiceAssemblyDescriptor());
061: }
062:
063: /**
064: * test sucess msg
065: * @throws Exception on error
066: */
067: public void testSharedLibraryDD() throws Exception {
068: InputStream res = this .getClass().getResourceAsStream(
069: "test_slib_dd.xml");
070: InputStreamReader reader = new InputStreamReader(res);
071: JBIDescriptor dd = JBIDescriptor.createJBIDescriptor(reader);
072: this .assertTrue("Expected Shared Library DD", dd
073: .isSharedLibraryDescriptor());
074: }
075:
076: /**
077: * test sucess msg
078: * @throws Exception on error
079: */
080: public void testEngineDD() throws Exception {
081: InputStream res = this .getClass().getResourceAsStream(
082: "test_engine_dd.xml");
083: InputStreamReader reader = new InputStreamReader(res);
084: JBIDescriptor dd = JBIDescriptor.createJBIDescriptor(reader);
085: System.out.println("Engine DD Class :"
086: + dd.getClass().getName());
087: this .assertTrue("Expected Engine DD", dd
088: .isServiceEngineDescriptor());
089: }
090:
091: /**
092: * test sucess msg
093: * @throws Exception on error
094: */
095: public void testBindingDD() throws Exception {
096: InputStream res = this .getClass().getResourceAsStream(
097: "test_binding_dd.xml");
098: InputStreamReader reader = new InputStreamReader(res);
099: JBIDescriptor dd = JBIDescriptor.createJBIDescriptor(reader);
100: System.out.println("Binding DD Class :"
101: + dd.getClass().getName());
102: this .assertTrue("Expected Binding DD", dd
103: .isBindingComponentDescriptor());
104: }
105:
106: /**
107: * main
108: * @param args the command line arguments
109: */
110: public static void main(String[] args) {
111: // TODO code application logic here
112: try {
113: new TestJBIDescriptor("test").testSharedLibraryDD();
114: } catch (Exception ex) {
115: ex.printStackTrace();
116: }
117: }
118: }
|