diff options
Diffstat (limited to 'rest-services/common-dependency')
13 files changed, 0 insertions, 744 deletions
diff --git a/rest-services/common-dependency/pom.xml b/rest-services/common-dependency/pom.xml deleted file mode 100644 index 16f6a09d..00000000 --- a/rest-services/common-dependency/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.dcaegen2.services.sdk</groupId> - <artifactId>dcaegen2-services-sdk-rest-services</artifactId> - <version>1.3.1-SNAPSHOT</version> - </parent> - - <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId> - <artifactId>common-dependency</artifactId> - - <name>dcaegen2-services-sdk-rest-services-common-dependency</name> - <description>Common functionality in the project</description> - <packaging>jar</packaging> - - <dependencies> - <dependency> - <groupId>io.projectreactor.netty</groupId> - <artifactId>reactor-netty</artifactId> - </dependency> - <dependency> - <groupId>org.immutables</groupId> - <artifactId>gson</artifactId> - </dependency> - <dependency> - <groupId>org.immutables</groupId> - <artifactId>value</artifactId> - </dependency> - <dependency> - <groupId>io.vavr</groupId> - <artifactId>vavr</artifactId> - </dependency> - <dependency> - <groupId>org.jetbrains</groupId> - <artifactId>annotations</artifactId> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jul-to-slf4j</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - </dependency> - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-test</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/annotations/ExperimentalApi.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/annotations/ExperimentalApi.java deleted file mode 100644 index 9b577688..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/annotations/ExperimentalApi.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ============LICENSE_START==================================== - * DCAEGEN2-SERVICES-SDK - * ========================================================= - * Copyright (C) 2019 Nokia. All rights reserved. - * ========================================================= - * 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. - * ============LICENSE_END===================================== - */ - -package org.onap.dcaegen2.services.sdk.rest.services.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotate experimental API. - * - * @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a> - * @since 1.1.2 - */ -@Documented -@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE}) -@Retention(RetentionPolicy.SOURCE) -public @interface ExperimentalApi { - String value() default "Experimental API. Might be deleted or changed in the future SDK versions."; - String expectedInVersion() default "unknown"; -} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java deleted file mode 100644 index 781aabee..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiModel.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model; - -@FunctionalInterface -public interface AaiModel extends ClientModel { - - String getCorrelationId(); -} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiServiceInstanceQueryModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiServiceInstanceQueryModel.java deleted file mode 100644 index bb4493e8..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/AaiServiceInstanceQueryModel.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model; - -import org.immutables.value.Value; - -@Value.Style(stagedBuilder = true) -@Value.Immutable -public interface AaiServiceInstanceQueryModel extends ClientModel { - String customerId(); - String serviceType(); - String serviceInstanceId(); -} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java deleted file mode 100644 index f94985be..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/ClientModel.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model; - -public interface ClientModel { -} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java deleted file mode 100644 index 6c5731d8..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/DmaapModel.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model; - -public interface DmaapModel extends ClientModel { -} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java deleted file mode 100644 index e33f914f..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/JsonBodyBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model; - -@FunctionalInterface -public interface JsonBodyBuilder<T extends ClientModel> { - - /** - * Method for serialization object by GSON. - * - * @param t - object which will be serialized - * @return string from serialization - */ - - String createJsonBody(T t); -}
\ No newline at end of file diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/GlobalDiagnosticContext.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/GlobalDiagnosticContext.java deleted file mode 100644 index db4a0fd6..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/GlobalDiagnosticContext.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * ============LICENSE_START==================================== - * DCAEGEN2-SERVICES-SDK - * ========================================================= - * Copyright (C) 2019 Nokia. All rights reserved. - * ========================================================= - * 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. - * ============LICENSE_END===================================== - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model.logging; - -import io.vavr.collection.HashMap; -import io.vavr.collection.Map; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.UUID; -import org.immutables.value.Value; -import org.jetbrains.annotations.Nullable; -import org.slf4j.MDC; - -/** - * @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a> - * @since 1.1.2 - */ -@Value.Immutable(singleton = true) -public interface GlobalDiagnosticContext { - - @Value.Default - default String instanceId() { - return UUID.randomUUID().toString(); - } - - @Value.Default - default String serverFqdn() { - try { - return InetAddress.getLocalHost().toString(); - } catch (UnknownHostException ex) { - return InetAddress.getLoopbackAddress().toString(); - } - } - - @Value.Default - default String serviceName() { - return System.getenv().getOrDefault("HOSTNAME", "unknown_service"); - } - - @Value.Derived - default Map<String, String> asMap() { - return HashMap.of( - MdcVariables.INSTANCE_ID, instanceId(), - MdcVariables.SERVER_FQDN, serverFqdn(), - MdcVariables.SERVICE_NAME, serviceName()); - } - - static GlobalDiagnosticContext instance() { - return ImmutableGlobalDiagnosticContext.of(); - } -} - - diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/MdcVariables.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/MdcVariables.java deleted file mode 100644 index 652e3541..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/MdcVariables.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model.logging; - -import org.slf4j.MDC; - -import java.util.Map; - -public final class MdcVariables { - - @Deprecated - public static final String X_ONAP_REQUEST_ID = "X-ONAP-RequestID"; - @Deprecated - public static final String X_INVOCATION_ID = "X-InvocationID"; - - public static final String INSTANCE_UUID = "InstanceUUID"; - public static final String RESPONSE_CODE = "ResponseCode"; - public static final String REQUEST_ID = "RequestID"; - public static final String CLIENT_NAME = "PartnerName"; - public static final String CLIENT_IP = "ClientIPAddress"; - public static final String INVOCATION_ID = "InvocationID"; - public static final String INVOCATION_TIMESTAMP = "InvokeTimestamp"; - public static final String STATUS_CODE = "StatusCode"; - public static final String INSTANCE_ID = "InstanceID"; - public static final String SERVER_FQDN = "ServerFQDN"; - public static final String SERVICE_NAME = "ServiceName"; - - private static final String HTTP_HEADER_PREFIX = "X-"; - - private MdcVariables() { - } - - public static String httpHeader(String mdcName) { - return HTTP_HEADER_PREFIX + mdcName; - } - - /** - * @deprecated use {@link RequestDiagnosticContext#withSlf4jMdc(Runnable)}. - * @param mdcContextMap - */ - @Deprecated - public static void setMdcContextMap(Map<String, String> mdcContextMap) { - if (mdcContextMap != null) { - MDC.setContextMap(mdcContextMap); - } - } -} diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/RequestDiagnosticContext.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/RequestDiagnosticContext.java deleted file mode 100644 index 0c4a4b1f..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/RequestDiagnosticContext.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * ============LICENSE_START==================================== - * DCAEGEN2-SERVICES-SDK - * ========================================================= - * Copyright (C) 2019 Nokia. All rights reserved. - * ========================================================= - * 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. - * ============LICENSE_END===================================== - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model.logging; - -import io.vavr.collection.HashMap; -import io.vavr.collection.Map; -import java.util.UUID; -import org.immutables.value.Value; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.slf4j.MDC; - -/** - * @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a> - * @since 1.1.2 - */ -@Value.Immutable -public interface RequestDiagnosticContext { - - UUID requestId(); - - @Nullable UUID invocationId(); - - @Value.Default - default GlobalDiagnosticContext global() { - return GlobalDiagnosticContext.instance(); - } - - @Value.Derived - default Map<String, String> remoteCallHttpHeaders() { - java.util.Map<String, String> result = new java.util.HashMap<>(); - - result.put(MdcVariables.httpHeader(MdcVariables.REQUEST_ID), requestId().toString()); - - if (invocationId() != null) { - result.put(MdcVariables.httpHeader(MdcVariables.INVOCATION_ID), invocationId().toString()); - } - - return HashMap.ofAll(result); - } - - @Value.Derived - default Map<String, String> asMap() { - java.util.Map<String, String> result = new java.util.HashMap<>(); - - if (requestId() != null) { - result.put(MdcVariables.REQUEST_ID, requestId().toString()); - } - - if (invocationId() != null) { - result.put(MdcVariables.INVOCATION_ID, invocationId().toString()); - } - - return global().asMap().merge(HashMap.ofAll(result)); - } - - default void withSlf4jMdc(Runnable runnable) { - withSlf4jMdc(true, runnable); - } - - default void withSlf4jMdc(boolean loglevelEnabled, Runnable runnable) { - if (loglevelEnabled) { - final java.util.Map<String, String> ctxBefore = MDC.getCopyOfContextMap(); - try { - MDC.setContextMap(asMap().toJavaMap()); - runnable.run(); - } finally { - if (ctxBefore == null) { - MDC.clear(); - } else { - MDC.setContextMap(ctxBefore); - } - } - } - } - - default @NotNull RequestDiagnosticContext withNewInvocationId() { - return ImmutableRequestDiagnosticContext.copyOf(this) - .withInvocationId(UUID.randomUUID()); - } - - static ImmutableRequestDiagnosticContext create() { - return ImmutableRequestDiagnosticContext.builder() - .requestId(UUID.randomUUID()) - .invocationId(UUID.randomUUID()) - .build(); - } -} - - diff --git a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/uri/URI.java b/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/uri/URI.java deleted file mode 100644 index 6b74a82a..00000000 --- a/rest-services/common-dependency/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/uri/URI.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - * - */ - -package org.onap.dcaegen2.services.sdk.rest.services.uri; - -public final class URI { - private String scheme; - private String host; - private int port; - private String path; - private String fragment; - private String authority; - private String userInfo; - private String query; - private String schemeSpecificPart; - private String string; - - private URI() { - } - - public static final class URIBuilder { - private String scheme; - private String host; - private int port; - private String path; - private String fragment; - private String authority; - private String userInfo; - private String query; - private String schemeSpecificPart; - - public URIBuilder scheme(String scheme) { - this.scheme = scheme; - return this; - } - - public URIBuilder host(String host) { - this.host = host; - return this; - } - - public URIBuilder port(int port) { - this.port = port; - return this; - } - - public URIBuilder path(String path) { - this.path = path; - return this; - } - - public URIBuilder fragment(String fragment) { - this.fragment = fragment; - return this; - } - - public URIBuilder authority(String authority) { - this.authority = authority; - return this; - } - - public URIBuilder userInfo(String userInfo) { - this.userInfo = userInfo; - return this; - } - - public URIBuilder query(String query) { - this.query = query; - return this; - } - - public URIBuilder schemeSpecificPart(String schemeSpecificPart) { - this.schemeSpecificPart = schemeSpecificPart; - return this; - } - - public URI build() { - URI uri = new URI(); - uri.scheme = this.scheme; - uri.host = this.host; - uri.port = this.port; - uri.path = this.path; - uri.fragment = this.fragment; - uri.authority = this.authority; - uri.userInfo = this.userInfo; - uri.query = this.query; - uri.schemeSpecificPart = this.schemeSpecificPart; - return uri; - } - } - - @Override - public String toString() { - defineString(); - return string; - } - - private void defineString() { - if (string != null) return; - - StringBuffer sb = new StringBuffer(); - if (scheme != null) { - sb.append(scheme); - sb.append(':'); - } - if (isOpaque()) { - sb.append(schemeSpecificPart); - } else { - if (host != null) { - sb.append("//"); - if (userInfo != null) { - sb.append(userInfo); - sb.append('@'); - } - boolean needBrackets = ((host.indexOf(':') >= 0) - && !host.startsWith("[") - && !host.endsWith("]")); - if (needBrackets) sb.append('['); - sb.append(host); - if (needBrackets) sb.append(']'); - if (port != -1) { - sb.append(':'); - sb.append(port); - } - } else if (authority != null) { - sb.append("//"); - sb.append(authority); - } - if (path != null) - sb.append(path); - if (query != null) { - sb.append('?'); - sb.append(query); - } - } - if (fragment != null) { - sb.append('#'); - sb.append(fragment); - } - string = sb.toString(); - } - - private boolean isOpaque() { - return path == null; - } -}
\ No newline at end of file diff --git a/rest-services/common-dependency/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/MdcVariablesTest.java b/rest-services/common-dependency/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/MdcVariablesTest.java deleted file mode 100644 index bb0cc6cf..00000000 --- a/rest-services/common-dependency/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/model/logging/MdcVariablesTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.dcaegen2.services.sdk.rest.services.model.logging; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.Test; - -class MdcVariablesTest { - - @Test - void shouldReturnProperHttpHeader() { - String expectedValue = "X-header"; - String returnedValue = MdcVariables.httpHeader("header"); - - assertEquals(expectedValue, returnedValue); - } -}
\ No newline at end of file diff --git a/rest-services/common-dependency/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/uri/URITest.java b/rest-services/common-dependency/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/uri/URITest.java deleted file mode 100644 index b4a59638..00000000 --- a/rest-services/common-dependency/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/uri/URITest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * DCAEGEN2-SERVICES-SDK - * ================================================================================ - * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - * - */ - -package org.onap.dcaegen2.services.sdk.rest.services.uri; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.jupiter.api.Test; - -class URITest { - - @Test - void buildProperUri() { - String expectedValue = "http://user@localhost:8080path?query#fragment"; - URI uri = new URI.URIBuilder().scheme("http") - .host("localhost") - .port(8080) - .path("path") - .fragment("fragment") - .authority("authority") - .userInfo("user") - .query("query") - .build(); - - assertEquals(expectedValue, uri.toString()); - } -}
\ No newline at end of file |