You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2010/01/09 19:28:58 UTC
svn commit: r897513 [13/14] - in /webservices/juddi/trunk/qa: ./ juddi-xlt/
juddi-xlt/config/ juddi-xlt/config/data/ juddi-xlt/config/data/default/
juddi-xlt/lib/ juddi-xlt/src/ juddi-xlt/src/org/ juddi-xlt/src/org/apache/
juddi-xlt/src/org/apache/judd...
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/GoToJuddiPortal.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/GoToJuddiPortal.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/GoToJuddiPortal.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/GoToJuddiPortal.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2001-2010 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.xlt.action.http;
+
+import org.apache.juddi.xlt.validators.CommonValidator;
+import org.junit.Assert;
+
+import com.gargoylesoftware.htmlunit.html.ClickableElement;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.xceptance.xlt.api.actions.AbstractHtmlPageAction;
+import com.xceptance.xlt.api.util.HtmlPageUtils;
+
+/**
+ * Go to the jUDDI portal page.
+ *
+ *
+ */
+@SuppressWarnings("deprecation")
+public class GoToJuddiPortal extends AbstractHtmlPageAction
+{
+ /**
+ * The element that got clicked to execute this action.
+ */
+
+ ClickableElement clickable;
+
+ /**
+ * The action's constructor.
+ *
+ * @param previousAction the previous action
+ */
+ public GoToJuddiPortal(AbstractHtmlPageAction previousAction)
+ {
+ super(previousAction, null);
+ }
+
+ /* (non-Javadoc)
+ * @see com.xceptance.xlt.api.actions.AbstractAction#preValidate()
+ */
+ @Override
+ public void preValidate() throws Exception
+ {
+ HtmlPage page = getPreviousAction().getHtmlPage();
+
+ String clickableXPath = "id('navigation')/li[1]/a[1]";
+ clickable = HtmlPageUtils.findSingleHtmlElementByXPath(page, clickableXPath);
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.xceptance.xlt.api.actions.AbstractAction#execute()
+ */
+ @Override
+ public void execute() throws Exception
+ {
+ loadPageByClick(clickable, 60000);
+ }
+
+ /* (non-Javadoc)
+ * Ensure that all the necessary portlets show up on the page
+ */
+ @Override
+ public void postValidate() throws Exception
+ {
+ HtmlPage page = getHtmlPage();
+
+ //Common validator
+ CommonValidator.getInstance().validate(page);
+
+ //Check for the UDDIBrowser Portlet
+ String xpathToText0 = "id('portlets-left-column')/div[@class='portlet'][1]/div[@class='header'][1]/h2[@class='title'][1]";
+ HtmlElement txtElement0 = HtmlPageUtils.findSingleHtmlElementByXPath(page, xpathToText0);
+ Assert.assertTrue("Element does not contain text 'UDDIBrowser Portlet'", txtElement0.asText().contains("UDDIBrowser Portlet"));
+
+ //Check for the UDDISearch Portlet
+ String xpathToText1 = "id('portlets-right-column')/div[@class='portlet'][1]/div[@class='header'][1]/h2[@class='title'][1]";
+ HtmlElement txtElement1 = HtmlPageUtils.findSingleHtmlElementByXPath(page, xpathToText1);
+ Assert.assertTrue("Element does not contain text 'UDDISearch Portlet'", txtElement1.asText().contains("UDDISearch Portlet"));
+
+ //Check for the UDDISubscriptionNotification Portlet
+ String xpathToText2 = "id('portlets-left-column')/div[@class='portlet'][2]/div[@class='header'][1]/h2[@class='title'][1]";
+ HtmlElement txtElement2 = HtmlPageUtils.findSingleHtmlElementByXPath(page, xpathToText2);
+ Assert.assertTrue("Element does not contain text 'UDDISubscriptionNotification Portlet'", txtElement2.asText().contains("UDDISubscriptionNotification Portlet"));
+ }
+}
\ No newline at end of file
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Homepage.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Homepage.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Homepage.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Homepage.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2001-2010 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.xlt.action.http;
+
+import java.net.URL;
+
+import org.apache.juddi.xlt.validators.CommonValidator;
+import org.junit.Assert;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.xceptance.xlt.api.actions.AbstractHtmlPageAction;
+import com.xceptance.xlt.api.util.HtmlPageUtils;
+
+
+/**
+ * Retrieves the homepage for a given url.
+ *
+ */
+public class Homepage extends AbstractHtmlPageAction
+{
+
+ /**
+ * The homepage url to open
+ */
+ private URL url;
+ private String urlString;
+
+ /**
+ * Constructor to except the url parameter as a string
+ * @param urlString
+ */
+ public Homepage(String urlString)
+ {
+ super(null);
+ this.urlString = urlString;
+
+ }
+
+
+ @Override
+ public void preValidate() throws Exception
+ {
+ URL url = new URL(urlString);
+ this.url = url;
+
+ Assert.assertNotNull("Url is null", url);
+ }
+
+
+ @Override
+ protected void execute() throws Exception
+ {
+ loadPage(url);
+
+ }
+
+ @Override
+ protected void postValidate() throws Exception
+ {
+
+ //Get homepage
+ HtmlPage page = getHtmlPage();
+
+ //Common validator
+ CommonValidator.getInstance().validate(page);
+
+ //Validate login text id('content')/form/fieldset/legend
+ String xpathToLoginText = "id('content')/form/fieldset/legend";
+ HtmlElement loginText = HtmlPageUtils.findSingleHtmlElementByXPath(page, xpathToLoginText);
+ Assert.assertTrue("Element does not contain text 'Login to Pluto'", loginText.asText().contains("Login to Pluto"));
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Login.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Login.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Login.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Login.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2001-2010 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.xlt.action.http;
+
+import org.apache.juddi.xlt.validators.CommonValidator;
+import org.junit.Assert;
+
+import com.gargoylesoftware.htmlunit.html.ClickableElement;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.xceptance.xlt.api.actions.AbstractHtmlPageAction;
+import com.xceptance.xlt.api.util.HtmlPageUtils;
+
+/**
+ * Login to Pluto.
+ *
+ *
+ */
+@SuppressWarnings("deprecation")
+public class Login extends AbstractHtmlPageAction
+{
+ String username;
+ String password;
+ ClickableElement clickable;
+ HtmlForm form;
+
+ /**
+ * The action's constructor.
+ *
+ * @param previousAction the previous action
+ */
+ public Login(AbstractHtmlPageAction previousAction, String username, String password)
+ {
+ super(previousAction, null);
+ this.username = username;
+ this.password = password;
+ }
+
+ /* (non-Javadoc)
+ * @see com.xceptance.xlt.api.actions.AbstractAction#preValidate()
+ */
+ @Override
+ public void preValidate() throws Exception
+ {
+ HtmlPage page = getPreviousAction().getHtmlPage();
+
+ //Find the form
+ String formXPath = "id('content')/form[1]";
+ form = HtmlPageUtils.findSingleHtmlElementByXPath(page, formXPath);
+
+ //Find the login button
+ clickable = form.getElementById("j_login");
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.xceptance.xlt.api.actions.AbstractAction#execute()
+ */
+ @Override
+ public void execute() throws Exception
+ {
+
+ HtmlInput input0 = form.getInputByName("j_username");
+ input0.setValueAttribute(username);
+
+ HtmlInput input1 = form.getInputByName("j_password");
+ input1.setValueAttribute(password);
+
+ loadPageByClick(clickable, 10000);
+ }
+
+ /* (non-Javadoc)
+ * Ensure that the received page has an 'about' portelet on it.
+ */
+ @Override
+ public void postValidate() throws Exception
+ {
+ HtmlPage page = getHtmlPage();
+
+ String xpathToText0 = "id('portlets-left-column')/div[@class='portlet'][1]/div[@class='body'][1]/table[1]/tbody[1]/tr[1]/td[1]/h2[1]";
+ HtmlElement txtElement0 = HtmlPageUtils.findSingleHtmlElementByXPath(page, xpathToText0);
+ Assert.assertTrue("Element does not contain text 'About Pluto Portal Driver'", txtElement0.asText().contains("About Pluto Portal Driver"));
+
+ //Common validator
+ CommonValidator.getInstance().validate(page);
+ }
+}
\ No newline at end of file
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Logout.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Logout.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Logout.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/action/http/Logout.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2001-2010 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.xlt.action.http;
+
+import org.apache.juddi.xlt.validators.CommonValidator;
+import org.junit.Assert;
+
+import com.gargoylesoftware.htmlunit.html.ClickableElement;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.xceptance.xlt.api.actions.AbstractHtmlPageAction;
+import com.xceptance.xlt.api.util.HtmlPageUtils;
+
+/**
+ * Go to the jUDDI portal page.
+ *
+ *
+ */
+@SuppressWarnings("deprecation")
+public class Logout extends AbstractHtmlPageAction
+{
+ /**
+ * The element that got clicked to execute this action.
+ */
+
+ ClickableElement clickable;
+
+ /**
+ * The action's constructor.
+ *
+ * @param previousAction the previous action
+ */
+ public Logout(AbstractHtmlPageAction previousAction)
+ {
+ super(previousAction, null);
+ }
+
+ /* (non-Javadoc)
+ * @see com.xceptance.xlt.api.actions.AbstractAction#preValidate()
+ */
+ @Override
+ public void preValidate() throws Exception
+ {
+ HtmlPage page = getPreviousAction().getHtmlPage();
+
+ String clickableXPath = "id('logout')/a[1]";
+ clickable = HtmlPageUtils.findSingleHtmlElementByXPath(page, clickableXPath);
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.xceptance.xlt.api.actions.AbstractAction#execute()
+ */
+ @Override
+ public void execute() throws Exception
+ {
+ loadPageByClick(clickable, 10000);
+ }
+
+ /* (non-Javadoc)
+ * Ensure that all the necessary portlets show up on the page
+ */
+ @Override
+ public void postValidate() throws Exception
+ {
+ //Get homepage
+ HtmlPage page = getHtmlPage();
+
+ //Common validator
+ CommonValidator.getInstance().validate(page);
+
+ //Validate login text id('content')/form/fieldset/legend
+ String xpathToLoginText = "id('content')/form/fieldset/legend";
+ HtmlElement loginText = HtmlPageUtils.findSingleHtmlElementByXPath(page, xpathToLoginText);
+ Assert.assertTrue("Element does not contain text 'Login to Pluto'", loginText.asText().contains("Login to Pluto"));
+ }
+}
\ No newline at end of file
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/flow/RegisterBusinessFlow.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/flow/RegisterBusinessFlow.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/flow/RegisterBusinessFlow.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/flow/RegisterBusinessFlow.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2001-2010 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.xlt.flow;
+
+import org.apache.juddi.xlt.action.SOAP.RegisterBusiness;
+import org.apache.juddi.xlt.action.SOAP.RegisterService;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BusinessDetail;
+
+/**
+ * This flow registers a business with services under it. This should be
+ * used whenever a business is published since businesses without services
+ * are presently not searchable (2009-08-10).
+ *
+ * @author jeremi
+ *
+ */
+public class RegisterBusinessFlow
+{
+ BusinessDetail businessDetail;
+
+ /**
+ * Constructor. Publishes a business under the given name and publishes the
+ * specified number of services under it.
+ *
+ * @param authenticationToken
+ * @param businessName
+ * @param numberOfBusinessService
+ * @throws Throwable
+ */
+ public RegisterBusinessFlow(AuthToken authenticationToken, String businessName, int numberOfBusinessService) throws Throwable
+ {
+ //register the business under "businessName".
+ RegisterBusiness registerBusiness = new RegisterBusiness(authenticationToken, businessName);
+ registerBusiness.run();
+
+ businessDetail = registerBusiness.getBusinessDetail();
+
+ //get the returned business key and name.
+ String businesskey = businessDetail.getBusinessEntity().get(0).getBusinessKey();
+ String name = businessDetail.getBusinessEntity().get(0).getName().get(0).getValue();
+
+ //register numberOfBusinessService services under the new business.
+ for (int serviceCount = 0; serviceCount <= numberOfBusinessService; serviceCount++ )
+ {
+ RegisterService registerService = new RegisterService(authenticationToken, businesskey, name);
+ registerService.run();
+ }
+ }
+
+ /**
+ * Constructor. Publishes a business under the unique name and publishes the
+ * specified number of services under it.
+ *
+ * @param authenticationToken
+ * @param numberOfBusinessService
+ * @throws Throwable
+ */
+ public RegisterBusinessFlow(AuthToken authenticationToken, int numberOfBusinessService)throws Throwable
+ {
+ //register the business under a unique name.
+ RegisterBusiness registerBusiness = new RegisterBusiness(authenticationToken);
+ registerBusiness.run();
+
+ businessDetail = registerBusiness.getBusinessDetail();
+
+ //get the returned business key and name.
+ String businesskey = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getBusinessKey();
+ String name = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getName().get(0).getValue();
+
+ //register numberOfBusinessService services under the new business.
+ for (int serviceCount = 0; serviceCount < numberOfBusinessService; serviceCount++ )
+ {
+ RegisterService registerService = new RegisterService(authenticationToken, businesskey, name);
+ registerService.run();
+ }
+ }
+
+ /**
+ * Returns the BusinessDetail object.
+ * @return
+ */
+ public BusinessDetail getBusinessDetail()
+ {
+ return businessDetail;
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TDeleteService.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TDeleteService.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TDeleteService.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TDeleteService.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import org.apache.juddi.xlt.action.SOAP.FindServices;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.UnregisterService;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import org.uddi.api_v3.AuthToken;
+
+public class TDeleteService extends AbstractUDDIClientTestCase
+{
+ String name = getProperty("name");
+
+
+ @Test
+ public void deleteService() throws Throwable
+ {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ AuthToken authToken= getAuthenticationToken.getAuthenticationToken();
+
+ FindServices findServices = new FindServices(authToken);
+ findServices.run();
+
+ System.out.println(name);
+ System.out.println(findServices.getServiceInfo(name).getBusinessKey());
+ System.out.println(findServices.getServiceInfo(name).getServiceKey());
+ System.out.println(findServices.getServiceInfo(name).getName().get(0).getValue());
+
+ UnregisterService unregisterService =
+ new UnregisterService(authToken, findServices.getServiceInfo(name));
+ unregisterService.run();
+
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TFindServiceByName.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TFindServiceByName.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TFindServiceByName.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TFindServiceByName.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import org.apache.juddi.xlt.action.SOAP.FindServices;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+
+public class TFindServiceByName extends AbstractUDDIClientTestCase
+{
+ @Test
+ public void findBusiness() throws Throwable
+ {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ FindServices findServices = new FindServices(getAuthenticationToken.getAuthenticationToken());
+ findServices.run();
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TGetAuthToken.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TGetAuthToken.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TGetAuthToken.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TGetAuthToken.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+
+/**
+ * This test case simply gets an AuthToken from the juddi node
+ *
+ */
+public class TGetAuthToken extends AbstractUDDIClientTestCase {
+
+ /**
+ * Gets a AuthToken from Juddi
+ * @throws Throwable
+ */
+ @Test
+ public void test() throws Throwable {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TPublishSingleService.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TPublishSingleService.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TPublishSingleService.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TPublishSingleService.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.RegisterService;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import org.uddi.api_v3.BusinessInfo;
+
+/**
+ * This testcase publishes a single service to the "An Apache Node" Business
+ *
+ *
+ */
+public class TPublishSingleService extends AbstractUDDIClientTestCase {
+
+ @Test
+ public void test() throws Throwable {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ FindBusinessByName findBusiness = new FindBusinessByName(
+ getAuthenticationToken.getAuthenticationToken());
+ findBusiness.run();
+
+ for (BusinessInfo bi : findBusiness.getBusinessInfos().getBusinessInfo())
+ {
+ System.out.println(bi.getName().get(0).getValue());
+ }
+
+
+ RegisterService publishService = new RegisterService(
+ getAuthenticationToken.getAuthenticationToken(), findBusiness
+ .getBusinessInfo());
+ publishService.run();
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TRegisterBusinessWithServices.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TRegisterBusinessWithServices.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TRegisterBusinessWithServices.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TRegisterBusinessWithServices.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.RegisterBusiness;
+import org.apache.juddi.xlt.action.SOAP.RegisterService;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import com.xceptance.xlt.api.util.XltRandom;
+
+/**
+ * This testcase registers a new business and some services under it, and then tries to
+ * find the newly registered business.
+ *
+ *
+ */
+
+public class TRegisterBusinessWithServices extends AbstractUDDIClientTestCase
+{
+ /**
+ * This Test method will first get an Auth Token, save a business under a
+ * unique name, save a random number of service under that new business,
+ * and then try to find the same business all trough XML SOAP messages.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void registerBusiness() throws Throwable
+ {
+ //Get an Authentification Token.
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Generate a unique business name including a pseudo random number.
+ String uniqueBusinessName = "business no " + UUID.randomUUID().toString();
+
+ //Save business under generated name using Auth token.
+ RegisterBusiness registerBusiness = new RegisterBusiness(getAuthenticationToken.getAuthenticationToken(), uniqueBusinessName);
+ registerBusiness.run();
+
+ //Retrieve business key and name from returned BusinessDetail object. The key, given
+ //by jUUDI, will be submitted while publishing services under the business. The name
+ //is used to generate the services access point and later to verify that jUDDI can
+ //find the business again.
+ String businesskey = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getBusinessKey();
+ String businessName = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getName().get(0).getValue();
+
+ //Publish a random number of services (0 < number of services generate < maxNumberOfBusinessServices).
+ //If the property maxNumberOfBusinessServices is not found, the max will be the second argument
+ //of the getProperties method call (in this case 2)
+ int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
+
+ for (int serviceCount = 0; serviceCount < numberOfBusinessService; serviceCount++ )
+ {
+ RegisterService registerService = new RegisterService(
+ getAuthenticationToken.getAuthenticationToken(), businesskey, businessName);
+ registerService.run();
+ }
+
+ //Find the business that was published.
+ FindBusinessByName findBusinessByName = new FindBusinessByName(getAuthenticationToken.getAuthenticationToken(),
+ businessName);
+ findBusinessByName.run();
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TSubscription.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TSubscription.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TSubscription.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TSubscription.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.RegisterBusiness;
+import org.apache.juddi.xlt.action.SOAP.Subscribe;
+import org.junit.Test;
+import org.uddi.api_v3.AuthToken;
+import com.xceptance.xlt.api.tests.AbstractTestCase;
+
+public class TSubscription extends AbstractTestCase
+{
+ private String businessKey;
+ private String serviceKey;
+
+ /**
+ *
+ */
+ @Test
+ public void subscribe() throws Throwable
+ {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+ AuthToken authToken = getAuthenticationToken.getAuthenticationToken();
+
+ RegisterBusiness registerBusiness = new RegisterBusiness(authToken, "Abonement");
+ registerBusiness.run();
+
+ //FindBusinessByName findBusinessByName = new FindBusinessByName(authToken,
+ // businessName);
+ //if (findBusinessByName.preValidate())
+ //{
+ Subscribe subscribe = new Subscribe(authToken, registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getBusinessKey());
+ subscribe.run();
+
+ System.out.println(subscribe.getSubscriptionKey());
+ //}
+ //else
+ //{
+ // RegisterBusiness
+ //}
+ }
+
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TViewNode.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TViewNode.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TViewNode.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/TViewNode.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2001-2010 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.xlt.test;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import org.uddi.api_v3.BusinessInfo;
+import org.uddi.api_v3.ServiceInfo;
+
+/**
+ * Test case to print out business and service names in a node along with there
+ * keys.
+ *
+ * @author jeremi
+ *
+ */
+public class TViewNode extends AbstractUDDIClientTestCase
+{
+
+ @Test
+ public void registerBusiness() throws Throwable
+ {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ FindBusinessByName findBusinessByName = new FindBusinessByName(getAuthenticationToken.getAuthenticationToken());
+ findBusinessByName.run();
+
+ for(BusinessInfo bi : findBusinessByName.getBusinessInfos().getBusinessInfo())
+ {
+ System.out.println(bi.getName().get(0).getValue() + " - " + bi.getBusinessKey());
+ for (ServiceInfo si : bi.getServiceInfos().getServiceInfo())
+ {
+ System.out.println(" " + si.getName().get(0).getValue() + " - " + si.getBusinessKey());
+ }
+ }
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TFindBusinessBM.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TFindBusinessBM.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TFindBusinessBM.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TFindBusinessBM.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.benchmark;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import org.uddi.api_v3.BusinessInfo;
+import org.uddi.api_v3.ServiceInfo;
+
+import com.xceptance.xlt.api.data.DataProvider;
+
+/**
+ * This test case will query the jUDDI node and submit a random
+ * business name for which to search.
+ *
+ */
+public class TFindBusinessBM extends AbstractUDDIClientTestCase
+{
+ /**
+ * This methode will get a random unique business name
+ * from a list of previously published businesses and
+ * try to find it in the juddi node.
+ *
+ * @throws Throwable
+ */
+
+ @Test
+ public void findBusiness() throws Throwable
+ {
+
+ //Pick a company name from a previously generated list of business names.
+ //The file BusinessNames.txt used here was generated by TRegisterBusiness.
+ //It holds a list of unique strings that have already been entered in the
+ //juddi node as business names (a different business per name).
+ DataProvider names = new DataProvider("default/BusinessNames.txt");
+ String businessName = names.getRandomRow();
+
+ //Get an AuthToken.
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Find the random business by passing it's name and the AuthToken.
+ FindBusinessByName findBusinessByName = new FindBusinessByName(getAuthenticationToken.getAuthenticationToken(),
+ businessName);
+ findBusinessByName.run();
+
+ //Print out the business that was found and the services published under it.
+ for(BusinessInfo bi : findBusinessByName.getBusinessInfos().getBusinessInfo())
+ {
+ //Print out business name and key.
+ System.out.println(bi.getName().get(0).getValue() + " - " + bi.getBusinessKey());
+ for (ServiceInfo si : bi.getServiceInfos().getServiceInfo())
+ {
+ //Print out service name and key.
+ System.out.println(" " + si.getName().get(0).getValue() + " - " + si.getBusinessKey());
+ }
+ }
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TRegisterBusinessBM.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TRegisterBusinessBM.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TRegisterBusinessBM.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TRegisterBusinessBM.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.benchmark;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.RegisterBusiness;
+import org.apache.juddi.xlt.action.SOAP.RegisterService;
+import org.apache.juddi.xlt.flow.RegisterBusinessFlow;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+
+import com.xceptance.xlt.api.util.XltLogger;
+import com.xceptance.xlt.api.util.XltRandom;
+
+/**
+ * This testcase registers a new business and some services under it, and then
+ * prints out the name of the business to file.
+ *
+ */
+
+public class TRegisterBusinessBM extends AbstractUDDIClientTestCase
+{
+ /**
+ * This Test method will first get an AuthToken, save a business under a
+ * unique name, save a random number of service under that new business,
+ * and then write the name of the newly published business to a file.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void registerBusiness() throws Throwable
+ {
+ //Get an Authentification Token.
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Generate a unique business name including a pseudo random number.
+ String uniqueBusinessName = "business no " + UUID.randomUUID().toString();
+
+ //Publish a random number of services (0 < number of services generate < maxNumberOfBusinessServices).
+ //If the property maxNumberOfBusinessServices is not found, the max will be the second argument
+ //of the getProperties method call (in this case 2
+ int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
+
+ //Save business under generated name using Auth token and save the above random number of services.
+ RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(getAuthenticationToken.getAuthenticationToken(),
+ uniqueBusinessName, numberOfBusinessService);
+
+ //Get returned business name (should be the same).
+ String businessName = registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0).getName().get(0).getValue();
+
+ //Write business name to file to perform valid searches later.
+ try
+ {
+ BufferedWriter orders = new BufferedWriter(new FileWriter("/home/jeremi/Desktop/BusinessNames.txt", true));
+ orders.write(businessName + "\n");
+ orders.close();
+
+ }
+ catch (IOException e)
+ {
+ XltLogger.runTimeLogger.info("Could not write to BusinessNames.txt");
+ }
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitBM.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitBM.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitBM.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitBM.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.benchmark;
+
+import java.util.UUID;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.RegisterBusiness;
+import org.apache.juddi.xlt.action.SOAP.RegisterService;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import com.xceptance.xlt.api.util.XltRandom;
+
+/**
+ * This test case registers a new business and some services under it, and then tries to
+ * run a search for all businesses. This is done to find out how many businesses can be
+ * returned without error. This test should be run on it's own on a jUDDI node with a
+ * database empty of businesses.
+ *
+ */
+
+public class TSearchableLimitBM extends AbstractUDDIClientTestCase
+{
+ /**
+ * This Test method will first get an AuthToken, save a business under a
+ * unique name, save a random number of service under that new business,
+ * and then try to find the same business all trough XML SOAP messages.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void registerBusiness() throws Throwable
+ {
+ //Get an Authentication Token.
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Generate a unique business name including a pseudo random uuid.
+ String uniqueBusinessName = "business no " + UUID.randomUUID().toString();
+
+ //Save business under generated name using Auth token.
+ RegisterBusiness registerBusiness = new RegisterBusiness(getAuthenticationToken.getAuthenticationToken(), uniqueBusinessName);
+ registerBusiness.run();
+
+ //Retrieve business key and name from returned BusinessDetail object. The key, given
+ //by jUUDI, will be submitted while publishing services under the business. The name
+ //is used to generate the services access point and later to verify that jUDDI can
+ //find the business again.
+ String businesskey = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getBusinessKey();
+ String businessName = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getName().get(0).getValue();
+
+ //Publish a single services under the new business.
+ RegisterService registerService = new RegisterService(
+ getAuthenticationToken.getAuthenticationToken(), businesskey, businessName);
+ registerService.run();
+
+ //Find all businesses. This should return a SOAP message with a list of all businesses.
+ FindBusinessByName findBusinessByName = new FindBusinessByName(getAuthenticationToken.getAuthenticationToken(),
+ "%");
+ findBusinessByName.run();
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitStaticAuthTokenBM.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitStaticAuthTokenBM.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitStaticAuthTokenBM.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/benchmark/TSearchableLimitStaticAuthTokenBM.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.benchmark;
+
+import java.util.UUID;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetStaticAuthToken;
+import org.apache.juddi.xlt.action.SOAP.RegisterBusiness;
+import org.apache.juddi.xlt.action.SOAP.RegisterService;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+
+/**
+ * This test case registers a new business and some services under it, and then tries to
+ * run a search for all businesses. This is done to find out how many businesses can be
+ * returned without error. This test should be run on it's own on a jUDDI node with a
+ * database empty of businesses. In this case the system is only ever queried for one
+ * AuthToken and reuses the same every time.
+ *
+ */
+
+public class TSearchableLimitStaticAuthTokenBM extends AbstractUDDIClientTestCase
+{
+ /**
+ * This Test method will first get an AuthToken, save a business under a
+ * unique name, save a random number of service under that new business,
+ * and then try to find the same business all trough XML SOAP messages.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void registerBusiness() throws Throwable
+ {
+ //Get an Authentication Token.
+ GetStaticAuthToken getStaticAuthToken = new GetStaticAuthToken();
+ getStaticAuthToken.run();
+
+ //Generate a unique business name including a pseudo random uuid.
+ String uniqueBusinessName = "business no " + UUID.randomUUID().toString();
+
+ //Save business under generated name using Auth token.
+ RegisterBusiness registerBusiness = new RegisterBusiness(getStaticAuthToken.getAuthenticationToken(),
+ uniqueBusinessName);
+ registerBusiness.run();
+
+ //Retrieve business key and name from returned BusinessDetail object. The key, given
+ //by jUUDI, will be submitted while publishing services under the business. The name
+ //is used to generate the services access point and later to verify that jUDDI can
+ //find the business again.
+ String businesskey = registerBusiness.getBusinessDetail().getBusinessEntity().get(0).getBusinessKey();
+ String businessName = registerBusiness.getBusinessDetail().getBusinessEntity()
+ .get(0).getName().get(0).getValue();
+
+ //Publish a single services under the new business.
+ RegisterService registerService = new RegisterService(
+ getStaticAuthToken.getAuthenticationToken(), businesskey, businessName);
+ registerService.run();
+
+ //Find all businesses. This should return a SOAP message with a list of all businesses.
+ FindBusinessByName findBusinessByName = new FindBusinessByName(getStaticAuthToken.getAuthenticationToken(),
+ "%");
+ findBusinessByName.run();
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/http/TBrowse.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/http/TBrowse.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/http/TBrowse.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/http/TBrowse.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.http;
+
+import org.apache.juddi.xlt.action.http.BrowseJuddiNode;
+import org.apache.juddi.xlt.action.http.GoToJuddiPortal;
+import org.apache.juddi.xlt.action.http.Homepage;
+import org.apache.juddi.xlt.action.http.Login;
+import org.junit.Test;
+
+import com.xceptance.xlt.api.tests.AbstractTestCase;
+import com.xceptance.xlt.api.actions.AbstractHtmlPageAction;
+
+/**
+ * Browse the UDDI through the UDDIBrowser Portlet
+ */
+public class TBrowse extends AbstractTestCase
+{
+ String username = getProperty("username");
+ String password = getProperty("password");
+ String urlString = getProperty("url");
+ AbstractHtmlPageAction lastAction;
+
+ @Test
+ public void browse() throws Throwable
+ {
+ Homepage homepage = new Homepage(urlString);
+ homepage.run();
+ lastAction = homepage;
+
+ Login login = new Login(lastAction, username, password);
+ login.run();
+ lastAction = login;
+
+ lastAction.getWebClient().setJavaScriptEnabled(true);
+
+ GoToJuddiPortal goToJuddiPortal = new GoToJuddiPortal(lastAction);
+ goToJuddiPortal.run();
+ lastAction = goToJuddiPortal;
+
+ BrowseJuddiNode browseJuddiNode = new BrowseJuddiNode(lastAction);
+ browseJuddiNode.run();
+ lastAction = browseJuddiNode;
+
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TDeleteBusinessPT.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TDeleteBusinessPT.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TDeleteBusinessPT.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TDeleteBusinessPT.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.performance;
+
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.action.SOAP.UnregisterBusiness;
+import org.apache.juddi.xlt.flow.RegisterBusinessFlow;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BusinessEntity;
+
+import com.xceptance.xlt.api.data.DataPool;
+import com.xceptance.xlt.api.data.GeneralDataProvider;
+import com.xceptance.xlt.api.util.XltRandom;
+
+/**
+ *
+ * @author jeremi
+ *
+ */
+public class TDeleteBusinessPT extends AbstractUDDIClientTestCase
+{
+ //Create a pool that will be populated with some business entities that
+ //have been published to the jUDDI node.
+ static DataPool<BusinessEntity> dataPool = new DataPool<BusinessEntity>(20, 50);
+
+ //Uses lists in config/data/default/
+ GeneralDataProvider data = GeneralDataProvider.getInstance();
+
+ @Test
+ public void deleteBusiness() throws Throwable
+ {
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Get the AuthToken
+ AuthToken authToken= getAuthenticationToken.getAuthenticationToken();
+
+ BusinessEntity businessEntity;
+
+ // If there are no businesses in the data pool submit one with a rate of 100
+ // to ensure that it will be entered
+ if(dataPool.getSize() <= 10)
+ {
+ //Add a business to the pool since there are none
+ addBusinessToPool(authToken, 100);
+ }
+ else
+ {
+ //Get a business entity from the pool.
+ businessEntity= dataPool.getDataElement();
+
+ //If the entity is null (pool is empty), add an element
+ if(businessEntity == null)
+ {
+ //Put another one in
+ addBusinessToPool(authToken);
+ }
+ else
+ {
+ //Delete the business gotten from the pool.
+ UnregisterBusiness unregisterBusiness = new UnregisterBusiness(authToken, businessEntity);
+ unregisterBusiness.run();
+ }
+ }
+
+ }
+
+ /**
+ * Adds a new business to the juddi node and adds
+ * it's BussinessEntity to the data pool.
+ *
+ * @param authToken
+ * @throws Throwable
+ */
+
+ private void addBusinessToPool(AuthToken authToken, int rate) throws Throwable
+ {
+ //Pick a random number of services to publish under the business.
+ int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
+
+ //Pick a company name from a previously generated list of business names.
+ String businessName = data.getCompany(false);
+
+ //Register the business with services
+ RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(authToken,
+ businessName + "1TDel", numberOfBusinessService);
+
+ //Add the returned BusinessEntity to the data pool.
+ dataPool.add(registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0), rate);
+ }
+
+ /**
+ * Adds a new business to the juddi node and try to
+ * add it's BussinessEntity to the data pool (may be randomly
+ * rejected).
+ *
+ * @param authToken
+ * @throws Throwable
+ */
+
+ private void addBusinessToPool(AuthToken authToken) throws Throwable
+ {
+ //Pick a random number of services to publish under the business.
+ int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
+
+ //Pick a company name from a previously generated list of business names.
+ String businessName = data.getCompany(false);
+
+ //Register the business with services
+ RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(authToken,
+ businessName, numberOfBusinessService);
+
+ //Add the returned BusinessEntity to the data pool.
+ dataPool.add(registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0));
+ }
+}
+
+
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TFindBusinessPT.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TFindBusinessPT.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TFindBusinessPT.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TFindBusinessPT.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.performance;
+
+import org.apache.juddi.xlt.action.SOAP.FindBusinessByName;
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.flow.RegisterBusinessFlow;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+import org.uddi.api_v3.BusinessEntity;
+import com.xceptance.xlt.api.data.DataPool;
+import com.xceptance.xlt.api.data.GeneralDataProvider;
+import com.xceptance.xlt.api.util.XltRandom;
+
+/**
+ * This test case will register businesses in the jUDDI node so
+ * that they can be searched for later.
+ *
+ */
+public class TFindBusinessPT extends AbstractUDDIClientTestCase
+{
+ //Create a pool that will be populated with some business entities that
+ //have been published to the jUDDI node.
+ static private DataPool<BusinessEntity> dataPool = new DataPool<BusinessEntity>(100, 50);
+
+ /**
+ * This method will search for a business by getting an element
+ * from the pool. If there aren't any it will generate some and
+ * then get search for this business. It will also reoffer the
+ * element to the pool once the business was found.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void findBusiness() throws Throwable
+ {
+ //Get an AuthToken.
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Uses lists in config/data/default/
+ GeneralDataProvider data = GeneralDataProvider.getInstance();
+
+ //Pick a random number of services to publish under the business.
+ int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
+
+ if(dataPool.getSize() <= 50)
+ {
+
+ //Pick a company name from a previously generated list of business names.
+ String businessName = data.getCompany(false);
+
+ //Register the business with services
+ RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(getAuthenticationToken.getAuthenticationToken(),
+ businessName, numberOfBusinessService);
+
+ Thread.sleep(4000);
+
+ //Add the returnThread.sleep(8000);ed BusinessEntity to the data pool.
+ dataPool.add(registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0), 100);
+
+ }
+ else
+ {
+ //Get a business entity from the pool.
+ BusinessEntity businessEntity= dataPool.getDataElement();
+
+ if (businessEntity == null)
+ {
+ //Pick a company name from a previously generated list of business names.
+ String businessName = data.getCompany(false);
+
+ //Register the business with services
+ RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(getAuthenticationToken.getAuthenticationToken(),
+ businessName, numberOfBusinessService);
+
+ Thread.sleep(4000);
+
+ //Add the returnThread.sleep(8000);ed BusinessEntity to the data pool.
+ dataPool.add(registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0), 100);
+ }
+ else
+ {
+ //Find the random business by passing it's name and the AuthToken.
+ FindBusinessByName findBusinessByName = new FindBusinessByName(getAuthenticationToken.getAuthenticationToken(),
+ businessEntity.getName().get(0).getValue());
+ findBusinessByName.run();
+
+ //Offer the business entity back to the pool with 50% chance that it will be rejected
+ //if the pool is full.
+ dataPool.add(businessEntity);
+ }
+
+
+ }
+
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TRegisterBusinessPT.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TRegisterBusinessPT.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TRegisterBusinessPT.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/test/performance/TRegisterBusinessPT.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2001-2010 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.xlt.test.performance;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.apache.juddi.xlt.action.SOAP.GetAuthenticationToken;
+import org.apache.juddi.xlt.flow.RegisterBusinessFlow;
+import org.apache.juddi.xlt.util.AbstractUDDIClientTestCase;
+import org.junit.Test;
+
+import com.xceptance.xlt.api.util.XltLogger;
+import com.xceptance.xlt.api.util.XltRandom;
+
+/**
+ * This testcase registers a new business and some services under it, and then
+ * prints out the name of the business to file.
+ *
+ */
+
+public class TRegisterBusinessPT extends AbstractUDDIClientTestCase
+{
+ /**
+ * This Test method will first get an AuthToken, save a business under a
+ * unique name, save a random number of service under that new business,
+ * and then write the name of the newly published business to a file.
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void registerBusiness() throws Throwable
+ {
+ //Get an Authentification Token.
+ GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
+ getAuthenticationToken.run();
+
+ //Generate a unique business name including a pseudo random number.
+ String uniqueBusinessName = "business no " + UUID.randomUUID().toString();
+
+ //Publish a random number of services (0 < number of services generate < maxNumberOfBusinessServices).
+ //If the property maxNumberOfBusinessServices is not found, the max will be the second argument
+ //of the getProperties method call (in this case 2
+ int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
+
+ //Save business under generated name using Auth token and save the above random number of services.
+ RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(getAuthenticationToken.getAuthenticationToken(),
+ uniqueBusinessName, numberOfBusinessService);
+ }
+
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/AbstractUDDIClientTestCase.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/AbstractUDDIClientTestCase.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/AbstractUDDIClientTestCase.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/AbstractUDDIClientTestCase.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2001-2010 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.xlt.util;
+
+import java.util.List;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+
+import com.xceptance.xlt.api.tests.AbstractTestCase;
+
+public class AbstractUDDIClientTestCase extends AbstractTestCase
+{
+ protected void registerService(BindingProvider bindingProvider)
+ {
+ Binding binding = bindingProvider.getBinding();
+ List<Handler> handlerChain = binding.getHandlerChain();
+
+ handlerChain.add(new LoggingHandler());
+
+ // set the handler chain again for the changes to take effect
+ binding.setHandlerChain(handlerChain);
+ }
+
+ protected void setHttpSessionManagementEnabled(BindingProvider bindingProvider, boolean state)
+ {
+ bindingProvider.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.valueOf(state));
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/JUDDIServiceProvider.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/JUDDIServiceProvider.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/JUDDIServiceProvider.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/JUDDIServiceProvider.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2001-2010 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.xlt.util;
+
+import java.util.List;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.log4j.helpers.Loader;
+import org.uddi.api_v3.client.config.ClientConfig;
+import org.uddi.api_v3.client.config.Property;
+import org.uddi.api_v3.client.transport.Transport;
+import org.uddi.api_v3.client.transport.TransportException;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDISubscriptionPortType;
+
+public class JUDDIServiceProvider {
+
+ private static final JUDDIServiceProvider instance = new JUDDIServiceProvider();
+
+ private Transport transporter;
+
+ private UDDISecurityPortType securityService;
+
+ private UDDIInquiryPortType inquiryService;
+
+ private UDDIPublicationPortType publishService;
+
+ private UDDISubscriptionPortType subscriptionService;
+
+ private JUDDIServiceProvider() {
+ try {
+ String clazz = ClientConfig.getConfiguration().getString(
+ Property.UDDI_PROXY_TRANSPORT,
+ Property.DEFAULT_UDDI_PROXY_TRANSPORT);
+ Class<?> transportClass = Loader.loadClass(clazz);
+
+ if (transportClass != null) {
+ transporter = (Transport) transportClass.newInstance();
+ } else {
+ throw new IllegalStateException("Could not set up transporter");
+ }
+
+ securityService = transporter.getUDDISecurityService();
+ inquiryService = transporter.getUDDIInquiryService();
+ publishService = transporter.getUDDIPublishService();
+ subscriptionService = transporter.getUDDISubscriptionService();
+
+ registerService((BindingProvider) securityService);
+ registerService((BindingProvider) inquiryService);
+ registerService((BindingProvider) publishService);
+ registerService((BindingProvider) subscriptionService);
+
+ } catch (ConfigurationException e) {
+ throw new IllegalStateException("Failed to read configuration", e);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalStateException("Unable to load transporter class",
+ e);
+ } catch (InstantiationException e) {
+ throw new IllegalStateException(
+ "Unable to instantiate transporter class", e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(
+ "Illegal access instantiating transporter class", e);
+ } catch (TransportException e) {
+ throw new IllegalStateException("Unable to retrieve service", e);
+ }
+
+ }
+
+ public static UDDISecurityPortType getSecurityService()
+ throws TransportException {
+ return instance.securityService;
+ }
+
+ public static UDDIInquiryPortType getInquiryService()
+ throws TransportException {
+ return instance.inquiryService;
+ }
+
+ public static UDDIPublicationPortType getPublishService()
+ throws TransportException {
+ return instance.publishService;
+ }
+
+ public static UDDISubscriptionPortType getSubscriptionService()
+ throws TransportException {
+ return instance.subscriptionService;
+}
+
+ private void registerService(BindingProvider bindingProvider) {
+ Binding binding = bindingProvider.getBinding();
+ List<Handler> handlerChain = binding.getHandlerChain();
+
+ handlerChain.add(new LoggingHandler());
+
+ // set the handler chain again for the changes to take effect
+ binding.setHandlerChain(handlerChain);
+ }
+}
Added: webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/LoggingHandler.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/LoggingHandler.java?rev=897513&view=auto
==============================================================================
--- webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/LoggingHandler.java (added)
+++ webservices/juddi/trunk/qa/juddi-xlt/src/org/apache/juddi/xlt/util/LoggingHandler.java Sat Jan 9 18:28:54 2010
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2001-2010 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.xlt.util;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Map.Entry;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.xceptance.common.xml.DomUtils;
+import com.xceptance.xlt.api.engine.RequestData;
+import com.xceptance.xlt.api.engine.Session;
+
+/**
+ *
+ */
+public class LoggingHandler implements SOAPHandler<SOAPMessageContext>
+{
+ private static final Log LOG = LogFactory.getLog(LoggingHandler.class);
+
+ /**
+ *
+ */
+ private static final String INBOUND_MESSAGE_FORMAT = "Inbound Message:\nHTTP Headers:\n%s\nSoap Message:\n%s\nMessage Context Properties:\n%s";
+
+ /**
+ *
+ */
+ private static final String OUTBOUND_MESSAGE_FORMAT = "Outbound Message:\nHTTP Headers:\n%s\nSoap Message:\n%s\nMessage Context Properties:\n%s";
+
+ /**
+ *
+ */
+ private static final String XLT_FAULT = "com.xceptance.xlt.ws.handler.fault";
+
+ /**
+ *
+ */
+ private static final String XLT_REQUEST_DATA = "com.xceptance.xlt.ws.handler.requestData";
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close(MessageContext context)
+ {
+ unregisterMessage(context);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set<QName> getHeaders()
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean handleFault(SOAPMessageContext context)
+ {
+ logMessage(context);
+
+ setFaultReceived(context);
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean handleMessage(SOAPMessageContext context)
+ {
+ logMessage(context);
+
+ if (isOutboundMessage(context))
+ {
+ registerMessage(context);
+ }
+
+ return true;
+ }
+
+ private String getContentType(MessageContext context)
+ {
+ // TODO: get it from Content-type HTTP header
+ return "text/xml";
+ }
+
+ private String getOperationName(SOAPMessageContext context)
+ {
+ // service is optional :-(
+ QName service = (QName) context.get(MessageContext.WSDL_SERVICE);
+ if (service == null)
+ {
+ service = new QName("<unknown>");
+ }
+
+ // operation is optional :-(
+ QName operation = (QName) context.get(MessageContext.WSDL_OPERATION);
+ if (operation == null)
+ {
+ // operation = new QName("<unknown>");
+
+ try
+ {
+ operation = new QName(context.getMessage().getSOAPBody().getFirstChild().getLocalName());
+ }
+ catch (SOAPException ex)
+ {
+ throw new RuntimeException("", ex);
+ }
+ }
+
+ return service.getLocalPart() + "." + operation.getLocalPart();
+ }
+
+ private int getResponseCode(MessageContext context)
+ {
+ Integer responseCode = (Integer) context.get(MessageContext.HTTP_RESPONSE_CODE);
+
+ return responseCode.intValue();
+ }
+
+ private String getServiceUrl(MessageContext context)
+ {
+ // TODO: service URL is optional :-(
+ return "???";
+ }
+
+ private boolean isFaultReceived(MessageContext context)
+ {
+ return context.containsKey(XLT_FAULT);
+ }
+
+ private boolean isOutboundMessage(MessageContext context)
+ {
+ Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ return outboundProperty.booleanValue();
+ }
+
+ private void logMessage(SOAPMessageContext context)
+ {
+ boolean isOutbound = isOutboundMessage(context);
+
+ // optionally append the HTTP request/response headers
+ String headersKey = isOutbound ? MessageContext.HTTP_REQUEST_HEADERS : MessageContext.HTTP_RESPONSE_HEADERS;
+ StringBuilder httpHeaders = new StringBuilder();
+ Map<Object, Object> headers = (Map<Object, Object>) context.get(headersKey);
+ if (headers != null && headers.size() > 0)
+ {
+ for (Entry<Object, Object> entry : headers.entrySet())
+ {
+ httpHeaders.append("- " + entry.getKey() + " = " + entry.getValue() + "\n");
+ }
+ }
+
+ // append the SOAP message
+ String soapMessage = DomUtils.prettyPrintNode(context.getMessage().getSOAPPart());
+
+ // append the message context properties
+ StringBuilder messageContextProperties = new StringBuilder();
+ TreeMap<String, Object> sortedContextProperties = new TreeMap<String, Object>(context);
+ for (Entry<String, Object> entry : sortedContextProperties.entrySet())
+ {
+ messageContextProperties.append("- " + entry.getKey() + " = " + entry.getValue() + "\n");
+ }
+
+ // finally log all
+ String format = isOutbound ? OUTBOUND_MESSAGE_FORMAT : INBOUND_MESSAGE_FORMAT;
+ LOG.debug(String.format(format, httpHeaders, soapMessage, messageContextProperties));
+ }
+
+ private void registerMessage(SOAPMessageContext context)
+ {
+ RequestData reqData = new RequestData(getOperationName(context));
+ reqData.setBytesSent(0);
+
+ context.put(XLT_REQUEST_DATA, reqData);
+ context.setScope(XLT_REQUEST_DATA, MessageContext.Scope.HANDLER);
+ }
+
+ private void setFaultReceived(MessageContext context)
+ {
+ context.put(XLT_FAULT, true);
+ }
+
+ private void unregisterMessage(MessageContext context)
+ {
+ RequestData reqData = (RequestData) context.get(XLT_REQUEST_DATA);
+
+ if (reqData != null)
+ {
+ reqData.setRunTime();
+ reqData.setFailed(isFaultReceived(context));
+ reqData.setBytesReceived(0);
+ reqData.setResponseCode(getResponseCode(context));
+ reqData.setUrl(getServiceUrl(context));
+ reqData.setContentType(getContentType(context));
+
+ Session.getCurrent().getDataManager().logDataRecord(reqData);
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org