This project has retired. For details please refer to its Attic page.
UDDI_010_PublisherIntegrationTest xref
View Javadoc
1   /*
2    * Copyright 2001-2009 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *      http://www.apache.org/licenses/LICENSE-2.0
8    * 
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.apache.juddi.v3.tck;
16  
17  import org.apache.commons.configuration.ConfigurationException;
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.apache.juddi.v3.bpel.BPEL_010_IntegrationTest;
21  import org.apache.juddi.v3.client.config.UDDIClient;
22  import org.apache.juddi.v3.client.transport.Transport;
23  import org.junit.AfterClass;
24  import org.junit.Assert;
25  import org.junit.Assume;
26  import org.junit.BeforeClass;
27  import org.junit.Test;
28  import org.uddi.api_v3.AuthToken;
29  import org.uddi.api_v3.GetAuthToken;
30  import org.uddi.v3_service.UDDISecurityPortType;
31  
32  /**
33   * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
34   * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
35   */
36  public class UDDI_010_PublisherIntegrationTest {
37  
38          private static Log logger = LogFactory.getLog(UDDI_010_PublisherIntegrationTest.class);
39  
40          private static UDDIClient manager;
41  
42          @BeforeClass
43          public static void startRegistry() throws ConfigurationException {
44                  if (!TckPublisher.isEnabled()) {
45                          return;
46                  }
47                  if (!TckPublisher.isJUDDI()) {
48                          return;
49                  }
50                  manager = new UDDIClient();
51                  manager.start();
52                  JUDDI_300_MultiNodeIntegrationTest.testSetupReplicationConfig();
53          }
54  
55          @AfterClass
56          public static void stopRegistry() throws ConfigurationException {
57                  if (!TckPublisher.isEnabled()) {
58                          return;
59                  }
60                  if (!TckPublisher.isJUDDI()) {
61                          return;
62                  }
63                  manager.stop();
64          }
65  
66          @Test
67          public void testAuthToken() {
68                  Assume.assumeTrue(TckPublisher.isEnabled());
69                  Assume.assumeTrue(TckPublisher.isUDDIAuthMode());
70                  try {
71                          Transport transport = manager.getTransport("uddiv3");
72                          UDDISecurityPortType securityService = transport.getUDDISecurityService();
73                          GetAuthToken getAuthToken = new GetAuthToken();
74                          getAuthToken.setUserID(TckPublisher.getRootPublisherId());
75                          getAuthToken.setCred(TckPublisher.getRootPassword());
76                          AuthToken authToken = securityService.getAuthToken(getAuthToken);
77                          //logger.info("Don't log auth tokens!");
78                          Assert.assertNotNull(authToken);
79                  } catch (Exception e) {
80                          e.printStackTrace();
81                          Assert.fail();
82                  }
83          }
84  
85  }