juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject juddi git commit: JUDDI-905 basic tests added
Date Fri, 02 Jan 2015 20:29:29 GMT
Repository: juddi
Updated Branches:
  refs/heads/master d0bbde646 -> 40b1d674d


JUDDI-905 basic tests added


Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/40b1d674
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/40b1d674
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/40b1d674

Branch: refs/heads/master
Commit: 40b1d674d82d52b9db9243084143daac01d32ca4
Parents: d0bbde6
Author: Alex <alexoree@apache.org>
Authored: Fri Jan 2 15:29:25 2015 -0500
Committer: Alex <alexoree@apache.org>
Committed: Fri Jan 2 15:29:25 2015 -0500

----------------------------------------------------------------------
 .../apache/juddi/v3/client/UDDIConstants.java   |   1 +
 .../java/org/apache/juddi/v3/tck/TckCommon.java |   2 +-
 .../java/org/apache/juddi/tckrunner/App.java    |   1 +
 .../UDDI_040_PerformanceIntegrationTest.java    | 364 +++++++++++++++++++
 4 files changed, 367 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/40b1d674/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
index dd29f9e..2a38438 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
@@ -688,4 +688,5 @@ public interface UDDIConstants {
           */
         public static final String  CategorizationTypes="uddi-org:categorization:types";
         
+        public static final String General_Keywords="uddi:uddi.org:categorization:general_keywords";
 }

http://git-wip-us.apache.org/repos/asf/juddi/blob/40b1d674/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java
----------------------------------------------------------------------
diff --git a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java
index a414000..ce8d05c 100644
--- a/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java
+++ b/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckCommon.java
@@ -325,7 +325,7 @@ public class TckCommon {
                 return sb.toString();
         }
 
