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


Java Nucleus.stopService方法代码示例

本文整理汇总了Java中atg.nucleus.Nucleus.stopService方法的典型用法代码示例。如果您正苦于以下问题:Java Nucleus.stopService方法的具体用法?Java Nucleus.stopService怎么用?Java Nucleus.stopService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在atg.nucleus.Nucleus的用法示例。


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

示例1: setUpAndTest

import atg.nucleus.Nucleus; //导入方法依赖的package包/类
/**
 * Create a repository in the given configpath using the given repository definitions (Absolute
 * paths)
 * connecting to the db whose properties are specified in pDBProperties @see DBUtils
 * Method pMethodName is invoked with the GSARepository passed to it as a parameter.
 *
 * @param pConfigPathWhereToCreateTheRepository
 *
 * @param definitionFiles
 * @param pDBProperties
 * @param pMethodName
 *
 * @throws Exception
 */
void setUpAndTest(File pConfigPathWhereToCreateTheRepository,
                  String[] definitionFiles,
                  Properties pDBProperties,
                  String pMethodName)
        throws Exception {
    String repositoryComponentPath = "/" + getName() + "Repository";
    GSATestUtils.getGSATestUtils().initializeMinimalConfigpath(
            pConfigPathWhereToCreateTheRepository,
            repositoryComponentPath,
            definitionFiles,
            pDBProperties,
            null,
            null,
            null,
            true
    );
    Nucleus n = startNucleus(pConfigPathWhereToCreateTheRepository);
    GSARepository r = (GSARepository) n.resolveName(repositoryComponentPath);
    try {
        getClass().getMethod(pMethodName, new Class[] { GSARepository.class })
                .invoke(this, r);
    } catch ( NoSuchMethodError e ) {
        throw new AssertionError(
                "Please declare a method with name "
                + pMethodName
                + " in your class. It must take an atg.adapter.gsa.GSARepository as the only parameter."
        );
    } finally {
        // if it were null a NPE would have occurred at the earlier dereference
        //if(n != null)
        n.stopService();
    }
}
 
开发者ID:jvz,项目名称:dynunit,代码行数:48,代码来源:GSATest.java

示例2: testComponentStartup

import atg.nucleus.Nucleus; //导入方法依赖的package包/类
/**
 * Start up a nucleus given a local test "configpath". In that configpath is a
 * .properties file for our TestComponent
 *
 * @throws Exception
 */
@Test
public void testComponentStartup()
        throws Exception {
    File configpath = NucleusUtils.getConfigPath(this.getClass(), "config");
    // Put test .properties file in configpath path
    Properties props = new Properties();
    File propFile = NucleusUtils.createProperties(
            "test/SimpleComponentGlobalScope",
            configpath,
            "com.mycompany.SimpleComponent",
            props
    );
    propFile.deleteOnExit();
    List<String> initial = new ArrayList<String>();
    initial.add("/test/SimpleComponentGlobalScope");
    NucleusUtils.createInitial(configpath, initial);
    Nucleus n = NucleusUtils.startNucleus(configpath);
    SimpleComponent testComponent = null;
    try {
        testComponent = (SimpleComponent) n.resolveName("/test/SimpleComponentGlobalScope");
        assertNotNull("Could not resolve test component", testComponent);
        assertTrue(
                "Test component did not start up cleanly.", testComponent.isCleanStart
        );

    } finally {
        n.stopService();
        assertNotNull(testComponent);
        assertFalse(
                "Test component did not shut down cleanly.", testComponent.isCleanStart
        );
        testComponent = null;
    }

}
 
开发者ID:jvz,项目名称:dynunit,代码行数:42,代码来源:FirstTest.java

示例3: testSimple

import atg.nucleus.Nucleus; //导入方法依赖的package包/类
public void testSimple()
        throws Exception {

    // setup the repository
    File configpath = new File(
            "target/test-classes/config".replace(
                    "/", File.separator
            )
    );

    // Define the path to our repository definition file called
    // "simpleRepository.xml"
    final String[] definitionFiles = { "/test/simpleRepository.xml" };
    log.info("definitionFile[0]={}", definitionFiles[0]);

    // Copy all related properties and definition files to the previously
    // configured configpath
    FileUtil.copyDirectory(
            "src/test/resources/config",
            configpath.getPath(),
            Arrays.asList(".svn")
    );

    // Use the DBUtils utility class to get JDBC properties for an in memory
    // HSQL DB called "testdb".
    Properties props = DBUtils.getHSQLDBInMemoryDBConnection("testdb");

    // Start up our database
    DBUtils db = initDB(props);

    boolean rollback = true;

    // Setup our testing configpath
    // RH: disabled logging (last argument to false) to get rid of the double
    // logging statements
    GSATestUtils.getGSATestUtils().initializeMinimalConfigpath(
            configpath, "/SimpleRepository", definitionFiles, props, null, null, null, false
    );

    // Start Nucleus
    Nucleus n = startNucleus(configpath);

    TransactionDemarcation td = new TransactionDemarcation();
    MutableRepository r = (MutableRepository) n.resolveName("/SimpleRepository");

    try {
        // Start a new transaction
        td.begin(((GSARepository) r).getTransactionManager());
        // Create the item
        MutableRepositoryItem item = r.createItem("simpleItem");
        item.setPropertyValue("name", "simpleName");
        // Persist to the repository
        r.addItem(item);
        // Try to get it back from the repository
        String id = item.getRepositoryId();
        RepositoryItem item2 = r.getItem(id, "simpleItem");
        assertNotNull(
                " We did not get back the item just created from the repository.", item2
        );
        rollback = false;
    } finally {
        // End the transaction, rollback on error
        td.end(rollback);
        // shut down Nucleus
        n.stopService();
        // Shut down HSQLDB
        db.shutdown();
    }
}
 
开发者ID:jvz,项目名称:dynunit,代码行数:70,代码来源:SimpleRepositoryTest.java

示例4: stopNucleus

import atg.nucleus.Nucleus; //导入方法依赖的package包/类
/**
 * Shutdown the specified Nucleus and try to delete the associated
 * temporary server directory. Typically used on a Nucleus created
 * by startNucleusWithModules.
 *
 * @param nucleus
 *         the nucleus instance to shut down.
 *
 * @throws ServiceException
 *         if an error occurs
 * @throws IOException
 *         if an error occurs (such as a failure
 *         to remove the temporary server directory).
 */
public static void stopNucleus(Nucleus nucleus)
        throws IOException, ServiceException {
    if (nucleus.isRunning()) {
        try {
            nucleus.stopService();
        } catch (ServiceException e) {
            throw logger.throwing(e);
        } finally {
            cleanUpNucleusTemporaryFiles(nucleus);
        }
    }
}
 
开发者ID:jvz,项目名称:dynunit,代码行数:27,代码来源:NucleusUtils.java


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