juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject svn commit: r1551063 - in /juddi/branches/juddi-3.3.x: juddi-core/src/test/resources/ juddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/ uddi-tck-base/src/main/resources/ uddi-tck/src/test/java/org/apache/juddi/v3/tck/
Date Sun, 15 Dec 2013 21:57:57 GMT
Author: alexoree
Date: Sun Dec 15 21:57:56 2013
New Revision: 1551063

URL: http://svn.apache.org/r1551063
Log:
JUDDI-198 altering some of the test cases to work from the standalone test runner
JUDDI-583 altering some of the tests to parameterize the tck settings involving callbacks
and standalone services

Modified:
    juddi/branches/juddi-3.3.x/juddi-core/src/test/resources/log4j.xml
    juddi/branches/juddi-3.3.x/juddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
    juddi/branches/juddi-3.3.x/uddi-tck-base/src/main/resources/tck.properties
    juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerExternalTest.java
    juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java
    juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidation.java

Modified: juddi/branches/juddi-3.3.x/juddi-core/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/juddi-core/src/test/resources/log4j.xml?rev=1551063&r1=1551062&r2=1551063&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/juddi-core/src/test/resources/log4j.xml (original)
+++ juddi/branches/juddi-3.3.x/juddi-core/src/test/resources/log4j.xml Sun Dec 15 21:57:56
2013
@@ -17,7 +17,7 @@
    </appender>
    
     <logger name="org">
-        <level value="DEBUG"/>
+        <level value="INFO"/>
     </logger>
     
     <logger name="org.hibernate">

