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


Java TestingScheduledThreadPoolModuleFactory类代码示例

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


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

示例1: testRecreate

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void testRecreate() throws Exception {
    ObjectName createdConfigBean = createScheduled();
    // empty transaction
    ConfigTransactionJMXClient configTransaction = configRegistryClient.createTransaction();
    ObjectName scheduledWritableON = configTransaction
            .lookupConfigBean(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
    TestingScheduledThreadPoolConfigBeanMXBean scheduledWritableProxy = configTransaction
            .newMXBeanProxy(scheduledWritableON, TestingScheduledThreadPoolConfigBeanMXBean.class);
    scheduledWritableProxy.setRecreate(true);
    CommitStatus commitInfo = configTransaction.commit();
    // check that it was recreated
    ObjectName readableConfigBean = ObjectNameUtil.withoutTransactionName(createdConfigBean);
    List<ObjectName> newInstances = Collections.<ObjectName>emptyList();
    List<ObjectName> reusedInstances = Collections.<ObjectName>emptyList();
    List<ObjectName> recreatedInstaces = Lists.newArrayList(readableConfigBean);
    assertEquals(new CommitStatus(newInstances, reusedInstances, recreatedInstaces), commitInfo);
    checkRuntimeBeans();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:RuntimeBeanTest.java

示例2: tryToRegisterThreadPoolWithSameName

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void tryToRegisterThreadPoolWithSameName() throws InstanceAlreadyExistsException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();

    transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
    try {
        transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
        fail();
    } catch (final InstanceAlreadyExistsException e) {
        assertThat(e.getMessage(), containsString(
                "There is an instance registered with name "
                + "ModuleIdentifier{factoryName='scheduled', instanceName='scheduled1'}"));
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:TwoInterfacesExportTest.java

示例3: testRegisteringAllIfcNames

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void testRegisteringAllIfcNames() throws Exception {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
    transaction.commit();
    assertExists(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
    // another transaction
    transaction = configRegistryClient.createTransaction();
    assertExists(transaction, TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:TwoInterfacesExportTest.java

示例4: testWithAPSP_useScheduledNames

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void testWithAPSP_useScheduledNames() throws InstanceAlreadyExistsException, ValidationException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    ObjectName scheduledName = transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);

    ObjectName apspName = transaction.createModule(TestingParallelAPSPModuleFactory.NAME, "apsp1");
    TestingParallelAPSPConfigMXBean apspProxy = transaction.newMXBeanProxy(apspName,
            TestingParallelAPSPConfigMXBean.class);
    apspProxy.setThreadPool(scheduledName);
    apspProxy.setSomeParam("someParam");
    transaction.validateConfig();

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:TwoInterfacesExportTest.java

示例5: testWithAPSP_useIfcNameMismatch

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void testWithAPSP_useIfcNameMismatch() throws Exception {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);

    ObjectName apspName = transaction.createModule(TestingParallelAPSPModuleFactory.NAME, "apsp1");
    TestingParallelAPSPConfigMXBean apspProxy = transaction.newMXBeanProxy(apspName,
            TestingParallelAPSPConfigMXBean.class);
    apspProxy.setThreadPool(
            ObjectNameUtil.createReadOnlyModuleON(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1));
    apspProxy.setSomeParam("someParam");
    transaction.validateConfig();
    transaction.commit();

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:TwoInterfacesExportTest.java

示例6: setUp

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Before
public final void setUp() {
    assertEquals(0,
            TestingScheduledThreadPoolImpl.getNumberOfCloseMethodCalls());
    super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,
            new TestingScheduledThreadPoolModuleFactory(),
            new TestingFixedThreadPoolModuleFactory(),
            new TestingParallelAPSPModuleFactory()));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbstractScheduledTest.java

示例7: createScheduled

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
private ObjectName createScheduled()
        throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();

    // create using TestingThreadPoolIfc:
    ObjectName createdConfigBean = transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME,
            SCHEDULED1);
    // commit
    transaction.commit();
    return createdConfigBean;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:RuntimeBeanTest.java

示例8: twoInterfaceNamesAfterCreatingConfigBean

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void twoInterfaceNamesAfterCreatingConfigBean() throws Exception {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();

    // create using TestingThreadPoolIfc:
    ObjectName scheduled1name = transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);

    ObjectName retrievedName = transaction.lookupConfigBean(TestingScheduledThreadPoolModuleFactory.NAME,
            SCHEDULED1);
    assertEquals(scheduled1name, retrievedName);

    // getExistingConfigBean should resolve moduleName
    String moduleName = TestingScheduledThreadPoolModuleFactory.NAME;
    retrievedName = transaction.lookupConfigBean(moduleName, SCHEDULED1);
    ObjectName expected = ObjectNameUtil.createTransactionModuleON(transaction.getTransactionName(), moduleName,
            SCHEDULED1);
    assertEquals(expected, retrievedName);

    // commit
    transaction.commit();
    assertEquals(1, TestingScheduledThreadPoolImpl.ALLEXECUTORS.size());
    assertFalse(TestingScheduledThreadPoolImpl.ALLEXECUTORS.get(0).isTerminated());
    assertEquals(0, TestingScheduledThreadPoolImpl.getNumberOfCloseMethodCalls());

    assertExists(moduleName, SCHEDULED1);

    // destroy using ThreadPool ifc
    transaction = configRegistryClient.createTransaction();
    transaction.destroyModule(
            ObjectNameUtil.createTransactionModuleON(transaction.getTransactionName(), moduleName, SCHEDULED1));
    transaction.commit();
    assertEquals(1, TestingScheduledThreadPoolImpl.ALLEXECUTORS.size());
    assertTrue(TestingScheduledThreadPoolImpl.ALLEXECUTORS.get(0).isTerminated());
    assertEquals(1, TestingScheduledThreadPoolImpl.getNumberOfCloseMethodCalls());

    // should not be in platform:

    assertNotExists(moduleName, SCHEDULED1);

    transaction = configRegistryClient.createTransaction();
    // should not be in transaction
    assertNotExists(transaction, moduleName, SCHEDULED1);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:44,代码来源:TwoInterfacesExportTest.java

示例9: setUp

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Before
public void setUp() {
    super.initConfigTransactionManagerImpl(
            new HardcodedModuleFactoriesResolver(mockedContext, new TestingFixedThreadPoolModuleFactory(),
                    new TestingParallelAPSPModuleFactory(), new TestingScheduledThreadPoolModuleFactory()));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:ServiceReferenceRegistryImplTest.java

示例10: test

import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory; //导入依赖的package包/类
@Test
public void test() throws Exception {
    ConfigTransactionJMXClient transaction1 = configRegistryClient.createTransaction();
    // create fixed1
    int fixedNrOfThreads = 20;
    int scheduledNrOfThreads = 30;

    ObjectName fixedTPTransactionON = transaction1.createModule(getThreadPoolImplementationName(), fixed1);
    platformMBeanServer.setAttribute(fixedTPTransactionON, new Attribute("ThreadCount", fixedNrOfThreads));

    ObjectName scheduledTPTransactionON = transaction1.createModule(TestingScheduledThreadPoolModuleFactory.NAME,
            "scheduled1");
    platformMBeanServer.setAttribute(scheduledTPTransactionON, new Attribute("ThreadCount", scheduledNrOfThreads));

    String refName = "ref";
    ObjectName serviceReference = transaction1.saveServiceReference(TestingThreadPoolServiceInterface.QNAME,
            refName, fixedTPTransactionON);
    // create apsp-parallel
    createParallelAPSP(transaction1, serviceReference);
    transaction1.commit();

    // check fixed1 is used
    ServiceReferenceMXBean serviceReferenceMXBean = JMX.newMXBeanProxy(platformMBeanServer,
            withoutTransactionName(serviceReference), ServiceReferenceMXBean.class);
    assertEquals(withoutTransactionName(fixedTPTransactionON), serviceReferenceMXBean.getCurrentImplementation());
    checkApspThreadCount(fixedNrOfThreads);
    // check OSGi SR
    List<RegistrationHolder> registrations =
            ((RecordingBundleContextServiceRegistrationHandler) currentBundleContextServiceRegistrationHandler)
            .getRegistrations();
    assertEquals(1, registrations.size());
    RegistrationHolder record = registrations.get(0);
    assertEquals(TestingThreadPoolIfc.class, record.clazz);
    assertEquals(ImmutableMap.of("name", "ref"), record.props);

    // switch reference to scheduled
    ConfigTransactionJMXClient transaction2 = configRegistryClient.createTransaction();
    transaction2.saveServiceReference(TestingThreadPoolServiceInterface.QNAME, refName,
            ObjectNameUtil.withTransactionName(scheduledTPTransactionON, transaction2.getTransactionName()));
    transaction2.commit();
    // check scheduled is used
    checkApspThreadCount(scheduledNrOfThreads);
    // check that dummy MXBean points to scheduled
    assertEquals(withoutTransactionName(scheduledTPTransactionON),
            serviceReferenceMXBean.getCurrentImplementation());

    // empty transaction
    configRegistryClient.createTransaction().commit();

    // get service mapping
    Map<String, Map<String, ObjectName>> serviceMapping = configRegistryClient.getServiceMapping();
    Map<String, Map<String, ObjectName>> expectedMapping = ImmutableMap.of(TestingThreadPoolServiceInterface.QNAME,
            (Map<String, ObjectName>) ImmutableMap.of(refName, withoutTransactionName(scheduledTPTransactionON)));
    assertEquals(expectedMapping, serviceMapping);

    // destroy all
    ConfigTransactionJMXClient transaction4 = configRegistryClient.createTransaction();
    Set<ObjectName> objectNames = transaction4.lookupConfigBeans();
    for (ObjectName on : objectNames) {
        transaction4.destroyModule(on);
    }
    transaction4.commit();

    serviceMapping = configRegistryClient.getServiceMapping();
    assertTrue(serviceMapping.isEmpty());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:67,代码来源:ServiceReferenceRegistryImplTest.java


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