本文整理汇总了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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例9: stopContext
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
protected static void stopContext()
{
ApplicationContextHelper.closeApplicationContext();
}
示例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());
}
示例11: stopContext
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
protected static void stopContext()
{
ApplicationContextHelper.closeApplicationContext();
}
示例12: afterClass
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@AfterClass
public static void afterClass()
{
ApplicationContextHelper.closeApplicationContext();
}
示例13: after
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
@After
public void after()
{
ApplicationContextHelper.closeApplicationContext();
}
示例14: setUp
import org.alfresco.util.ApplicationContextHelper; //导入方法依赖的package包/类
public void setUp() throws Exception
{
// Ensure there's nothing kicking about
ApplicationContextHelper.closeApplicationContext();
}
示例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();
}