Modified: juddi/branches/juddi-3.3.x/juddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/juddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java?rev=1551063&r1=1551062&r2=1551063&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/juddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
(original)
+++ juddi/branches/juddi-3.3.x/juddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
Sun Dec 15 21:57:56 2013
@@ -1,28 +1,55 @@
+/*
+ * Copyright 2001-2009 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.juddi.tckrunner;
 
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
 
 /**
- * Hello world!
+ * This application will run the majority of the jUDDI project's UDDI Technical
+ * Compatibility Kit (TCK) tests. Some of the tests that are used are slightly
+ * different than when ran with jUDDI's build process.
  *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ * @since 3.3
  */
 public class App {
 
-        public static void main(String[] args) {
-                System.out.println("Running! this can take anywhere from 5-15 minutes!");
+        public static void main(String[] args) throws Exception {
+                System.out.println("_________________________________________________");
+                System.out.println("Running! this can take anywhere from 2-5 minutes!");
+                System.out.println("Configure options using uddi.xml and tck.properties");
+                System.out.println("java -Duddi.client.xml=uddi.xml -jar juddi-tck-runner-{VERSION}-SNAPSHOT-jar-with-dependencies.jar");
+                System.out.println("_________________________________________________");
+                System.out.println();
 
+                if (!new File("tck.properties").exists()) {
+                        System.out.println("tck.properties was not found! I give up!");
+                        System.exit(1);
+                }
                 JUnitCore junit = new JUnitCore();
                 Result result = junit.run(org.apache.juddi.v3.bpel.BPEL_010_IntegrationTest.class,
-                        
-                        
                         //the bpel tests really only test wsdl to uddi
                         // org.apache.juddi.v3.bpel.BPEL_010_IntegrationTest.class,
-                       // org.apache.juddi.v3.bpel.BPEL_020_IntegrationTest.class,
-                        
-                        //this test is useless and was removed
-                        
-                       // org.apache.juddi.v3.tck.UDDI_001_UDDIServiceTest.class,
+                        // org.apache.juddi.v3.bpel.BPEL_020_IntegrationTest.class,
+
                         org.apache.juddi.v3.tck.JUDDI_010_PublisherIntegrationTest.class,
                         org.apache.juddi.v3.tck.UDDI_010_PublisherIntegrationTest.class,
                         org.apache.juddi.v3.tck.UDDI_020_TmodelIntegrationTest.class,
@@ -48,19 +75,55 @@ public class App {
                         org.apache.juddi.v3.tck.UDDI_160_RESTIntergrationTest.class,
                         org.apache.juddi.v3.tck.UDDI_170_ValueSetValidation.class);
 
+                String filename = "uddi-tck-results-" + new SimpleDateFormat("yyyyMMddhhmm").format(new
Date()) + ".txt";
+                FileWriter fw = new FileWriter(filename);
+
+                BufferedWriter bw = new BufferedWriter(fw);
+                bw.write("UDDI-TCK Test Results generated " + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new
Date()));
+                bw.newLine();
+                bw.write("____________________________________________");
+                bw.write("Summary");
+                bw.newLine();
+                bw.write("Failed Test Cases: " + result.getFailureCount());
+                bw.newLine();
+                bw.write("Skipped Test Cases: " + result.getIgnoreCount());
+                bw.newLine();
+                bw.write("Ran Test Cases: " + result.getRunCount());
+                bw.newLine();
+                bw.write("Time: " + result.getRunTime());
+                bw.newLine();
+                bw.write("-------------------------------------");
+                bw.newLine();
+                bw.newLine();
+
+                for (int i = 0; i < result.getFailures().size(); i++) {
+                        bw.write(result.getFailures().get(i).getTestHeader());
+                        bw.newLine();
+                        bw.write(result.getFailures().get(i).getDescription().getClassName());
+                        bw.newLine();
+                        bw.write(result.getFailures().get(i).getDescription().getMethodName());
+                        bw.newLine();
+                        bw.write(result.getFailures().get(i).getMessage());
+                        bw.newLine();
+                        //result.getFailures().get(i).getException().printStackTrace();
+
+                        bw.write(result.getFailures().get(i).getTrace());
+                        bw.newLine();
+                        bw.write("____________________________________________");
+                }
+                System.out.println("____________________________________________");
                 System.out.println("Summary");
                 System.out.println("Failed Test Cases: " + result.getFailureCount());
                 System.out.println("Skipped Test Cases: " + result.getIgnoreCount());
                 System.out.println("Ran Test Cases: " + result.getRunCount());
                 System.out.println("Time: " + result.getRunTime());
-                for (int i = 0; i < result.getFailures().size(); i++) {
-                        System.out.println("-------------------------------------");
-                        System.out.println(result.getFailures().get(i).getTestHeader());
-                        System.out.println(result.getFailures().get(i).getDescription().getClassName());
-                        System.out.println(result.getFailures().get(i).getDescription().getMethodName());
-                        System.out.println(result.getFailures().get(i).getMessage());
-                }
+                System.out.println("-------------------------------------");
+                System.out.println("Results written to " + filename);
+
+                bw.close();
+                fw.close();
                 junit = null;
-                System.exit(0);
+                System.out.println("Exit code: " + result.getFailureCount());
+                System.exit(result.getFailureCount());
         }
 }

Modified: juddi/branches/juddi-3.3.x/uddi-tck-base/src/main/resources/tck.properties
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/uddi-tck-base/src/main/resources/tck.properties?rev=1551063&r1=1551062&r2=1551063&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/uddi-tck-base/src/main/resources/tck.properties (original)
+++ juddi/branches/juddi-3.3.x/uddi-tck-base/src/main/resources/tck.properties Sun Dec 15
21:57:56 2013
@@ -43,10 +43,14 @@ smtp.notify.enabled=true
 #if true, use these settings to verify message delivery/notification
 mail.host=localhost
 mail.port=110
-mail.socketFactory
 #this can be TLS
 #mail.secureProtocol=TLS
 #mail.implicit=false
-mail.username=username
-mail.password=pass
-mail.to=username@domain.com
\ No newline at end of file
+mail.username=juddi@local.domain
+mail.password=da_password1
+mail.to=juddi@local.domain
+
+
+# for UDDI server callbacks (subscription api, value set validation)
+# use this to override the bind to address, by default it's the hostname of the computer
running the tests from
+bindaddress=localhost
\ No newline at end of file

Modified: juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerExternalTest.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerExternalTest.java?rev=1551063&r1=1551062&r2=1551063&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerExternalTest.java
(original)
+++ juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerExternalTest.java
Sun Dec 15 21:57:56 2013
@@ -103,7 +103,10 @@ public class UDDI_090_SubscriptionListen
                 try {
                         httpPort = 9600 + new Random().nextInt(99);
 
-                        hostname = InetAddress.getLocalHost().getHostName();
+                        hostname = TckPublisher.getProperties().getProperty("bindaddress");
+                        if (hostname==null)
+                                hostname=InetAddress.getLocalHost().getHostName();
+
                         //bring up the TCK SubscriptionListener
                         String httpEndpoint = "http://" + hostname + ":" + httpPort + "/tcksubscriptionlistener";
                         System.out.println("Bringing up SubscriptionListener endpoint at
" + httpEndpoint);

Modified: juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java?rev=1551063&r1=1551062&r2=1551063&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java
(original)
+++ juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java
Sun Dec 15 21:57:56 2013
@@ -14,6 +14,7 @@
  */
 package org.apache.juddi.v3.tck;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
@@ -107,7 +108,7 @@ public class UDDI_141_JIRAIntegrationTes
                         inquiryJoe = transport.getUDDIInquiryService();
 
                         subscriptionJoe = transport.getUDDISubscriptionService();
-                        
+
                         authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(),
TckPublisher.getJoePassword());
                         authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(),
TckPublisher.getSamPassword());
                         //Assert.assertNotNull(authInfoJoe);
@@ -121,7 +122,7 @@ public class UDDI_141_JIRAIntegrationTes
                         tckTModelJoe = new TckTModel(publicationJoe, inquiryJoe);
                         tckBusinessJoe = new TckBusiness(publicationJoe, inquiryJoe);
 
-                        
+
                         transport = manager.getTransport();
 
                         publicationSam = transport.getUDDIPublishService();
@@ -834,7 +835,11 @@ public class UDDI_141_JIRAIntegrationTes
                 System.out.println("JIRA_597");
 
                 int port = 4444;
-                String localhostname = java.net.InetAddress.getLocalHost().getHostName();
+                String hostname = TckPublisher.getProperties().getProperty("bindaddress");
+                if (hostname == null) {
+                        hostname = InetAddress.getLocalHost().getHostName();
+                }
+
                 UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl();
                 removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe);
                 UDDISubscriptionListenerImpl.notifcationMap.clear();
