KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jaxr > scout > publish > infomodel > JaxrClassficationTestCase


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.test.jaxr.scout.publish.infomodel;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.Collection JavaDoc;
26
27 import javax.xml.registry.BulkResponse JavaDoc;
28 import javax.xml.registry.LifeCycleManager JavaDoc;
29 import javax.xml.registry.infomodel.ClassificationScheme JavaDoc;
30 import javax.xml.registry.infomodel.Concept JavaDoc;
31 import javax.xml.registry.infomodel.ExternalLink JavaDoc;
32 import javax.xml.registry.infomodel.Key JavaDoc;
33
34 import org.jboss.test.jaxr.scout.JaxrBaseTestCase;
35
36 //$Id: JaxrClassficationTestCase.java 46408 2006-07-20 17:19:17Z asaldhana $
37

38 /**
39  * Test the storage of classifications on Concepts and Services
40  * @author <a HREF="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
41  * @author <a HREF="mailto:Noel.Rocher@jboss.org">Noel Rocher</a>
42  * @since Apr 11, 2006
43  * @version $Revision: 46408 $
44  */

45 public class JaxrClassficationTestCase extends JaxrBaseTestCase
46 {
47    private static final String JavaDoc UUID_TYPE = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4";
48   
49    public void testClassificationOnConcepts() throws Exception JavaDoc
50    {
51       login();
52       getJAXREssentials();
53       Concept JavaDoc concept=null;
54       Collection JavaDoc concepts = new ArrayList JavaDoc(1);
55       String JavaDoc portTypeName = "Test Port Type";
56       concept = blm.createConcept( null, portTypeName ,"" );
57       ExternalLink JavaDoc wsdlLink = blm.createExternalLink("http://test.org/"+portTypeName,"TEST Port Type definition");
58       concept.addExternalLink(wsdlLink);
59        
60       ClassificationScheme JavaDoc TYPE = (ClassificationScheme JavaDoc)bqm.getRegistryObject(UUID_TYPE, LifeCycleManager.CLASSIFICATION_SCHEME);
61       assertTrue("Classifications are not empty", TYPE.getClassifications().size() > 0);
62       System.out.println("TYPE.Classifications = " +TYPE.getClassifications());
63       concept.addClassification(blm.createClassification( TYPE, blm.createInternationalString("TEST CLASSIFICATION"), "test portType") );
64
65       concepts.add(concept);
66       BulkResponse JavaDoc response = blm.saveConcepts( concepts );
67       if (response != null && response.getCollection().size() > 0)
68       {
69          concept.setKey((Key JavaDoc)response.getCollection().iterator().next() );
70          assertNotNull("Key created != null", concept.getKey());
71          System.out.println("Concept Key = " + concept.getKey() + "\".");
72       }
73       
74       //Obtain the saved concepts
75
Concept JavaDoc savedConcept = (Concept JavaDoc)bqm.getRegistryObject(concept.getKey().getId(),
76                                       LifeCycleManager.CONCEPT );
77       assertNotNull("savedConcept is not null", savedConcept);
78       Collection JavaDoc collection = savedConcept.getClassifications();
79       assertNotNull("Classifications is not null", collection);
80       assertTrue("Classifications is not empty", collection.isEmpty() == false);
81    }
82 }
83
Popular Tags