2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.pap.xacml.rest.components;
23 import static org.assertj.core.api.Assertions.assertThatCode;
25 import com.att.research.xacml.util.XACMLProperties;
26 import java.util.ArrayList;
27 import java.util.List;
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
33 public class NotifyOtherPapsTest {
34 private static final String systemKey = XACMLProperties.XACML_PROPERTIES_NAME;
35 private static final String oldProperty = System.getProperty(systemKey);
39 // Set the system property temporarily
40 System.setProperty(systemKey, "xacml.pap.properties");
44 public void negTestNotify() {
45 NotifyOtherPaps notify = new NotifyOtherPaps();
46 List<PolicyDBDaoEntity> otherServers = new ArrayList<PolicyDBDaoEntity>();
47 PolicyDBDaoEntity dbdaoEntity = new PolicyDBDaoEntity();
48 dbdaoEntity.setPolicyDBDaoUrl("http://test");
49 otherServers.add(dbdaoEntity);
51 String entityType = "entityType";
52 String newGroupId = "newGroupId";
53 assertThatCode(() -> notify.startNotifyThreads(otherServers, entityId, entityType, newGroupId))
54 .doesNotThrowAnyException();
58 public void cleanup() {
59 // Restore the original system property
60 if (oldProperty != null) {
61 System.setProperty(systemKey, oldProperty);
63 System.clearProperty(systemKey);