KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > jaxws > api > tools > modelxws > api > tools > model > ProjectModelTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.jaxws.api.tools.modelxws.api.tools.model;
21
22 import java.beans.PropertyChangeEvent JavaDoc;
23 import java.beans.PropertyChangeListener JavaDoc;
24 import java.io.File JavaDoc;
25 import java.io.FileInputStream JavaDoc;
26 import java.io.IOException JavaDoc;
27 import java.io.InputStream JavaDoc;
28 import junit.framework.*;
29 import org.netbeans.junit.NbTestCase;
30 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel;
31 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModelProvider;
32 /*
33  * ProjectModelTest.java
34  * JUnit based test
35  *
36  * Created on February 13, 2006, 5:43 PM
37  */

38
39 /**
40  *
41  * @author mkuchtiak
42  */

43 public class ProjectModelTest extends NbTestCase {
44     
45     public ProjectModelTest(String JavaDoc testName) {
46         super(testName);
47     }
48
49     protected void setUp() throws Exception JavaDoc {
50     }
51
52     protected void tearDown() throws Exception JavaDoc {
53     }
54     
55     // TODO add test methods here. The name must begin with 'test'. For example:
56
public void testModel() throws IOException JavaDoc{
57         File JavaDoc fo = getFile("jax-ws.xml");
58         File JavaDoc fo1 = getFile("jax-ws1.xml");
59         InputStream JavaDoc is = new FileInputStream JavaDoc(fo);
60         InputStream JavaDoc is1 = new FileInputStream JavaDoc(fo1);
61         JaxWsModel jaxws = JaxWsModelProvider.getDefault().getJaxWsModel(is);
62         is.close();
63         assertNotNull("JaxWsModel1 isn't created",jaxws);
64         JaxWsModel jaxws1 = JaxWsModelProvider.getDefault().getJaxWsModel(is1);
65         is1.close();
66         assertNotNull("JaxWsModel2 isn't created",jaxws1);
67         System.out.println("services.length = "+jaxws.getServices().length);
68         assertEquals(2,jaxws.getServices().length);
69         jaxws.addPropertyChangeListener(new PropertyChangeListener JavaDoc() {
70             public void propertyChange(PropertyChangeEvent JavaDoc evt) {
71                 System.out.println("propertyChanged:"+evt.getPropertyName()+" Old Value:"+evt.getOldValue()+" New Value:"+evt.getNewValue());
72             }
73         });
74         String JavaDoc orgWsdl = jaxws.findServiceByName("A").getWsdlUrl();
75         jaxws.merge(jaxws1);
76         String JavaDoc newWsdl = jaxws.findServiceByName("AA").getWsdlUrl();
77         assertEquals(orgWsdl,newWsdl);
78     }
79
80     private File JavaDoc getFile(String JavaDoc file) {
81         return new File JavaDoc(getDataDir(),file);
82     }
83     
84     private File JavaDoc newFile(String JavaDoc file) {
85         return new File JavaDoc(getDataDir(),file);
86     }
87     
88 }
89
Popular Tags