Search in sources :

Example 1 with NiFiTestUser

use of org.apache.nifi.integration.util.NiFiTestUser in project nifi by apache.

the class ITAccessTokenEndpoint method setup.

@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
    final Bundle systemBundle = SystemBundle.create(props);
    NarClassLoaders.getInstance().init(props.getFrameworkWorkingDirectory(), props.getExtensionsWorkingDirectory());
    ExtensionManager.discoverExtensions(systemBundle, NarClassLoaders.getInstance().getBundles());
    // 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);
}
Also used : NiFiProperties(org.apache.nifi.util.NiFiProperties) Bundle(org.apache.nifi.bundle.Bundle) SystemBundle(org.apache.nifi.nar.SystemBundle) NiFiTestServer(org.apache.nifi.integration.util.NiFiTestServer) Client(javax.ws.rs.client.Client) File(java.io.File) NiFiTestUser(org.apache.nifi.integration.util.NiFiTestUser) BeforeClass(org.junit.BeforeClass)

Aggregations

File (java.io.File)1 Client (javax.ws.rs.client.Client)1 Bundle (org.apache.nifi.bundle.Bundle)1 NiFiTestServer (org.apache.nifi.integration.util.NiFiTestServer)1 NiFiTestUser (org.apache.nifi.integration.util.NiFiTestUser)1 SystemBundle (org.apache.nifi.nar.SystemBundle)1 NiFiProperties (org.apache.nifi.util.NiFiProperties)1 BeforeClass (org.junit.BeforeClass)1