ONAP
================================================================================
Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
* ONAP
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
assertThat(((ApplyType) obj).getExpression()).hasSize(2);
}
+ @SuppressWarnings("deprecation")
@Test
public void testDecodeProperties() throws ToscaPolicyConversionException {
Data data = ToscaPolicyTranslatorUtils.decodeProperties(Map.of("value", 20), Data.class);
ONAP Policy Engine - XACML PDP
================================================================================
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<dependencies>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
ONAP Policy Engine - XACML PDP
================================================================================
Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<dependencies>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
ONAP Policy Engine - XACML PDP
================================================================================
Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<dependencies>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
================================================================================
Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved.
Modifications Copyright (C) 2020 Bell Canada.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
* ONAP
* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.pdpx.main.rest.XacmlPdpStatisticsManager;
import org.onap.policy.pdpx.main.startstop.Main;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
-import org.powermock.reflect.Whitebox;
+import org.springframework.test.util.ReflectionTestUtils;
/**
* Common base class for REST service tests.
* @param newAlive the new "alive" status
*/
private void markActivator(boolean newAlive) {
- Object manager = Whitebox.getInternalState(XacmlPdpActivator.getCurrent(), "serviceManager");
- AtomicBoolean running = Whitebox.getInternalState(manager, "running");
+ Object manager = ReflectionTestUtils.getField(XacmlPdpActivator.getCurrent(), "serviceManager");
+ AtomicBoolean running = (AtomicBoolean) ReflectionTestUtils.getField(manager, "running");
running.set(newAlive);
}
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.pdpx.main.comm.XacmlPdpHearbeatPublisher;
import org.onap.policy.pdpx.main.comm.XacmlPdpUpdatePublisher;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
-import org.powermock.reflect.Whitebox;
+import org.springframework.test.util.ReflectionTestUtils;
@RunWith(MockitoJUnitRunner.class)
public class XacmlPdpUpdateListenerTest {
public void testMakePublisher() {
// create a plain listener to test the "real" makePublisher() method
listener = new XacmlPdpUpdateListener(client, state, heartbeat, appmgr);
- assertNotNull(Whitebox.getInternalState(listener, "publisher"));
+ assertNotNull(ReflectionTestUtils.getField(listener, "publisher"));
}
private class MyListener extends XacmlPdpUpdateListener {
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.pdpx.main.parameters.CommonTestData;
import org.onap.policy.pdpx.main.parameters.XacmlPdpParameterGroup;
import org.onap.policy.pdpx.main.parameters.XacmlPdpParameterHandler;
-import org.powermock.reflect.Whitebox;
+import org.springframework.test.util.ReflectionTestUtils;
/**
@Override
@Before
public void setUp() {
- Whitebox.setInternalState(parGroup, PROBE_FIELD_NAME, 4);
+ ReflectionTestUtils.setField(parGroup, PROBE_FIELD_NAME, 4);
activator = new XacmlPdpActivator(parGroup);
}
@Test
public void testXacmlPdpActivator_NoProbe() throws Exception {
- Whitebox.setInternalState(parGroup, PROBE_FIELD_NAME, 0);
+ ReflectionTestUtils.setField(parGroup, PROBE_FIELD_NAME, 0);
activator = new XacmlPdpActivator(parGroup);
activator.start();
assertTrue(activator.isAlive());