You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/04/25 11:01:43 UTC
[cxf] branch master updated (c088cf0 -> 2c9a163)
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git.
from c088cf0 fixed logging conflict for Spring Boot samples, now using java.util.logging as CXF does
new 1ff4816 Fixed JAX-WS zipkin demo + added some client code to test it out
new 2c9a163 Use String.join instead of StringBuilder
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/cxf/attachment/AttachmentUtil.java | 9 +-----
.../samples/jaxws_tracing_brave_osgi/README.txt | 11 +++++--
.../samples/jaxws_tracing_brave_osgi/pom.xml | 25 ++++++++++++++++
.../java/demo/jaxws/tracing}/client/Client.java | 34 ++++++++++------------
.../tracing/server/impl/CatalogServiceImpl.java | 17 -----------
.../org/apache/cxf/maven_plugin/WsdlUtilities.java | 12 ++------
.../cxf/maven_plugin/wadlto/OptionLoader.java | 12 ++------
.../apache/cxf/maven_plugin/WSDLValidatorMojo.java | 12 ++------
.../cxf/jaxrs/openapi/parse/OpenApiParseUtils.java | 9 +-----
.../cxf/jaxrs/swagger/parse/SwaggerParseUtils.java | 9 +-----
.../oauth2/client/ClientCodeRequestFilter.java | 9 +-----
.../cxf/rs/security/oauth2/utils/OAuthUtils.java | 9 +-----
.../oidc/idp/OidcDynamicRegistrationService.java | 10 ++-----
.../cxf/rs/security/oidc/utils/OidcUtils.java | 9 +-----
.../apache/cxf/transport/jms/JMSMessageUtils.java | 13 +--------
15 files changed, 65 insertions(+), 135 deletions(-)
copy distribution/src/main/release/samples/{configuration_interceptor/src/main/java/demo/stream => jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing}/client/Client.java (55%)
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.
[cxf] 01/02: Fixed JAX-WS zipkin demo + added some client code to
test it out
Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 1ff481658c644b0f4150477be78d03bdb6d9030e
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Apr 25 10:31:09 2018 +0100
Fixed JAX-WS zipkin demo + added some client code to test it out
---
.../samples/jaxws_tracing_brave_osgi/README.txt | 11 ++++-
.../samples/jaxws_tracing_brave_osgi/pom.xml | 25 ++++++++++
.../java/demo/jaxws/tracing/client/Client.java | 57 ++++++++++++++++++++++
.../tracing/server/impl/CatalogServiceImpl.java | 17 -------
4 files changed, 91 insertions(+), 19 deletions(-)
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
index 72c6ab5..9cdfe0c 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
@@ -52,6 +52,7 @@ for this demo bundle.
feature:install cxf-jaxws
feature:install cxf-tracing-brave
+ feature:install aries-blueprint
Install this demo bundle (using the appropriate bundle version number)
@@ -63,9 +64,15 @@ You can verify if the CXF JAX-RS OpenZipkin Brave Blueprint Demo is installed an
START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name
-----------------------------------------------------------------
- 117 | Active | 80 | 3.2.0.SNAPSHOT | JAX-RS Demo Using Distributed Tracing with OpenZipkin Brave and OSGi
+ 117 | Active | 80 | 3.2.0.SNAPSHOT | JAX-WS Demo Using Distributed Tracing
karaf@root()>
Now, you will be able to access this CXF JAXWS demo service on your Karaf instance at
- http://localhost:8181/cxf/catalog?wsdl
\ No newline at end of file
+ http://localhost:8181/cxf/catalog?wsdl
+
+Run the client test code which adds a book via:
+
+ mvn -Pclient
+
+In the Karaf logs (data/log/karaf.log) you can see the Tracing calls.
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
index 18e6b14..149b465 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
@@ -32,6 +32,31 @@
<properties>
<cxf.version>${project.version}</cxf.version>
</properties>
+ <profiles>
+ <profile>
+ <id>client</id>
+ <build>
+ <defaultGoal>test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <mainClass>demo.jaxws.tracing.client.Client</mainClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/client/Client.java b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/client/Client.java
new file mode 100644
index 0000000..2ac4c6b
--- /dev/null
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/client/Client.java
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+
+
+package demo.jaxws.tracing.client;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import demo.jaxws.tracing.server.Book;
+import demo.jaxws.tracing.server.CatalogService;
+
+public final class Client {
+
+ private static final QName SERVICE_NAME
+ = new QName("http://impl.server.tracing.jaxws.demo/", "CatalogServiceImplService");
+
+
+ private Client() {
+ }
+
+ public static void main(String args[]) throws Exception {
+
+ URL wsdl = new URL("http://localhost:8181/cxf/catalog?wsdl");
+
+ Service service = Service.create(wsdl, SERVICE_NAME);
+ QName portQName = new QName("http://impl.server.tracing.jaxws.demo/", "CatalogServiceImplPort");
+ CatalogService port =
+ service.getPort(portQName, CatalogService.class);
+
+ Book book = new Book("1", "New Book");
+ System.out.println("Adding a book");
+ port.addBook(book);
+
+ System.exit(0);
+
+ }
+
+}
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
index c05ab44..ce10884 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
@@ -22,17 +22,10 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import javax.xml.ws.AsyncHandler;
-
-import org.apache.cxf.annotations.UseAsyncMethod;
-import org.apache.cxf.jaxws.ServerAsyncResponse;
import brave.Span;
import brave.Tracer.SpanInScope;
import brave.Tracing;
-
import demo.jaxws.tracing.server.Book;
import demo.jaxws.tracing.server.CatalogService;
@@ -45,25 +38,15 @@ public class CatalogServiceImpl implements CatalogService {
this.brave = brave;
}
- @UseAsyncMethod
public void addBook(Book book) {
- throw new UnsupportedOperationException("Please use async version of the method");
- }
-
- public Future<?> addBookAsync(Book book, AsyncHandler<Book> handler) {
- final ServerAsyncResponse<Book> response = new ServerAsyncResponse<Book>();
-
executor.submit(() -> {
final Span span = brave.tracer().nextSpan().name("Inserting New Book").start();
try (SpanInScope scope = brave.tracer().withSpanInScope(span)) {
books.put(book.getId(), book);
- handler.handleResponse(response);
} finally {
span.finish();
}
});
-
- return response;
}
@Override
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.
[cxf] 02/02: Use String.join instead of StringBuilder
Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 2c9a1639f03119b4ed70465f0a7f4b3ded523c51
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Apr 25 12:01:19 2018 +0100
Use String.join instead of StringBuilder
---
.../main/java/org/apache/cxf/attachment/AttachmentUtil.java | 9 +--------
.../java/org/apache/cxf/maven_plugin/WsdlUtilities.java | 12 ++----------
.../org/apache/cxf/maven_plugin/wadlto/OptionLoader.java | 12 ++----------
.../java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java | 12 ++----------
.../apache/cxf/jaxrs/openapi/parse/OpenApiParseUtils.java | 9 +--------
.../apache/cxf/jaxrs/swagger/parse/SwaggerParseUtils.java | 9 +--------
.../rs/security/oauth2/client/ClientCodeRequestFilter.java | 9 +--------
.../org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java | 9 +--------
.../security/oidc/idp/OidcDynamicRegistrationService.java | 10 ++--------
.../org/apache/cxf/rs/security/oidc/utils/OidcUtils.java | 9 +--------
.../java/org/apache/cxf/transport/jms/JMSMessageUtils.java | 13 +------------
11 files changed, 15 insertions(+), 98 deletions(-)
diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
index 0496ec2..448eef8 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
@@ -359,14 +359,7 @@ public final class AttachmentUtil {
}
static String getHeaderValue(List<String> v, String delim) {
if (v != null && !v.isEmpty()) {
- StringBuilder b = new StringBuilder();
- for (String s : v) {
- if (b.length() > 0) {
- b.append(delim);
- }
- b.append(s);
- }
- return b.toString();
+ return String.join(delim, v);
}
return null;
}
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlUtilities.java b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlUtilities.java
index 399de26..10ff437 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlUtilities.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlUtilities.java
@@ -52,18 +52,10 @@ public final class WsdlUtilities {
}
public static String joinWithComma(String[] arr) {
- if (arr == null) {
+ if (arr == null || arr.length == 0) {
return "";
}
- StringBuilder str = new StringBuilder();
-
- for (String s : arr) {
- if (str.length() > 0) {
- str.append(',');
- }
- str.append(s);
- }
- return str.toString();
+ return String.join(",", arr);
}
public static List<File> getWsdlFiles(File dir, String includes[], String excludes[])
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
index d0c728f..1bb2b36 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
@@ -111,18 +111,10 @@ public final class OptionLoader {
}
private static String joinWithComma(String[] arr) {
- if (arr == null) {
+ if (arr == null || arr.length == 0) {
return "";
}
- StringBuilder str = new StringBuilder();
-
- for (String s : arr) {
- if (str.length() > 0) {
- str.append(',');
- }
- str.append(s);
- }
- return str.toString();
+ return String.join(",", arr);
}
private static List<File> getWadlFiles(File dir, String includes[], String excludes[])
diff --git a/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java b/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
index 15d2cb5..3cdb215 100644
--- a/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
+++ b/maven-plugins/wsdl-validator-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDLValidatorMojo.java
@@ -80,18 +80,10 @@ public class WSDLValidatorMojo extends AbstractMojo {
private String excludes[];
private String getIncludeExcludeString(String[] arr) {
- if (arr == null) {
+ if (arr == null || arr.length == 0) {
return "";
}
- StringBuilder str = new StringBuilder();
-
- for (String s : arr) {
- if (str.length() > 0) {
- str.append(',');
- }
- str.append(s);
- }
- return str.toString();
+ return String.join(",", arr);
}
private List<File> getWsdlFiles(File dir)
diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/parse/OpenApiParseUtils.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/parse/OpenApiParseUtils.java
index 510a7d6..985bd53 100644
--- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/parse/OpenApiParseUtils.java
+++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/parse/OpenApiParseUtils.java
@@ -240,14 +240,7 @@ public final class OpenApiParseUtils {
private static String listToString(List<String> list) {
if (list != null) {
- StringBuilder sb = new StringBuilder();
- for (String s : list) {
- if (sb.length() > 0) {
- sb.append(',');
- }
- sb.append(s);
- }
- return sb.toString();
+ return String.join(",", list);
}
return null;
}
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/parse/SwaggerParseUtils.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/parse/SwaggerParseUtils.java
index fbf86b3..27bbb12 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/parse/SwaggerParseUtils.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/parse/SwaggerParseUtils.java
@@ -200,14 +200,7 @@ public final class SwaggerParseUtils {
private static String listToString(List<String> list) {
if (list != null) {
- StringBuilder sb = new StringBuilder();
- for (String s : list) {
- if (sb.length() > 0) {
- sb.append(',');
- }
- sb.append(s);
- }
- return sb.toString();
+ return String.join(",", list);
}
return null;
}
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
index e5a9295..7911f9a 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/ClientCodeRequestFilter.java
@@ -320,14 +320,7 @@ public class ClientCodeRequestFilter implements ContainerRequestFilter {
}
public void setScopeList(List<String> list) {
- StringBuilder sb = new StringBuilder();
- for (String s : list) {
- if (sb.length() > 0) {
- sb.append(" ");
- }
- sb.append(s);
- }
- setScopes(sb.toString());
+ setScopes(String.join(" ", list));
}
public void setScopes(String scopes) {
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
index dda5829..062689a 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java
@@ -441,13 +441,6 @@ public final class OAuthUtils {
}
public static String convertListOfScopesToString(List<String> registeredScopes) {
- StringBuilder sb = new StringBuilder();
- for (String s : registeredScopes) {
- if (sb.length() > 0) {
- sb.append(", ");
- }
- sb.append(s);
- }
- return sb.toString();
+ return String.join(", ", registeredScopes);
}
}
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java
index af5d7b9..d211f01 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java
@@ -36,14 +36,8 @@ public class OidcDynamicRegistrationService extends DynamicRegistrationService {
Client client = super.createNewClient(request);
List<String> postLogoutUris = request.getListStringProperty(POST_LOGOUT_LOGOUT_URIS);
if (postLogoutUris != null) {
- StringBuilder sb = new StringBuilder();
- for (String uri : postLogoutUris) {
- if (sb.length() > 0) {
- sb.append(" ");
- }
- sb.append(uri);
- }
- client.getProperties().put(POST_LOGOUT_LOGOUT_URIS, sb.toString());
+ client.getProperties().put(POST_LOGOUT_LOGOUT_URIS,
+ String.join(" ", postLogoutUris));
}
String backChannelLogoutUri = request.getStringProperty(BACK_CHANNEL_LOGOUT_URI);
if (backChannelLogoutUri != null) {
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
index 282bb62..5a61379 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/utils/OidcUtils.java
@@ -142,14 +142,7 @@ public final class OidcUtils {
}
private static String getScope(String... scopes) {
- StringBuilder sb = new StringBuilder();
- for (String scope : scopes) {
- if (sb.length() > 0) {
- sb.append(" ");
- }
- sb.append(scope);
- }
- return sb.toString();
+ return String.join(" ", scopes);
}
public static void validateAccessTokenHash(ClientAccessToken at, JwtToken jwt) {
validateAccessTokenHash(at, jwt, true);
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
index e52f163..200d72d 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
@@ -271,7 +271,7 @@ final class JMSMessageUtils {
for (Map.Entry<String, List<String>> ent : headers.entrySet()) {
if (!ent.getKey().equals(org.apache.cxf.message.Message.CONTENT_TYPE)
&& !ent.getKey().equals(HttpHeaderHelper.CONTENT_LENGTH)) {
- messageHeaders.putProperty(ent.getKey(), JMSMessageUtils.join(ent.getValue(), ','));
+ messageHeaders.putProperty(ent.getKey(), String.join(",", ent.getValue()));
}
}
}
@@ -291,17 +291,6 @@ final class JMSMessageUtils {
return messageProperties;
}
- private static String join(List<String> valueList, char seperator) {
- StringBuilder b = new StringBuilder();
- for (String s : valueList) {
- if (b.length() > 0) {
- b.append(seperator);
- }
- b.append(s);
- }
- return b.toString();
- }
-
private static String getSoapAction(JMSMessageHeadersType messageProperties,
org.apache.cxf.message.Message outMessage,
Map<String, List<String>> headers) {
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.