-        static void PrintMarker() {
+        public static void PrintMarker() {
                 System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>
FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
                 System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>
FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
                 System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>
FAILURE MARKER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");

http://git-wip-us.apache.org/repos/asf/juddi/blob/40b1d674/uddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
----------------------------------------------------------------------
diff --git a/uddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java b/uddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
index 43e9029..ec24bc6 100644
--- a/uddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
+++ b/uddi-tck-runner/src/main/java/org/apache/juddi/tckrunner/App.java
@@ -79,6 +79,7 @@ public class App {
                                 org.apache.juddi.v3.tck.UDDI_030_BusinessEntityIntegrationTest.class,
                                 org.apache.juddi.v3.tck.UDDI_030_BusinessEntityLoadIntegrationTest.class,
                                 org.apache.juddi.v3.tck.UDDI_040_BusinessServiceIntegrationTest.class,
+                                org.apache.juddi.v3.tck.UDDI_040_PerformanceIntegrationTest.class,
                                 org.apache.juddi.v3.tck.UDDI_040_BusinessServiceLoadIntegrationTest.class,
                                 org.apache.juddi.v3.tck.UDDI_050_BindingTemplateIntegrationTest.class,
                                 org.apache.juddi.v3.tck.UDDI_060_PublisherAssertionIntegrationTest.class,

http://git-wip-us.apache.org/repos/asf/juddi/blob/40b1d674/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_040_PerformanceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_040_PerformanceIntegrationTest.java
b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_040_PerformanceIntegrationTest.java
new file mode 100644
index 0000000..fb33b33
--- /dev/null
+++ b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_040_PerformanceIntegrationTest.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright 2015 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.v3.tck;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.xml.ws.BindingProvider;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.uddi.api_v3.BusinessDetail;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.DeleteBusiness;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.SaveBusiness;
+import org.uddi.v3_service.UDDIInquiryPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+/**
+ * Runs a number of tests and calculates operations/second as part of a unit
+ * test
+ *
+ * @author alex o'ree
+ */
+public class UDDI_040_PerformanceIntegrationTest {
+
+        static Map<String, Double> data = new HashMap<String, Double>();
+        protected static Log logger = LogFactory.getLog(UDDI_040_BusinessServiceIntegrationTest.class);
+        protected static TckTModel tckTModelSam = null;
+        protected static TckBusiness tckBusinessSam = null;
+        protected static TckBusinessService tckBusinessServiceSam = null;
+        protected static UDDIInquiryPortType inquirySam = null;
+        protected static UDDIPublicationPortType publishSam = null;
+
+        protected static String authInfoSam = null;
+        private static UDDIClient manager;
+
+        @AfterClass
+        public static void stopManager() throws Exception {
+                if (!TckPublisher.isEnabled()) {
+                        return;
+                }
+
+                tckTModelSam.deleteCreatedTModels(authInfoSam);
+                manager.stop();
+                Iterator<Map.Entry<String, Double>> iterator = data.entrySet().iterator();
+                File f = new File("pref-rpt-" + System.currentTimeMillis() + ".txt");
+                PrintWriter writer = new PrintWriter(f, "UTF-8");
+
+                while (iterator.hasNext()) {
+                        Map.Entry<String, Double> next = iterator.next();
+                        logger.info(next.getKey() + " = " + next.getValue() + " tx/ms");
+                        writer.write(next.getKey() + " = " + next.getValue() + " tx/ms" +
System.getProperty("line.separator"));
+
+                }
+                writer.close();
+                f = null;
+                TckCommon.PrintMarker();
+
+        }
+
+        @BeforeClass
+        public static void startManager() throws ConfigurationException {
+                if (!TckPublisher.isEnabled()) {
+                        return;
+                }
+                manager = new UDDIClient();
+                manager.start();
+
+                logger.debug("Getting auth tokens..");
+                try {
+                        Transport transport = manager.getTransport("uddiv3");
+                        UDDISecurityPortType security = transport.getUDDISecurityService();
+                        authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(),
TckPublisher.getSamPassword());
+
+                        UDDIPublicationPortType publication = null;
+                        UDDIInquiryPortType inquiry = null;
+
+                        transport = manager.getTransport("uddiv3");
+                        publication = transport.getUDDIPublishService();
+                        inquiry = transport.getUDDIInquiryService();
+                        if (!TckPublisher.isUDDIAuthMode()) {
+                                TckSecurity.setCredentials((BindingProvider) publication,
TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword());
+                                TckSecurity.setCredentials((BindingProvider) inquiry, TckPublisher.getSamPublisherId(),
TckPublisher.getSamPassword());
+                        }
+                        tckTModelSam = new TckTModel(publication, inquiry);
+                        tckBusinessSam = new TckBusiness(publication, inquiry);
+                        tckBusinessServiceSam = new TckBusinessService(publication, inquiry);
+                        inquirySam = inquiry;
+                        publishSam = publication;
+
+                } catch (Exception e) {
+                        logger.error(e.getMessage(), e);
+                        Assert.fail("Could not obtain authInfo token.");
+                }
+        }
+        long counter = 30;
+
+        @Test
+        public void testInsertFlatBusiness() throws Exception {
+                logger.info("Performace test, inserting " + counter + " flat businesses");
+                BusinessEntity be = new BusinessEntity();
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(authInfoSam);
+                List<String> biz = new ArrayList<String>();
+                long start = System.currentTimeMillis();
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        be.getName().clear();
+                        be.getName().add(new Name("Name " + i, null));
+                        sb.getBusinessEntity().clear();
+                        sb.getBusinessEntity().add(be);
+                        BusinessDetail saveBusiness = publishSam.saveBusiness(sb);
+                        biz.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+                }
+                start = System.currentTimeMillis() - start;
+                data.put("Insert Flat Businesses 1x", (double)counter/(double)start );
+                logger.info("Insert flat businesses took 1x" + start);
+
+                start = System.currentTimeMillis();
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        DeleteBusiness deleteBusiness = new DeleteBusiness();
+                        deleteBusiness.setAuthInfo(authInfoSam);
+                        deleteBusiness.getBusinessKey().add(biz.get(i));
+                        publishSam.deleteBusiness(deleteBusiness);
+
+                }
+                start = System.currentTimeMillis() - start;
+                data.put("Delete Flat Businesses 1x", (double)counter/(double)start );
+                logger.info("Insert flat businesses took 1x" + start);
+
+        }
+
+        @Test
+        public void testInsertFlatBusinessBulk() throws Exception {
+                logger.info("Performace test, inserting " + counter + " flat businesses bulk");
+                BusinessEntity be = new BusinessEntity();
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(authInfoSam);
+                List<String> biz = new ArrayList<String>();
+
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        be.getName().clear();
+                        be.getName().add(new Name("Name " + i, null));
+                        sb.getBusinessEntity().clear();
+                        sb.getBusinessEntity().add(be);
+
+                }
+
+                long start = System.currentTimeMillis();
+                BusinessDetail saveBusiness = publishSam.saveBusiness(sb);
+
+                start = System.currentTimeMillis() - start;
+                data.put("Insert Flat Businesses Bulk", (double)counter/(double)start );
+                logger.info("Insert flat businesses took Bulk" + start);
+
+                DeleteBusiness deleteBusiness = new DeleteBusiness();
+                deleteBusiness.setAuthInfo(authInfoSam);
+
+                for (int i = 0; i < saveBusiness.getBusinessEntity().size(); i++) {
+                        deleteBusiness.getBusinessKey().add(saveBusiness.getBusinessEntity().get(i).getBusinessKey());
+                }
+                start = System.currentTimeMillis();
+                publishSam.deleteBusiness(deleteBusiness);
+                start = System.currentTimeMillis() - start;
+                data.put("Delete Flat Businesses Bulk", (double)counter/(double)start );
+                logger.info("Insert flat businesses took Bulk" + start);
+
+        }
+
+        @Test
+        public void testInsertFlatBusinessManyNames() throws Exception {
+                logger.info("Performace test, inserting " + counter + " flat businesses ManyNames");
+                BusinessEntity be = new BusinessEntity();
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(authInfoSam);
+                List<String> biz = new ArrayList<String>();
+                long start = System.currentTimeMillis();
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        be.getName().clear();
+                        for (int k = 0; k < counter; k++) {
+                                be.getName().add(new Name("Name " + i + "-" + k, null));
+                        }
+                        sb.getBusinessEntity().clear();
+                        sb.getBusinessEntity().add(be);
+                        BusinessDetail saveBusiness = publishSam.saveBusiness(sb);
+                        biz.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+                }
+                start = System.currentTimeMillis() - start;
+                data.put("Insert Flat Businesses 1x ManyNames", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took 1x ManyNames" + start);
+
+                start = System.currentTimeMillis();
+                for (int i = 0; i < biz.size(); i++) {
+                        System.out.print(".");
+                        DeleteBusiness deleteBusiness = new DeleteBusiness();
+                        deleteBusiness.setAuthInfo(authInfoSam);
+                        deleteBusiness.getBusinessKey().add(biz.get(i));
+                        publishSam.deleteBusiness(deleteBusiness);
+
+                }
+                start = System.currentTimeMillis() - start;
+                data.put("Delete Flat Businesses 1x ManyNames", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took 1x ManyNames" + start);
+
+        }
+
+        @Test
+        public void testInsertFlatBusinessBulkManyNames() throws Exception {
+                logger.info("Performace test, inserting " + counter + " flat businesses bulk
ManyNames");
+                BusinessEntity be = new BusinessEntity();
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(authInfoSam);
+                List<String> biz = new ArrayList<String>();
+
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        be.getName().clear();
+                        for (int k = 0; k < counter; k++) {
+                                be.getName().add(new Name("Name " + i + "-" + k, null));
+                        }
+                        sb.getBusinessEntity().clear();
+                        sb.getBusinessEntity().add(be);
+
+                }
+
+                long start = System.currentTimeMillis();
+                BusinessDetail saveBusiness = publishSam.saveBusiness(sb);
+
+                start = System.currentTimeMillis() - start;
+                data.put("Insert Flat Businesses Bulk ManyNames", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took Bulk ManyNames" + start);
+
+                DeleteBusiness deleteBusiness = new DeleteBusiness();
+                deleteBusiness.setAuthInfo(authInfoSam);
+
+                for (int i = 0; i < saveBusiness.getBusinessEntity().size(); i++) {
+                        deleteBusiness.getBusinessKey().add(saveBusiness.getBusinessEntity().get(i).getBusinessKey());
+                }
+                start = System.currentTimeMillis();
+                publishSam.deleteBusiness(deleteBusiness);
+                start = System.currentTimeMillis() - start;
+                data.put("Delete Flat Businesses Bulk ManyNames", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took Bulk ManyNames" + start);
+
+        }
+        
+        
+        
+        @Test
+        public void testInsertFlatBusinessManyCategories() throws Exception {
+                logger.info("Performace test, inserting " + counter + " flat businesses ManyCategories");
+                BusinessEntity be = new BusinessEntity();
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(authInfoSam);
+                List<String> biz = new ArrayList<String>();
+                long start = System.currentTimeMillis();
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        be.getName().clear();
+                         be.getName().add(new Name("Name " + i, null));
+                         be.setCategoryBag(new CategoryBag());
+                        for (int k = 0; k < counter; k++) {
+                               be.getCategoryBag().getKeyedReference().add(new KeyedReference(UDDIConstants.General_Keywords,
"somename", "somevalue"+k));
+                        }
+                        sb.getBusinessEntity().clear();
+                        sb.getBusinessEntity().add(be);
+                        BusinessDetail saveBusiness = publishSam.saveBusiness(sb);
+                        biz.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+                }
+                start = System.currentTimeMillis() - start;
+                data.put("Insert Flat Businesses 1x ManyCategories", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took 1x ManyCategories" + start);
+
+                start = System.currentTimeMillis();
+                for (int i = 0; i < biz.size(); i++) {
+                        System.out.print(".");
+                        DeleteBusiness deleteBusiness = new DeleteBusiness();
+                        deleteBusiness.setAuthInfo(authInfoSam);
+                        deleteBusiness.getBusinessKey().add(biz.get(i));
+                        publishSam.deleteBusiness(deleteBusiness);
+
+                }
+                start = System.currentTimeMillis() - start;
+                data.put("Delete Flat Businesses 1x ManyCategories", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took 1x ManyCategories" + start);
+
+        }
+
+        @Test
+        public void testInsertFlatBusinessBulkManyCategories() throws Exception {
+                logger.info("Performace test, inserting " + counter + " flat businesses bulk
ManyCategories");
+                BusinessEntity be = new BusinessEntity();
+                SaveBusiness sb = new SaveBusiness();
+                sb.setAuthInfo(authInfoSam);
+                List<String> biz = new ArrayList<String>();
+
+                for (int i = 0; i < counter; i++) {
+                        System.out.print(".");
+                        be.getName().clear();
+                         be.getName().add(new Name("Name " + i, null));
+                         be.setCategoryBag(new CategoryBag());
+                        for (int k = 0; k < counter; k++) {
+                               be.getCategoryBag().getKeyedReference().add(new KeyedReference(UDDIConstants.General_Keywords,
"somename", "somevalue"+k));
+                        }
+                        sb.getBusinessEntity().clear();
+                        sb.getBusinessEntity().add(be);
+
+                }
+
+                long start = System.currentTimeMillis();
+                BusinessDetail saveBusiness = publishSam.saveBusiness(sb);
+
+                start = System.currentTimeMillis() - start;
+                data.put("Insert Flat Businesses Bulk ManyCategories", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took Bulk ManyCategories" + start);
+
+                DeleteBusiness deleteBusiness = new DeleteBusiness();
+                deleteBusiness.setAuthInfo(authInfoSam);
+
+                for (int i = 0; i < saveBusiness.getBusinessEntity().size(); i++) {
+                        deleteBusiness.getBusinessKey().add(saveBusiness.getBusinessEntity().get(i).getBusinessKey());
+                }
+                start = System.currentTimeMillis();
+                publishSam.deleteBusiness(deleteBusiness);
+                start = System.currentTimeMillis() - start;
+                data.put("Delete Flat Businesses Bulk ManyCategories", (double)counter/(double)start
);
+                logger.info("Insert flat businesses took Bulk ManyCategories" + start);
+
+        }
+}


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


Mime
View raw message