diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2019-10-02 07:15:16 +0200 |
---|---|---|
committer | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2019-10-11 14:30:13 +0200 |
commit | 19bb7116409b4eaa546b48b7d7389e4de04e4f03 (patch) | |
tree | 7fdcd4f631506196416157fa607003bf654ad24b /rest-services/common-dependency/src | |
parent | 6f66c52a858038d9915251dcdd9fab5e2551394b (diff) |
Restructure aai-client
and get rid of common-dependency module
Issue-ID: DCAEGEN2-1792
Change-Id: Ifcc69a917b2aec02615df93d10979d6c38a25ff2
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'rest-services/common-dependency/src')
12 files changed, 0 insertions, 670 deletions
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 |