@@ -843,7 +848,7 @@ public class UDDI_141_JIRAIntegrationTes
                 boolean ok = false;
                 do {
                         try {
-                                ep = Endpoint.publish("http://" + localhostname + ":" + port
+ "/UDDI_CALLBACK", impl);
+                                ep = Endpoint.publish("http://" + hostname + ":" + port +
"/UDDI_CALLBACK", impl);
                                 ok = true;
                         } catch (Exception ex) {
                                 port++;
@@ -861,7 +866,7 @@ public class UDDI_141_JIRAIntegrationTes
                 bs.setBindingTemplates(new BindingTemplates());
                 BindingTemplate bt = new BindingTemplate();
                 bt.setAccessPoint(new AccessPoint());
-                bt.getAccessPoint().setValue("http://" + localhostname + ":" + port + "/UDDI_CALLBACK");
+                bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK");
                 bt.getAccessPoint().setUseType("endPoint");
                 //Added per Kurt
                 TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
@@ -876,7 +881,7 @@ public class UDDI_141_JIRAIntegrationTes
                 sb.getBusinessEntity().add(be);
                 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
 
-                List<String> deleteme=new ArrayList<String>();
+                List<String> deleteme = new ArrayList<String>();
                 deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
                 //ok Joe's callback is setup
 
@@ -889,7 +894,7 @@ public class UDDI_141_JIRAIntegrationTes
                 sb.getBusinessEntity().add(be);
                 BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb);
 
-                
+
                 //ok Joe now needs to subscribe for Sam's business
                 Holder<List<Subscription>> list = new Holder<List<Subscription>>();
                 list.value = new ArrayList<Subscription>();
@@ -923,7 +928,7 @@ public class UDDI_141_JIRAIntegrationTes
                         Thread.sleep(1000);
                         maxwait = maxwait - 1000;
                 }
