sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dul...@apache.org
Subject svn commit: r1777545 - in /sling/trunk/testing/http/clients: ./ src/main/java/org/apache/sling/testing/clients/ src/main/java/org/apache/sling/testing/clients/html/ src/main/java/org/apache/sling/testing/clients/instance/ src/main/java/org/apache/sling...
Date Fri, 06 Jan 2017 09:25:24 GMT
Author: dulvac
Date: Fri Jan  6 09:25:24 2017
New Revision: 1777545

URL: http://svn.apache.org/viewvc?rev=1777545&view=rev
Log:
SLING-6431 and some cosmetic changes

Added:
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/package-info.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/config/impl/package-info.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/poller/package-info.java
Modified:
    sling/trunk/testing/http/clients/pom.xml
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/AbstractSlingClient.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/SlingClient.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/html/package-info.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceConfiguration.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceSetup.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/osgi/package-info.java
    sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/package-info.java

Modified: sling/trunk/testing/http/clients/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/pom.xml?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/pom.xml (original)
+++ sling/trunk/testing/http/clients/pom.xml Fri Jan  6 09:25:24 2017
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>26</version>
+        <version>28</version>
         <relativePath />
     </parent>
 
@@ -77,7 +77,7 @@
     <dependencies>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
+            <artifactId>osgi.core</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
@@ -151,7 +151,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.hapi.client</artifactId>
-            <version>1.0.1-SNAPSHOT</version>
+            <version>1.0.0</version>
         </dependency>
     </dependencies>
 </project>

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/AbstractSlingClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/AbstractSlingClient.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/AbstractSlingClient.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/AbstractSlingClient.java
Fri Jan  6 09:25:24 2017
@@ -28,6 +28,7 @@ import org.apache.http.protocol.HttpCont
 import org.apache.sling.testing.clients.util.HttpUtils;
 import org.slf4j.LoggerFactory;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.net.URI;
@@ -41,7 +42,7 @@ import java.util.UUID;
  * The abstract base client for all implementing integration test clients.
  */
 @Immutable
