当前位置: 首页>>代码示例>>Java>>正文


Java InitializationException类代码示例

本文整理汇总了Java中org.apache.nifi.reporting.InitializationException的典型用法代码示例。如果您正苦于以下问题:Java InitializationException类的具体用法?Java InitializationException怎么用?Java InitializationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InitializationException类属于org.apache.nifi.reporting包,在下文中一共展示了InitializationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: single_host_without_credentials

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void single_host_without_credentials() throws InitializationException {
    final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
    final StandardMongoClientService service = new StandardMongoClientService();
    runner.addControllerService("test-good1", service);

    runner.setProperty(service, StandardMongoClientService.HOSTS, "localhost:27017");
    runner.enableControllerService(service);

    runner.assertValid(service);
    StandardMongoClientService mongoService = (StandardMongoClientService) runner.getProcessContext().getControllerServiceLookup().getControllerService("test-good1");
    assertNotNull(mongoService);
    MongoClient mongoClient = mongoService.getMongoClient();
    assertNotNull(mongoClient);

    assertEquals(0, mongoClient.getDatabase(MONGO_DATABASE_NAME).getCollection("sample").count());
    mongoClient.dropDatabase(MONGO_DATABASE_NAME);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:19,代码来源:StandardMongoClientServiceIT.java

示例2: enable

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
/**
 *
 */
@OnEnabled
public void enable(ConfigurationContext context) throws InitializationException {
    try {
        if (!this.configured) {
            if (logger.isInfoEnabled()) {
                logger.info("Configuring " + this.getClass().getSimpleName() + " for '"
                        + context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue() + "' to be connected to '"
                        + context.getProperty(BROKER_URI).evaluateAttributeExpressions().getValue() + "'");
            }
            // will load user provided libraries/resources on the classpath
            Utils.addResourcesToClasspath(context.getProperty(CLIENT_LIB_DIR_PATH).evaluateAttributeExpressions().getValue());

            this.createConnectionFactoryInstance(context);
            if(!isSolace(context))
                this.setConnectionFactoryProperties(context);
        }
        this.configured = true;
    } catch (Exception e) {
        logger.error("Failed to configure " + this.getClass().getSimpleName(), e);
        this.configured = false;
        throw new IllegalStateException(e);
    }
}
 
开发者ID:lsac,项目名称:nifi-jms-jndi,代码行数:27,代码来源:JNDIConnectionFactoryProvider.java

示例3: enable

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
/**
 *
 */
@OnEnabled
public void enable(ConfigurationContext context) throws InitializationException {
    try {
        if (!this.configured) {
            if (logger.isInfoEnabled()) {
                logger.info("Configuring " + this.getClass().getSimpleName() + " for '"
                        + context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue() + "' to be connected to '"
                        + BROKER_URI + "'");
            }
            // will load user provided libraries/resources on the classpath
            Utils.addResourcesToClasspath(context.getProperty(CLIENT_LIB_DIR_PATH).evaluateAttributeExpressions().getValue());

            this.createConnectionFactoryInstance(context);

            this.setConnectionFactoryProperties(context);
        }
        this.configured = true;
    } catch (Exception e) {
        logger.error("Failed to configure " + this.getClass().getSimpleName(), e);
        this.configured = false;
        throw new IllegalStateException(e);
    }
}
 
开发者ID:lsac,项目名称:nifi-jms-jndi,代码行数:27,代码来源:JMSConnectionFactoryProvider.java

示例4: test_mongoservice_not_enabled

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void test_mongoservice_not_enabled() throws InitializationException {
    final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
    final StandardMongoClientService service = new StandardMongoClientService();

    runner.addControllerService("test-mongo-closed", service);
    runner.enableControllerService(service);

    // Close MongoClient
    MongoClient client = service.getMongoClient();

    // NOTE: This test requires mongo to be running
    assertEquals("localhost:27017", client.getConnectPoint());

    // Close the mongo connection
    client.close();

    // Now, this should throw an illegal state exception
    thrown.expect(IllegalStateException.class);
    client.getConnectPoint();
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:22,代码来源:StandardMongoClientServiceIT.java

示例5: onEnabled

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
/**
 * @param context the configuration context
 * @throws InitializationException if unable to create a database connection
 */
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException {
    Set<AuthorizationToken> tokensToUse = new HashSet<>();

    final String authorizationFilePath = context.getProperty(AUTHORIZATION_FILE_PATH).getValue();

    try (Scanner authsScanner = new Scanner(new File(authorizationFilePath))) {
        authsScanner.useDelimiter(",");
        while (authsScanner.hasNext()) {
            tokensToUse.add(new StandardAuthorizationToken(authsScanner.next()));
        }
    } catch (IOException ioe) {
        throw new InitializationException("Could not initialize " + this.getClass().getSimpleName() + " when trying to acquire authorizations.", ioe);
    }
    getLogger().info("Providing authorities for the following: {}", new Object[]{tokensToUse});
    this.authorizationTokens = tokensToUse;
}
 
开发者ID:apiri,项目名称:nifi-delegated-authorization-bundle,代码行数:22,代码来源:FileBasedDelegatedAuthorizationProviderService.java

示例6: createSockJSServer

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
private void createSockJSServer(final ConfigurationContext context)  throws InitializationException {

        final int port = context.getProperty(PORT).asInteger();
        final String ContextPath = context.getProperty(CONTEXT_PATH).getValue();

        Router router = Router.router(vertx);

        SockJSHandler sockJSHandler = SockJSHandler.create(vertx);

        BridgeOptions options = new BridgeOptions();
        if (context.getProperty(INBOUND_ADDRESS_REGEX).isSet()) {
            options.addInboundPermitted(new PermittedOptions().setAddressRegex(context.getProperty(INBOUND_ADDRESS_REGEX).getValue()));
        }
        if (context.getProperty(OUTBOUND_ADDRESS_REGEX).isSet()) {
            options.addOutboundPermitted(new PermittedOptions().setAddressRegex(context.getProperty(OUTBOUND_ADDRESS_REGEX).getValue()));
        }

        sockJSHandler.bridge(options);

        router.route(ContextPath).handler(sockJSHandler);
        httpServer = vertx.createHttpServer().requestHandler(router::accept).listen(port);
    }
 
开发者ID:xmlking,项目名称:nifi-websocket,代码行数:23,代码来源:VertxService.java

示例7: testService

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void testService() throws InitializationException {
    final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
    final StandardMyService service = new StandardMyService();
    runner.addControllerService("test-good", service);

    runner.setProperty(service, StandardMyService.MY_PROPERTY, "test-value");
    runner.enableControllerService(service);

    runner.assertValid(service);
}
 
开发者ID:wadesalazar,项目名称:NIFI-OPCUA,代码行数:12,代码来源:TestStandardMyService.java

示例8: setup

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Before
public void setup() throws InitializationException {
    final DBCPService dbcp = new DBCPServiceSimpleImpl();

    runner = TestRunners.newTestRunner(new ExecuteOracleSQL());
    runner.addControllerService("dbcp", dbcp, new HashMap<>());
    runner.enableControllerService(dbcp);
    runner.setProperty(ExecuteOracleSQL.DBCP_SERVICE, "dbcp");
}
 
开发者ID:datamindedbe,项目名称:nifi-dataminded-bundle,代码行数:10,代码来源:TestExecuteOracleSQL.java

示例9: testIncomingConnectionWithNoFlowFile

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void testIncomingConnectionWithNoFlowFile() throws InitializationException {
    runner.setIncomingConnection(true);
    runner.setProperty(ExecuteOracleSQL.SQL_SELECT_QUERY, "SELECT * FROM persons");
    runner.run();
    runner.assertTransferCount(ExecuteOracleSQL.SUCCESS, 0);
    runner.assertTransferCount(ExecuteOracleSQL.FAILURE, 0);
}
 
开发者ID:datamindedbe,项目名称:nifi-dataminded-bundle,代码行数:9,代码来源:TestExecuteOracleSQL.java

示例10: testIncomingConnectionWithNoFlowFileAndNoQuery

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void testIncomingConnectionWithNoFlowFileAndNoQuery() throws InitializationException {
    runner.setIncomingConnection(true);
    runner.run();
    runner.assertTransferCount(ExecuteOracleSQL.SUCCESS, 0);
    runner.assertTransferCount(ExecuteOracleSQL.FAILURE, 0);
}
 
开发者ID:datamindedbe,项目名称:nifi-dataminded-bundle,代码行数:8,代码来源:TestExecuteOracleSQL.java

示例11: setup

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Before
public void setup() throws InitializationException {
    runner = TestRunners.newTestRunner(IdentifyDuplicate.class);

    runner.setProperty(CACHE_SERVICE, "cache");
    runner.setProperty(CACHE_ENTRY_IDENTIFIER, "${id}");
    runner.setProperty(BATCH_SIZE, "10");

    LocalCache cache = new LocalCache();
    Map<String, String> cacheProperties = ImmutableMap.of(
            SetCacheService.MAX_SIZE.getName(), "10",
            SetCacheService.AGE_OFF_DURATION.getName(), "10 min");
    runner.addControllerService("cache", cache, cacheProperties);
    runner.enableControllerService(cache);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:16,代码来源:IdentifyDuplicateTest.java

示例12: addMongoService

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
protected void addMongoService(TestRunner runner) throws InitializationException {
    HashMap<String, String> props = new HashMap<>();

    // Add mongo controller service
    runner.addControllerService(MONGO_CONTROLLER_SERVICE, mongo, props);
    runner.setProperty(MongoProps.MONGO_SERVICE, MONGO_CONTROLLER_SERVICE);
    runner.enableControllerService(mongo);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:9,代码来源:StoreInMongoIT.java

示例13: validating_valid_inputs_1

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void validating_valid_inputs_1() throws InitializationException {
    final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
    final StandardMongoClientService service = new StandardMongoClientService();

    Map<String, String> props = new HashMap<>();
    props.put(StandardMongoClientService.HOSTS.getName(), "localhost:27017");
    runner.addControllerService("test_hosts", service, props);
    runner.assertValid(service);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:11,代码来源:StandardMongoClientServiceIT.java

示例14: validating_incomplete_auth_inputs_1

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void validating_incomplete_auth_inputs_1() throws InitializationException {
    final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
    final StandardMongoClientService service = new StandardMongoClientService();

    Map<String, String> props = new HashMap<>();
    props.put(StandardMongoClientService.HOSTS.getName(), "localhost:27017");
    props.put(StandardMongoClientService.USERNAME.getName(), "mongouser");
    runner.addControllerService("test_hosts", service, props);
    runner.assertNotValid(service);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:12,代码来源:StandardMongoClientServiceIT.java

示例15: validating_incomplete_auth_inputs_2

import org.apache.nifi.reporting.InitializationException; //导入依赖的package包/类
@Test
public void validating_incomplete_auth_inputs_2() throws InitializationException {
    final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
    final StandardMongoClientService service = new StandardMongoClientService();

    Map<String, String> props = new HashMap<>();
    props.put(StandardMongoClientService.HOSTS.getName(), "localhost:27017");
    props.put(StandardMongoClientService.PASSWORD.getName(), "mongouser");
    runner.addControllerService("test_hosts", service, props);
    runner.assertNotValid(service);
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:12,代码来源:StandardMongoClientServiceIT.java


注:本文中的org.apache.nifi.reporting.InitializationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。