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


Java ApplicationContextHelper.closeApplicationContext方法代码示例

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


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

示例1: main

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
 * @see #testPerformance()
 */
public static void main(String ... args)
{
    try
    {
        CacheTest test = new CacheTest();
        test.setUp();
        System.out.println("Press any key to run initialization test ...");
        System.in.read();
        test.testInitializationPerformance();
        System.out.println("Press any key to run performance test ...");
        System.in.read();
        test.testPerformance();
        System.out.println("Press any key to shutdown ...");
        System.in.read();
        test.tearDown();
    }
    catch (Throwable e)
    {
        e.printStackTrace();
    }
    finally
    {
        ApplicationContextHelper.closeApplicationContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:CacheTest.java

示例2: main

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
public static void main(String[] args)
{
    try
    {
        AuditDAOTest test = new AuditDAOTest();
        test.setUp();
        System.out.println("Press any key to run performance test.");
        System.in.read();
        test.scriptCanDeleteOrphanedPropsPerformance();
        System.out.println("Press any key to shutdown.");
        System.in.read();
        test.tearDown();
    }
    catch (Throwable e)
    {
        e.printStackTrace();
    }
    finally
    {
        ApplicationContextHelper.closeApplicationContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:AuditDAOTest.java

示例3: tidyAfterTestClass

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
 * Clear up after all the tests have finished and dereference the application context to allow it to be garbage
 * collected.
 */
@AfterClass
public static void tidyAfterTestClass()
{
    ApplicationContextHelper.closeApplicationContext();
    applicationContext = null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:QNameTypeEditorTest.java

示例4: closeContext

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
public static void closeContext() throws NoSuchFieldException, IllegalAccessException, InterruptedException
{
    ApplicationContextHelper.closeApplicationContext();

    Thread.yield();
    Thread.sleep(25);
    Thread.yield();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:WorkflowSuiteContextShutdownTest.java

示例5: setUp

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
    ApplicationContextHelper.closeApplicationContext();
    context = ApplicationContextHelper.getApplicationContext(new String[] { ApplicationContextHelper.CONFIG_LOCATIONS[0],
            "classpath:org/alfresco/repo/client/config/test-repo-clients-apps-context.xml" });

    clientAppConfig = context.getBean("clientAppConfigTest", ClientAppConfig.class);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:ClientAppConfigTest.java

示例6: testOpenClose

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
 * Tests that we can open a context, use
 *  it, and then close it again without error
 */
public void testOpenClose() throws Exception
{
   assertNoCachedApplicationContext();
   
   ApplicationContext ctx = getMinimalContext();
   
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   ApplicationContextHelper.closeApplicationContext();
   
   assertNoCachedApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:RepositoryStartStopTest.java

示例7: testOpenCloseOpenCloseNoAutostart

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
 * Using a minimal no-autostart context:
 *  Test that we can bring up and close down
 *  a context twice without error, using it
 *  when running. 
 */
public void testOpenCloseOpenCloseNoAutostart() throws Exception
{
   assertNoCachedApplicationContext();

   // Open it, and use it
   ApplicationContext ctx = getMinimalContext();
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   // Close it down
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
   
   // Re-open it, we get a fresh copy
   ApplicationContext ctx2 = getMinimalContext();
   assertNotNull(ctx2);
   doTestBasicWriteOperations(ctx2);
   assertNotSame(ctx, ctx2);
   
   // Ask for it again, will be no change this time
   ctx = getMinimalContext();
   assertEquals(ctx, ctx2);
   
   // And finally close it
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:RepositoryStartStopTest.java

示例8: testOpenCloseOpenCloseFull

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
 * Using a full autostarting context:
 *  Test that we can bring up and close down
 *  a context twice without error, using it
 *  when running. 
 */
public void testOpenCloseOpenCloseFull() throws Exception
{
   assertNoCachedApplicationContext();

   // Open it, and use it
   ApplicationContext ctx = getFullContext();
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   // Close it down
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
   
   // Re-open it, we get a fresh copy
   ApplicationContext ctx2 = getFullContext();
   assertNotNull(ctx2);
   doTestBasicWriteOperations(ctx2);
   
   // Ask for it again, will be no change this time
   ctx = getFullContext();
   assertEquals(ctx, ctx2);
   
   // Refresh it, shouldn't break anything
   ((AbstractApplicationContext)ctx).refresh();
   
   // And finally close it
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:RepositoryStartStopTest.java

示例9: stopContext

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
protected static void stopContext()
{
    ApplicationContextHelper.closeApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:5,代码来源:AbstractBulkImportTests.java

示例10: testActivateModelAndRestartRepo

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@Test
public void testActivateModelAndRestartRepo() throws Exception
{
    final long timeMillis = System.currentTimeMillis();
    final String uri = "http://www.alfresco.org/model/testcmmrestartnamespace" + timeMillis;
    final String prefix = "testcmmrestart" + timeMillis;

    final M2Model model = M2Model.createModel(prefix + QName.NAMESPACE_PREFIX + modelName);
    model.createNamespace(uri, prefix);

    // Create the model
    CustomModelDefinition modelDefinition = transactionHelper.doInTransaction(new RetryingTransactionCallback<CustomModelDefinition>()
    {
        public CustomModelDefinition execute() throws Exception
        {
            return customModelService.createCustomModel(model, false);
        }
    });

    assertNotNull(modelDefinition);
    assertEquals(modelName, modelDefinition.getName().getLocalName());
    assertFalse(modelDefinition.isActive());

    // Activate the model
    transactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Exception
        {
            customModelService.activateCustomModel(modelName);
            return null;
        }
    });

    // Retrieve the model
    modelDefinition = getModel(modelName);
    assertNotNull(modelDefinition);
    assertEquals(modelName, modelDefinition.getName().getLocalName());
    assertTrue(modelDefinition.isActive());

    // Close the application context
    ApplicationContextHelper.closeApplicationContext();
    // Get the application context and set the beans
    getCtxAndSetBeans();

    // Retrieve the model after the server restart
    modelDefinition = getModel(modelName);
    assertNotNull(modelDefinition);
    assertEquals(modelName, modelDefinition.getName().getLocalName());
    assertTrue(modelDefinition.isActive());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:51,代码来源:CustomModelRepoRestartTest.java

示例11: stopContext

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
protected static void stopContext()
{
    ApplicationContextHelper.closeApplicationContext();     
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:5,代码来源:DBQueryTest.java

示例12: afterClass

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@AfterClass
public static void afterClass()
{
    ApplicationContextHelper.closeApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:StandardQuotaStrategyTest.java

示例13: after

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@After
  public void after()
  {
ApplicationContextHelper.closeApplicationContext();
  }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:TransactionCleanupTest.java

示例14: setUp

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
public void setUp() throws Exception
{
    // Ensure there's nothing kicking about
    ApplicationContextHelper.closeApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:RepositoryStartStopTest.java

示例15: testOpenCloseRepeatedly

import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
/**
 * Tests that we can open a context, use it,
 *  close it, and open a different one.
 * Does this by opening and closing contexts
 *  4 different times, sometimes full ones,
 *  sometimes minimal ones with no autostart.
 */
public void testOpenCloseRepeatedly() throws Exception {
   assertNoCachedApplicationContext();

   // Open the minimal one and test
   ApplicationContext ctx = getMinimalContext();
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   // Close
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
   
   
   // Now open the full one
   ctx = getFullContext();
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   // Ask for it again, will get the same thing
   ApplicationContext ctxSav = ctx;
   ctx = getFullContext();
   assertEquals(ctx, ctxSav);
   
   // Close it
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
   
   
   // Back to the minimal one
   ctx = getMinimalContext();
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   // Close
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
   
   
   // And finally we want the full one again
   ctx = getFullContext();
   assertNotNull(ctx);
   doTestBasicWriteOperations(ctx);
   
   // Close and we're done
   ApplicationContextHelper.closeApplicationContext();
   assertNoCachedApplicationContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:55,代码来源:RepositoryStartStopTest.java


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