-public class AbstractSlingClient implements HttpClient {
+public class AbstractSlingClient implements HttpClient, Closeable {
 
     private final org.slf4j.Logger log = LoggerFactory.getLogger(getClass());
 
@@ -648,6 +649,15 @@ public class AbstractSlingClient impleme
         return doRequest(request, headers, expectedStatus);
     }
 
+    @Override
+    /**
+     * <p>Closes the http client and makes sure all the underlying resources, like
the connection manager, shut down </p>
+     *
+     */
+    public void close() throws IOException {
+        this.http.close();
+    }
+
 
     //
     // HttpClient  base methods

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/SlingClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/SlingClient.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/SlingClient.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/SlingClient.java
Fri Jan  6 09:25:24 2017
@@ -21,6 +21,7 @@ import org.apache.http.HttpEntity;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.NameValuePair;
+import org.apache.http.annotation.Immutable;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.RedirectStrategy;
@@ -31,6 +32,7 @@ import org.apache.http.impl.client.Close
 import org.apache.http.impl.client.HttpClientBuilder;
 
 import org.apache.sling.testing.clients.interceptors.DelayRequestInterceptor;
+import org.apache.sling.testing.clients.interceptors.TestDescriptionInterceptor;
 import org.apache.sling.testing.clients.util.FormEntityBuilder;
 import org.apache.sling.testing.clients.util.HttpUtils;
 import org.apache.sling.testing.clients.util.JsonUtils;
@@ -51,6 +53,7 @@ import static org.apache.http.HttpStatus
  * <p>It has methods to perform simple node operations on the server like creating
and deleting nodes, etc.
  * on the server using requests. </p>
  */
+@Immutable
 public class SlingClient extends AbstractSlingClient {
 
     public static final String DEFAULT_NODE_TYPE = "sling:OrderedFolder";
@@ -557,6 +560,7 @@ public class SlingClient extends Abstrac
             httpClientBuilder.setMaxConnPerRoute(10);
             httpClientBuilder.setMaxConnTotal(100);
             // Interceptors
+            httpClientBuilder.addInterceptorLast(new TestDescriptionInterceptor());
             httpClientBuilder.addInterceptorLast(new DelayRequestInterceptor(Constants.HTTP_DELAY));
 
             return this;

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/html/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/html/package-info.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/html/package-info.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/html/package-info.java
Fri Jan  6 09:25:24 2017
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.0.0")
+@Version("2.1.0")
 package org.apache.sling.testing.clients.html;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceConfiguration.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceConfiguration.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceConfiguration.java
Fri Jan  6 09:25:24 2017
@@ -23,12 +23,23 @@ import java.net.URI;
  */
 public class InstanceConfiguration {
 
+    public static final String DEFAULT_ADMIN_USER = "admin";
+    public static final String DEFAULT_ADMIN_PASSWORD = "admin";
+
     private URI url;
     private final String runmode;
+    private String adminUser;
+    private String adminPassword;
 
-    public InstanceConfiguration(final URI url, final String runmode) {
+    public InstanceConfiguration(final URI url, final String runmode, String adminUser, String
adminPassword) {
         this.url = url;
         this.runmode = runmode;
+        this.adminUser = adminUser;
+        this.adminPassword = adminPassword;
+    }
+
+    public InstanceConfiguration(URI url, String runmode) {
+        this(url, runmode, DEFAULT_ADMIN_USER, DEFAULT_ADMIN_PASSWORD);
     }
 
     public URI getUrl() {
@@ -38,4 +49,12 @@ public class InstanceConfiguration {
     public String getRunmode() {
         return runmode;
     }
+
+    public String getAdminUser() {
+        return adminUser;
+    }
+
+    public String getAdminPassword() {
+        return adminPassword;
+    }
 }
\ No newline at end of file

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceSetup.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceSetup.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceSetup.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/InstanceSetup.java
Fri Jan  6 09:25:24 2017
@@ -29,10 +29,16 @@ import java.util.List;
  * Utility class for getting the current instance setup
  */
 public final class InstanceSetup {
-
     private static final Logger LOG = LoggerFactory.getLogger(InstanceSetup.class);
     private static InstanceSetup SINGLETON;
 
+    // TODO: JAVADOC
+    public static final String INSTANCE_CONFIG_INSTANCES = Constants.CONFIG_PROP_PREFIX +
"instances";
+    public static final String INSTANCE_CONFIG_URL = Constants.CONFIG_PROP_PREFIX + "instance.url.";
+    public static final String INSTANCE_CONFIG_RUNMODE = Constants.CONFIG_PROP_PREFIX + "instance.runmode.";
+    public static final String INSTANCE_CONFIG_ADMINUSER = Constants.CONFIG_PROP_PREFIX +
"instance.adminUser.";
+    public static final String INSTANCE_CONFIG_ADMINPASSWORD = Constants.CONFIG_PROP_PREFIX
+ "instance.adminPassword.";
+
     /**
      * @return  the current setup object.
      */
@@ -46,18 +52,26 @@ public final class InstanceSetup {
     private final List<InstanceConfiguration> configs = new ArrayList<InstanceConfiguration>();
 
     private InstanceSetup() {
-        final int number = Integer.valueOf(System.getProperty(Constants.CONFIG_PROP_PREFIX
+ "instances", "0"));
+        final int number = Integer.valueOf(System.getProperty(INSTANCE_CONFIG_INSTANCES,
"0"));
         for (int i=1; i<=number; i++ ) {
             URI url;
             try {
-                url = new URI(System.getProperty(Constants.CONFIG_PROP_PREFIX + "instance.url."
+ String.valueOf(i)));
+                url = new URI(System.getProperty(INSTANCE_CONFIG_URL + String.valueOf(i)));
             } catch (URISyntaxException e) {
                 LOG.error("Could not read URL for instance");
                 continue;
             }
-            final String runmode = System.getProperty(Constants.CONFIG_PROP_PREFIX + "instance.runmode."
+ String.valueOf(i));
-
-            final InstanceConfiguration qc = new InstanceConfiguration(url, runmode);
+            final String runmode = System.getProperty(INSTANCE_CONFIG_RUNMODE + String.valueOf(i));
+            final String adminUser = System.getProperty(INSTANCE_CONFIG_ADMINUSER + String.valueOf(i));
+            final String adminPassword = System.getProperty(INSTANCE_CONFIG_ADMINPASSWORD
+ String.valueOf(i));
+
+            final InstanceConfiguration qc;
+            // Only pass in the admin user name and password if they're both set
+            if ((null == adminUser) || (null == adminPassword)) {
+                qc = new InstanceConfiguration(url, runmode);
+            } else {
+                qc = new InstanceConfiguration(url, runmode, adminUser, adminPassword);
+            }
 
             this.configs.add(qc);
         }

Added: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/package-info.java?rev=1777545&view=auto
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/package-info.java
(added)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/instance/package-info.java
Fri Jan  6 09:25:24 2017
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+@Version("1.1.0")
+package org.apache.sling.testing.clients.instance;
+
+import aQute.bnd.annotation.Version;
+

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/interceptors/TestDescriptionInterceptor.java
Fri Jan  6 09:25:24 2017
@@ -42,7 +42,7 @@ public class TestDescriptionInterceptor
     }
 
     private static void addHeader(HttpRequest httpRequest, String name, String value){
-        if (value != null){
+        if (value != null) {
             httpRequest.addHeader(name, value);
         }
     }

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/osgi/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/osgi/package-info.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/osgi/package-info.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/osgi/package-info.java
Fri Jan  6 09:25:24 2017
@@ -19,5 +19,5 @@
 /**
  * OSGI testing tools.
  */
-@aQute.bnd.annotation.Version("1.0.0")
+@aQute.bnd.annotation.Version("1.1.0")
 package org.apache.sling.testing.clients.osgi;

Modified: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/package-info.java?rev=1777545&r1=1777544&r2=1777545&view=diff
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/package-info.java
(original)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/package-info.java
Fri Jan  6 09:25:24 2017
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.1.0")
+@Version("1.2.0")
 package org.apache.sling.testing.clients;
 
 import aQute.bnd.annotation.Version;

Added: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/config/impl/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/config/impl/package-info.java?rev=1777545&view=auto
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/config/impl/package-info.java
(added)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/config/impl/package-info.java
Fri Jan  6 09:25:24 2017
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+@Version("1.0.0")
+package org.apache.sling.testing.clients.util.config.impl;
+
+import aQute.bnd.annotation.Version;
+

Added: sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/poller/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/poller/package-info.java?rev=1777545&view=auto
==============================================================================
--- sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/poller/package-info.java
(added)
+++ sling/trunk/testing/http/clients/src/main/java/org/apache/sling/testing/clients/util/poller/package-info.java
Fri Jan  6 09:25:24 2017
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+@Version("1.0.0")
+package org.apache.sling.testing.clients.util.poller;
+
+import aQute.bnd.annotation.Version;
+



Mime
View raw message