use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class QueueTaskJob method execute.
public void execute(JobContext context) throws Exception {
PortalContainer manager = PortalContainer.getInstance();
QueueTasks qtasks = (QueueTasks) manager.getComponentInstanceOfType(QueueTasks.class);
Task task = qtasks.poll();
while (task != null) {
try {
task.execute();
} catch (Exception ex) {
LOG.error(ex.getLocalizedMessage(), ex);
}
task = qtasks.poll();
}
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class TestAsynchronousListener method setUp.
public void setUp() throws Exception {
PortalContainer manager = PortalContainer.getInstance();
service_ = (ListenerService) manager.getComponentInstanceOfType(ListenerService.class);
TestHolder.tl.set("-suffix");
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class InitialContextTest method setUp.
public void setUp() throws Exception {
PortalContainer container = PortalContainer.getInstance();
initializer = (InitialContextInitializer) container.getComponentInstanceOfType(InitialContextInitializer.class);
assertNotNull(initializer);
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class TestSchedulerService method setUp.
public void setUp() throws Exception {
PortalContainer manager = PortalContainer.getInstance();
service_ = (JobSchedulerService) manager.getComponentInstanceOfType(JobSchedulerService.class);
}
use of org.exoplatform.container.PortalContainer in project kernel by exoplatform.
the class TestSchedulerService method testMultiplePortalContainers.
public void testMultiplePortalContainers() throws Exception {
ExoContainer oldContainer = ExoContainerContext.getCurrentContainerIfPresent();
MyComponent component;
PortalContainer container = null;
MyComponent component2;
PortalContainer container2 = null;
String oldProfileList = System.getProperty(PropertyManager.RUNTIME_PROFILES);
try {
try {
PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "MultiplePortalContainers");
component = (MyComponent) (container = RootContainer.getInstance().getPortalContainer("portal-container")).getComponentInstanceOfType(MyComponent.class);
} finally {
ExoContainerContext.setCurrentContainer(oldContainer);
}
try {
PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "MultiplePortalContainers,portal-container2");
component2 = (MyComponent) (container2 = RootContainer.getInstance().getPortalContainer("portal-container2")).getComponentInstanceOfType(MyComponent.class);
Thread.sleep(2000);
} finally {
ExoContainerContext.setCurrentContainer(oldContainer);
}
} finally {
if (oldProfileList == null) {
System.clearProperty(PropertyManager.RUNTIME_PROFILES);
} else {
System.setProperty(PropertyManager.RUNTIME_PROFILES, oldProfileList);
}
PropertyManager.refresh();
}
assertEquals("myJob1", component.name);
assertEquals(container, component.container);
assertTrue(component.endRequest > 0);
assertFalse(component.endRequestFailed);
assertEquals("myJob2", component2.name);
assertEquals(container2, component2.container);
assertTrue(component2.endRequest > 0);
assertFalse(component2.endRequestFailed);
}
Aggregations