This project has retired. For details please refer to its
Attic page.
JAXR005ClassificationSchemeTest xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ws.scout.registry.qa;
18
19 import static org.junit.Assert.fail;
20
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Iterator;
24
25 import javax.xml.registry.BulkResponse;
26 import javax.xml.registry.BusinessQueryManager;
27 import javax.xml.registry.JAXRException;
28 import javax.xml.registry.JAXRResponse;
29 import javax.xml.registry.RegistryService;
30 import javax.xml.registry.infomodel.Classification;
31 import javax.xml.registry.infomodel.ClassificationScheme;
32 import javax.xml.registry.infomodel.Key;
33
34 import junit.framework.JUnit4TestAdapter;
35
36 import org.apache.ws.scout.BaseTestCase;
37 import org.apache.ws.scout.Remover;
38 import org.junit.After;
39 import org.junit.Before;
40 import org.junit.Test;
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 public class JAXR005ClassificationSchemeTest extends BaseTestCase
58 {
59 @Before
60 public void setUp()
61 {
62 super.setUp();
63 }
64
65 @After
66 public void tearDown()
67 {
68 super.tearDown();
69 }
70
71 @Test
72 public void testPublishClassificationScheme()
73 {
74 login();
75 try
76 {
77 RegistryService rs = connection.getRegistryService();
78 BusinessQueryManager bqm = rs.getBusinessQueryManager();
79 blm = rs.getBusinessLifeCycleManager();
80 Removerver.html#Remover">Remover remover = new Remover(blm);
81
82 ClassificationScheme cScheme = blm.createClassificationScheme("testScheme -- APACHE SCOUT TEST", "Sample Classification Scheme");
83 Classification classification = createClassificationForUDDI(bqm);
84 cScheme.addClassification(classification);
85
86 ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>();
87 cSchemes.add(cScheme);
88
89 BulkResponse br = blm.saveClassificationSchemes(cSchemes);
90 if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
91 {
92 System.out.println("Classification Saved");
93 Collection coll = br.getCollection();
94 Iterator iter = coll.iterator();
95 while (iter.hasNext())
96 {
97 Key key = (Key) iter.next();
98 System.out.println("Saved Key=" + key.getId());
99 cScheme.setKey(key);
100 remover.removeClassificationScheme(cScheme);
101 }
102 } else {
103 System.err.println("JAXRExceptions " +
104 "occurred during save:");
105 Collection exceptions = br.getExceptions();
106 Iterator iter = exceptions.iterator();
107 while (iter.hasNext())
108 {
109 Exception e = (Exception) iter.next();
110 System.err.println(e.toString());
111 fail(e.toString());
112 }
113 }
114
115
116 } catch (JAXRException e)
117 {
118 e.printStackTrace();
119 fail(e.getMessage());
120 }
121 }
122
123 private Classification createClassificationForUDDI(BusinessQueryManager bqm)
124 throws JAXRException
125 {
126
127 ClassificationScheme udditmodel = bqm.findClassificationSchemeByName(null, "uddi-org:types");
128
129 Classification cl = blm.createClassification(udditmodel, "wsdl", "wsdl");
130 return cl;
131 }
132
133 public static junit.framework.Test suite() {
134 return new JUnit4TestAdapter(JAXR005ClassificationSchemeTest.class);
135 }
136
137 }