/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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 static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import java.io.FileInputStream;
-import java.util.Properties;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
*/
public class TestXacmlPdpActivator extends CommonRest {
private static XacmlPdpParameterGroup parGroup;
- private static Properties props;
private XacmlPdpActivator activator = null;
public static void setUpBeforeClass() throws Exception {
CommonRest.setUpBeforeClass();
- final String[] xacmlPdpConfigParameters =
- {"-c", CommonRest.CONFIG_FILE, "-p", "parameters/topic.properties"};
+ final String[] xacmlPdpConfigParameters = {"-c", CommonRest.CONFIG_FILE};
final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments(xacmlPdpConfigParameters);
parGroup = new XacmlPdpParameterHandler().getParameters(arguments);
- props = new Properties();
- String propFile = arguments.getFullPropertyFilePath();
- try (FileInputStream stream = new FileInputStream(propFile)) {
- props.load(stream);
- }
-
// don't want the common "main" running
CommonRest.stopMain();
}
/**
* Creates the activator.
*/
+ @Override
@Before
public void setUp() {
- activator = new XacmlPdpActivator(parGroup, props);
+ activator = new XacmlPdpActivator(parGroup);
}
@Test
public void testXacmlPdpActivator() throws Exception {
assertFalse(activator.isAlive());
+ assertFalse(activator.isXacmlRestControllerAlive());
activator.start();
assertTrue(activator.isAlive());
+
+ // XacmlPdp starts in PASSIVE state so the rest controller should not be alive
+ assertFalse(activator.isXacmlRestControllerAlive());
assertTrue(activator.getParameterGroup().isValid());
assertEquals(CommonTestData.PDPX_GROUP_NAME, activator.getParameterGroup().getName());
+ activator.startXacmlRestController();
+ assertTrue(activator.isXacmlRestControllerAlive());
+
+ activator.stopXacmlRestController();
+ assertFalse(activator.isXacmlRestControllerAlive());
}
@Test