* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void checkClientTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {}
+ public void checkClientTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {
+ }
@Override
- public void checkServerTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {}
+ public void checkServerTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {
+ }
} };
final SSLContext sc = SSLContext.getInstance("TLSv1.2");
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void checkClientTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {}
+ public void checkClientTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {
+ }
@Override
- public void checkServerTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {}
+ public void checkServerTrusted(final java.security.cert.X509Certificate[] certs, final String authType) {
+ }
} };
final SSLContext sc = SSLContext.getInstance("TLSv1.2");
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
public class DummyReceptionHandler extends AbstractReceptionHandler {
@Override
- public void initializeReception(final String parameterGroupName) {}
+ public void initializeReception(final String parameterGroupName) {
+ }
@Override
- public void destroy() {}
+ public void destroy() {
+ }
}
-FROM onap/policy-common-alpine:1.4.0
+FROM onap/policy-jre-alpine
LABEL maintainer="Policy Team"
ENV POLICY_HOME=$POLICY_HOME/distribution
RUN mkdir -p $POLICY_HOME $POLICY_LOGS $POLICY_HOME/bin && \
- chown -R policy:policy $POLICY_HOME $POLICY_LOGS
+ chown -R policy:policy $POLICY_HOME $POLICY_LOGS &&\
+ mkdir /packages
-RUN mkdir /packages
COPY /maven/* /packages
RUN tar xvfz /packages/policy-distribution.tar.gz --directory $POLICY_HOME \
&& rm /packages/policy-distribution.tar.gz
<version>${policy.apex-pdp.version}</version>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Intel Corp. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
+
/**
* Class to perform unit test of {@link FilePolicyForwarder}.
*
}
@Test
- @SuppressWarnings("unchecked")
public void testForwardPolicyError() {
final Collection<ToscaEntity> policies = new ArrayList<>();
final ToscaPolicy policy = createPolicy(policies, "test", "test");
final ToscaPolicy spy = Mockito.spy(policy);
- Mockito.when(spy.toString()).thenThrow(IOException.class);
+ Mockito.when(spy.toString()).thenAnswer(invocation -> {
+ throw new IOException();
+ });
policies.add(spy);
final FilePolicyForwarder forwarder = new FilePolicyForwarder();
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.distribution.forwarding.xacml.pdp.engine;
import static org.junit.Assert.assertSame;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.mockito.ArgumentMatcher;
import org.onap.policy.api.PolicyParameters;
import org.onap.policy.api.PushPolicyParameters;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
final HttpClient httpClientMock = mock(HttpClient.class);
headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE);
- when(httpClientMock.put(eq("createPolicy"), anyObject(), eq(headers))).thenReturn(Response.ok().build());
- when(httpClientMock.put(eq("pushPolicy"), anyObject(), eq(headers))).thenReturn(Response.ok().build());
+ when(httpClientMock.put(eq("createPolicy"), any(), eq(headers))).thenReturn(Response.ok().build());
+ when(httpClientMock.put(eq("pushPolicy"), any(), eq(headers))).thenReturn(Response.ok().build());
final HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class);
when(httpClientFactoryMock.build(argThat(matcher))).thenReturn(httpClientMock);
final HttpClient httpClientMock = mock(HttpClient.class);
headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE);
- when(httpClientMock.put(eq("createPolicy"), anyObject(), eq(headers))).thenReturn(Response.status(400).build());
- when(httpClientMock.put(eq("pushPolicy"), anyObject(), eq(headers))).thenReturn(Response.ok().build());
+ when(httpClientMock.put(eq("createPolicy"), any(), eq(headers))).thenReturn(Response.status(400).build());
+ when(httpClientMock.put(eq("pushPolicy"), any(), eq(headers))).thenReturn(Response.ok().build());
final HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class);
when(httpClientFactoryMock.build(argThat(matcher))).thenReturn(httpClientMock);
forwarder.forward(policies);
verify(httpClientMock).put(eq("createPolicy"), argThat(new PolicyParametersEntityMatcher(policy)), eq(headers));
- verify(httpClientMock, times(0)).put(eq("pushPolicy"), anyObject(), anyObject());
+ verify(httpClientMock, times(0)).put(eq("pushPolicy"), any(), any());
}
@Test
final HttpClient httpClientMock = mock(HttpClient.class);
headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE);
- when(httpClientMock.put(eq("createPolicy"), anyObject(), eq(headers))).thenReturn(Response.ok().build());
- when(httpClientMock.put(eq("pushPolicy"), anyObject(), eq(headers))).thenReturn(Response.status(400).build());
+ when(httpClientMock.put(eq("createPolicy"), any(), eq(headers))).thenReturn(Response.ok().build());
+ when(httpClientMock.put(eq("pushPolicy"), any(), eq(headers))).thenReturn(Response.status(400).build());
final HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class);
when(httpClientFactoryMock.build(argThat(matcher))).thenReturn(httpClientMock);
final HttpClient httpClientMock = mock(HttpClient.class);
headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE);
- when(httpClientMock.put(eq("createPolicy"), anyObject(), eq(headers))).thenReturn(Response.ok().build());
- when(httpClientMock.put(eq("pushPolicy"), anyObject(), eq(headers))).thenReturn(Response.status(400).build());
+ when(httpClientMock.put(eq("createPolicy"), any(), eq(headers))).thenReturn(Response.ok().build());
+ when(httpClientMock.put(eq("pushPolicy"), any(), eq(headers))).thenReturn(Response.status(400).build());
final HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class);
when(httpClientFactoryMock.build(argThat(matcher))).thenThrow(new HttpClientConfigException());
assertSame(policy, policies.iterator().next());
- verify(httpClientMock, times(0)).put(eq("createPolicy"), anyObject(), anyObject());
- verify(httpClientMock, times(0)).put(eq("pushPolicy"), anyObject(), anyObject());
+ verify(httpClientMock, times(0)).put(eq("createPolicy"), any(), any());
+ verify(httpClientMock, times(0)).put(eq("pushPolicy"), any(), any());
}
@Test
final HttpClient httpClientMock = mock(HttpClient.class);
headers.put(CLIENT_AUTH, CLIENT_AUTH_VALUE);
- when(httpClientMock.put(eq("createPolicy"), anyObject(), eq(headers))).thenReturn(Response.ok().build());
- when(httpClientMock.put(eq("pushPolicy"), anyObject(), eq(headers))).thenReturn(Response.status(400).build());
+ when(httpClientMock.put(eq("createPolicy"), any(), eq(headers))).thenReturn(Response.ok().build());
+ when(httpClientMock.put(eq("pushPolicy"), any(), eq(headers))).thenReturn(Response.status(400).build());
final HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class);
when(httpClientFactoryMock.build(argThat(matcher))).thenReturn(httpClientMock)
forwarder.forward(policies);
verify(httpClientMock).put(eq("createPolicy"), argThat(new PolicyParametersEntityMatcher(policy)), eq(headers));
- verify(httpClientMock, times(0)).put(eq("pushPolicy"), anyObject(), anyObject());
+ verify(httpClientMock, times(0)).put(eq("pushPolicy"), any(), any());
}
- class BusTopicParamsMatcher extends BaseMatcher<BusTopicParams> {
+ class BusTopicParamsMatcher implements ArgumentMatcher<BusTopicParams> {
private BusTopicParams busTopicParams;
}
@Override
- public boolean matches(final Object arg0) {
+ public boolean matches(final BusTopicParams arg0) {
if (arg0 instanceof BusTopicParams) {
final BusTopicParams toCompareTo = (BusTopicParams) arg0;
return toCompareTo.isUseHttps() == busTopicParams.isUseHttps()
}
return false;
}
-
- @Override
- public void describeTo(final Description arg0) {}
}
- class PolicyParametersEntityMatcher extends BaseMatcher<Entity<PolicyParameters>> {
+ class PolicyParametersEntityMatcher implements ArgumentMatcher<Entity<PolicyParameters>> {
private ToscaPolicy policy;
@SuppressWarnings("unchecked")
@Override
- public boolean matches(final Object arg0) {
+ public boolean matches(final Entity<PolicyParameters> arg0) {
if (arg0 instanceof Entity) {
final PolicyParameters toCompareTo = ((Entity<PolicyParameters>) arg0).getEntity();
return toCompareTo.getPolicyName().equals(policy.getName());
}
return false;
}
-
- @Override
- public void describeTo(final Description arg0) {}
}
- class PushPolicyParametersEntityMatcher extends BaseMatcher<Entity<PushPolicyParameters>> {
+ class PushPolicyParametersEntityMatcher implements ArgumentMatcher<Entity<PushPolicyParameters>> {
private ToscaPolicy policy;
@SuppressWarnings("unchecked")
@Override
- public boolean matches(final Object arg0) {
+ public boolean matches(final Entity<PushPolicyParameters> arg0) {
if (arg0 instanceof Entity) {
final PushPolicyParameters toCompareTo = ((Entity<PushPolicyParameters>) arg0).getEntity();
return toCompareTo.getPolicyName().equals(policy.getName())
}
return false;
}
-
- @Override
- public void describeTo(final Description arg0) {}
}
class UnsupportedPolicy extends ToscaEntity {
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
public class DummyReceptionHandler extends AbstractReceptionHandler {
@Override
- public void initializeReception(final String parameterGroupName) {}
+ public void initializeReception(final String parameterGroupName) {
+ }
@Override
- public void destroy() {}
+ public void destroy() {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T 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.
import java.io.IOException;
import java.lang.String;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import org.junit.AfterClass;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
-import org.onap.policy.distribution.reception.decoding.pdpx.FlavorFeature;
import org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderCsarPdpxLifecycleApi;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
+
/**
* Class to perform unit test of {@link PolicyDecoderCsarPdpxLifecycleApiLifecycleApi}.
- *
*/
public class TestPolicyDecoderCsarPdpxLifecycleApi {
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
* {@inheritDoc}.
*/
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
<parent>
<groupId>org.onap.policy.parent</groupId>
<artifactId>integration</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1-SNAPSHOT</version>
<relativePath />
</parent>
<!-- Default Sonar configuration -->
<sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
- <policy.common.version>1.6.1</policy.common.version>
+ <policy.common.version>1.6.2-SNAPSHOT</policy.common.version>
<policy.engine.version>1.6.0-SNAPSHOT</policy.engine.version>
<policy.apex-pdp.version>2.3.0-SNAPSHOT</policy.apex-pdp.version>
- <policy.models.version>2.2.0</policy.models.version>
+ <policy.models.version>2.2.1-SNAPSHOT</policy.models.version>
</properties>
<modules>
with minor changes -->
<configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
<!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+ <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
<includeResources>true</includeResources>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<includeTestResources>true</includeTestResources>
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
}
@Override
- public void configure(final String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {
+ }
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 AT&T 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.
class DummyReceptionHandler extends AbstractReceptionHandler {
@Override
- protected void initializeReception(final String parameterGroupName) {}
+ protected void initializeReception(final String parameterGroupName) {
+ }
@Override
- public void destroy() {}
+ public void destroy() {
+ }
}