-                removeAllExistingSubscriptions(subscriptionJoe,authInfoJoe);
+                removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe);
                 this.DeleteBusinesses(deleteme, authInfoJoe, publicationJoe);
                 deleteme.clear();
                 deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
@@ -947,8 +952,15 @@ public class UDDI_141_JIRAIntegrationTes
         public void JIRA_596() throws Exception {
                 System.out.println("JIRA_596");
                 int port = 4444;
-                String localhostname = "localhost";//java.net.InetAddress.getLocalHost().getHostName();
-                removeAllExistingSubscriptions(subscriptionJoe,authInfoJoe);
+                
+                String hostname = TckPublisher.getProperties().getProperty("bindaddress");
+                if (hostname == null) {
+                        hostname = InetAddress.getLocalHost().getHostName();
+                }
+
+                
+               // String localhostname = "localhost";//java.net.InetAddress.getLocalHost().getHostName();
+                removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe);
                 UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl();
                 UDDISubscriptionListenerImpl.notifcationMap.clear();
                 UDDISubscriptionListenerImpl.notificationCount = 0;
@@ -957,7 +969,7 @@ public class UDDI_141_JIRAIntegrationTes
                 boolean ok = false;
                 do {
                         try {
-                                ep = Endpoint.publish("http://" + localhostname + ":" + port
+ "/UDDI_CALLBACK", impl);
+                                ep = Endpoint.publish("http://" + hostname + ":" + port +
"/UDDI_CALLBACK", impl);
                                 ok = true;
                         } catch (Exception ex) {
                                 port++;
@@ -975,7 +987,7 @@ public class UDDI_141_JIRAIntegrationTes
                 bs.setBindingTemplates(new BindingTemplates());
                 BindingTemplate bt = new BindingTemplate();
                 bt.setAccessPoint(new AccessPoint());
-                bt.getAccessPoint().setValue("http://" + localhostname + ":" + port + "/UDDI_CALLBACK");
+                bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK");
                 bt.getAccessPoint().setUseType("endPoint");
                 //obmitted as part of the jira test case
         /*TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
@@ -989,7 +1001,7 @@ public class UDDI_141_JIRAIntegrationTes
                 logger.info("setting up joe's callback business");
                 BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
 
-                List<String>deleteme = new ArrayList<String>();
+                List<String> deleteme = new ArrayList<String>();
                 deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
                 //ok Joe's callback is setup
 
@@ -1039,7 +1051,7 @@ public class UDDI_141_JIRAIntegrationTes
                         Thread.sleep(1000);
                         maxwait = maxwait - 1000;
                 }
-                removeAllExistingSubscriptions(subscriptionJoe,authInfoJoe);
+                removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe);
                 DeleteBusinesses(deleteme, authInfoJoe, publicationJoe);
                 deleteme.clear();
                 deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
@@ -1248,7 +1260,7 @@ public class UDDI_141_JIRAIntegrationTes
                 BusinessEntity be = new BusinessEntity();
                 be.getName().add(new Name());
                 be.getName().get(0).setValue("Joe's JIRA_575_KRGRP_Biz business");
-               // be.setBusinessServices(new BusinessServices());
+                // be.setBusinessServices(new BusinessServices());
                 be.setCategoryBag(new CategoryBag());
                 //be.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel,
"name", "val"));
                 be.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup());
@@ -1362,7 +1374,7 @@ public class UDDI_141_JIRAIntegrationTes
                 BusinessService bs = new BusinessService();
                 bs.getName().add(new Name());
                 bs.getName().get(0).setValue("Joe's JIRA_575_SVC_KRGRP service");
-               // bs.setBindingTemplates(new BindingTemplates());
+                // bs.setBindingTemplates(new BindingTemplates());
                 bs.setCategoryBag(new CategoryBag());
                 bs.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup());
                 bs.getCategoryBag().getKeyedReferenceGroup().get(0).setTModelKey(madeupTmodel);
@@ -1525,8 +1537,6 @@ public class UDDI_141_JIRAIntegrationTes
         }
         //</editor-fold>
 
-      
-
         private void DeleteBusinesses(List<String> businesskeysToDelete, String authinfo,
UDDIPublicationPortType pub) {
 
 

Modified: juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidation.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidation.java?rev=1551063&r1=1551062&r2=1551063&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidation.java
(original)
+++ juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_170_ValueSetValidation.java
Sun Dec 15 21:57:56 2013
@@ -19,6 +19,11 @@ import java.net.InetAddress;
 import java.rmi.RemoteException;
 import java.util.Random;
 import java.util.UUID;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Endpoint;
 import org.apache.commons.configuration.ConfigurationException;
@@ -44,8 +49,11 @@ import org.uddi.api_v3.DeleteBusiness;
 import org.uddi.api_v3.DeleteTModel;
 import org.uddi.api_v3.Description;
 import org.uddi.api_v3.DispositionReport;
+import org.uddi.api_v3.ErrInfo;
+import org.uddi.api_v3.KeyType;
 import org.uddi.api_v3.KeyedReference;
 import org.uddi.api_v3.Name;
+import org.uddi.api_v3.Result;
 import org.uddi.api_v3.SaveBusiness;
 import org.uddi.api_v3.SaveTModel;
 import org.uddi.api_v3.TModel;
@@ -60,8 +68,9 @@ import org.uddi.vs_v3.ValidateValues;
  *
  * @author Alex O'Ree
  */
+@WebService(name = "UDDI_ValueSetValidation_PortType", targetNamespace = "urn:uddi-org:v3_service")
 public class UDDI_170_ValueSetValidation implements UDDIValueSetValidationPortType {
-
+        
         private static UDDIInquiryPortType inquiry = null;
         private static UDDIPublicationPortType publication = null;
         static UDDISecurityPortType security = null;
@@ -69,13 +78,14 @@ public class UDDI_170_ValueSetValidation
         private static Log logger = LogFactory.getLog(UDDI_170_ValueSetValidation.class);
         private static String authInfoJoe = null;
         private static UDDIClient manager;
+        private static boolean VALID = true;
 
         @BeforeClass
         public static void startRegistry() throws ConfigurationException {
-
+                
                 manager = new UDDIClient();
                 manager.start();
-
+                
                 try {
                         Transport transport = manager.getTransport();
                         inquiry = transport.getUDDIInquiryService();
@@ -86,13 +96,13 @@ public class UDDI_170_ValueSetValidation
                                 TckSecurity.setCredentials((BindingProvider) inquiry, TckPublisher.getJoePublisherId(),
TckPublisher.getJoePassword());
                                 TckSecurity.setCredentials((BindingProvider) publication,
TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
                         }
-
+                        
                 } catch (Exception e) {
                         logger.error(e.getMessage(), e);
                         Assert.fail("Could not obtain authInfo token.");
                 }
         }
-
+        
         @AfterClass
         public static void stopRegistry() throws ConfigurationException {
                 manager.stop();
@@ -110,24 +120,61 @@ public class UDDI_170_ValueSetValidation
         @Test
         public void testVSV() throws Exception {
                 Assume.assumeTrue(TckPublisher.isValueSetAPIEnabled());
-
+                System.out.println("testVSV");
                 BusinessEntity SaveBusiness = null;
                 BusinessEntity SaveVSVCallbackService = null;
                 try {
                         Reset();
+                        VALID = true;
                         SaveVSVCallbackService = SaveVSVCallbackService();
                         SaveCheckedTModel(TckTModel.JOE_PUBLISHER_KEY_PREFIX + TMODEL, SaveVSVCallbackService.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
                         logger.info("Saving a business using those values");
                         SaveBusiness = SaveBusiness(authInfoJoe, true, TckTModel.JOE_PUBLISHER_KEY_PREFIX
+ TMODEL);
+                        
+                        
+                } catch (Exception ex) {
+                        logger.error(ex);
+                        Assert.fail("unexpected failure " + ex.getMessage());
+                } finally {
+                        if (SaveBusiness != null) {
+                                DeleteBusiness(authInfoJoe, SaveBusiness.getBusinessKey());
+                        }
+                        if (SaveVSVCallbackService != null) {
+                                DeleteBusiness(authInfoJoe, SaveVSVCallbackService.getBusinessKey());
+                        }
+                        DeleteCheckedTModel(TckTModel.JOE_PUBLISHER_KEY_PREFIX + TMODEL);
+                }
+                Assert.assertTrue(messagesReceived == 1);
+        }
+        
+        @Test
+        public void testVSVInvalid() throws Exception {
+                Assume.assumeTrue(TckPublisher.isValueSetAPIEnabled());
+                System.out.println("testVSVInvalid");
+                BusinessEntity SaveBusiness = null;
+                BusinessEntity SaveVSVCallbackService = null;
+                try {
+                        Reset();
+                        VALID = false;
+                        SaveVSVCallbackService = SaveVSVCallbackService();
+                        SaveCheckedTModel(TckTModel.JOE_PUBLISHER_KEY_PREFIX + TMODEL, SaveVSVCallbackService.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
+                        logger.info("Saving a business using those values");
+                        SaveBusiness = SaveBusiness(authInfoJoe, false, TckTModel.JOE_PUBLISHER_KEY_PREFIX
+ TMODEL);
                         Assert.assertTrue(messagesReceived == 1);
-
+                        Assert.fail("unexpected success");
+                } catch (Exception ex) {
+                        logger.info("Expected failure " + ex.getMessage());
                 } finally {
-                        DeleteBusiness(authInfoJoe, SaveBusiness.getBusinessKey());
-                        DeleteBusiness(authInfoJoe, SaveVSVCallbackService.getBusinessKey());
+                        if (SaveBusiness != null) {
+                                DeleteBusiness(authInfoJoe, SaveBusiness.getBusinessKey());
+                        }
+                        if (SaveVSVCallbackService != null) {
+                                DeleteBusiness(authInfoJoe, SaveVSVCallbackService.getBusinessKey());
+                        }
                         DeleteCheckedTModel(TckTModel.JOE_PUBLISHER_KEY_PREFIX + TMODEL);
                 }
         }
-
+        
         private BusinessEntity SaveBusiness(String authInfoJoe, boolean isValid, String key)
throws Exception {
                 SaveBusiness sb = new SaveBusiness();
                 sb.setAuthInfo(authInfoJoe);
@@ -143,7 +190,7 @@ public class UDDI_170_ValueSetValidation
                 BusinessDetail saveBusiness = publication.saveBusiness(sb);
                 return saveBusiness.getBusinessEntity().get(0);
         }
-
+        
         private void SaveCheckedTModel(String key, String binding) throws Exception {
                 TModel tm = new TModel();
                 tm.setTModelKey(key);
@@ -157,13 +204,32 @@ public class UDDI_170_ValueSetValidation
                 stm.getTModel().add(tm);
                 publication.saveTModel(stm);
         }
-
+        
         @Override
-        public DispositionReport validateValues(ValidateValues body) throws DispositionReportFaultMessage,
RemoteException {
+        @WebMethod(operationName = "validate_values", action = "validate_values")
+        @WebResult(name = "dispositionReport", targetNamespace = "urn:uddi-org:api_v3", partName
= "body")
+        @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+        public DispositionReport validateValues(
+                @WebParam(name = "validate_values", targetNamespace = "urn:uddi-org:vs_v3",
partName = "body") ValidateValues body)
+                throws DispositionReportFaultMessage, RemoteException {
                 messagesReceived++;
-                return new DispositionReport();
+                if (VALID) {
+                        DispositionReport dispositionReport = new DispositionReport();
+                        dispositionReport.getResult().add(new Result());
+                        return dispositionReport;
+                }
+                DispositionReport dispositionReport = new DispositionReport();
+                Result r = new Result();
+                r.setKeyType(KeyType.T_MODEL_KEY);
+                r.setErrno(20200);
+                r.setErrInfo(new ErrInfo());
+                r.getErrInfo().setErrCode("E_invalidValue");
+                r.getErrInfo().setValue("E_invalidValue");
+                
+                dispositionReport.getResult().add(r);
+                throw new DispositionReportFaultMessage("error", dispositionReport);
         }
-
+        
         private BusinessEntity SaveVSVCallbackService() throws Exception {
                 SaveBusiness sb = new SaveBusiness();
                 sb.setAuthInfo(authInfoJoe);
@@ -175,19 +241,20 @@ public class UDDI_170_ValueSetValidation
                 bs.setBindingTemplates(new BindingTemplates());
                 BindingTemplate bt = new BindingTemplate();
                 bt.setAccessPoint(new AccessPoint(url, "endPoint"));
+                bs.getBindingTemplates().getBindingTemplate().add(bt);
                 be.getBusinessServices().getBusinessService().add(bs);
                 sb.getBusinessEntity().add(be);
-
+                
                 return publication.saveBusiness(sb).getBusinessEntity().get(0);
         }
-
+        
         private void DeleteCheckedTModel(String string) throws Exception {
                 DeleteTModel db = new DeleteTModel();
                 db.setAuthInfo(authInfoJoe);
                 db.getTModelKey().add(string);
                 publication.deleteTModel(db);
         }
-
+        
         private void DeleteBusiness(String authInfoJoe, String string) throws Exception {
                 DeleteBusiness db = new DeleteBusiness();
                 db.setAuthInfo(authInfoJoe);
@@ -197,26 +264,34 @@ public class UDDI_170_ValueSetValidation
         Endpoint ep = null;
         String url = null;
         int messagesReceived = 0;
-
+        
         private void Reset() throws Exception {
                 messagesReceived = 0;
-                if (ep == null) {
+                if (ep == null || !ep.isPublished()) {
                         int httpPort = 9600 + new Random().nextInt(99);
-                        String hostname = InetAddress.getLocalHost().getHostName();
+                        String hostname = TckPublisher.getProperties().getProperty("bindaddress");
+                        if (hostname == null) {
+                                hostname = InetAddress.getLocalHost().getHostName();
+                        }
                         url = "http://" + hostname + ":" + httpPort + "/" + UUID.randomUUID().toString();
+                        logger.info("Firing up embedded endpoint at " + url);
                         do {
                                 try {
-
+                                        
                                         ep = Endpoint.publish(url, this);
                                         httpPort = 9600 + new Random().nextInt(99);
                                 } catch (Exception ex) {
+                                        logger.warn(ex.getMessage());
                                 }
-                        } while (ep != null && ep.isPublished());
-
+                        } while (ep != null && !ep.isPublished());
+                        
                 }
-
+                
         }
 
+        /**
+         * value set caching service TODO
+         */
         //@Test
         public void testVSCUnknownItem() {
                 /*
@@ -227,14 +302,9 @@ public class UDDI_170_ValueSetValidation
                  * 
                  * E_noValuesAvailable: Signifies that no values could be returned.
                  */
-
                 //Assume.assumeTrue(TckPublisher.isValueSetAPIEnabled());
-                
-        
         }
-        
         //TODO ·         E_invalidValue: Signifies that the chunkToken value supplied
is either invalid or has expired.
-        
         //TODO maybe? ·         E_unsupported: Signifies that the Web service does not
support this API.
         //this may be untestable unless the endpoint exists but isn't implemented
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message