@BeforeClass public static void setup() throws Exception { // configure the location of the nifi properties File nifiPropertiesFile = new File("src/test/resources/access-control/nifi.properties"); System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, nifiPropertiesFile.getAbsolutePath()); NiFiProperties props = NiFiProperties.createBasicNiFiProperties(null, null); flowXmlPath = props.getProperty(NiFiProperties.FLOW_CONFIGURATION_FILE); // delete the database directory to avoid issues with re-registration in // testRequestAccessUsingToken FileUtils.deleteDirectory(props.getDatabaseRepositoryPath().toFile()); // load extensions NarClassLoaders.getInstance() .init(props.getFrameworkWorkingDirectory(), props.getExtensionsWorkingDirectory()); ExtensionManager.discoverExtensions(NarClassLoaders.getInstance().getExtensionClassLoaders()); // start the server SERVER = new NiFiTestServer("src/main/webapp", CONTEXT_PATH, props); SERVER.startServer(); SERVER.loadFlow(); // get the base url BASE_URL = SERVER.getBaseUrl() + CONTEXT_PATH; // create the user final Client client = WebUtils.createClient(null, createTrustContext(props)); TOKEN_USER = new NiFiTestUser(client, null); }
@AfterClass public static void cleanup() throws Exception { // shutdown the server SERVER.shutdownServer(); SERVER = null; // look for the flow.xml File flow = new File(flowXmlPath); if (flow.exists()) { flow.delete(); } }