use of org.springframework.context.support.ClassPathXmlApplicationContext in project Activiti by Activiti.
the class SpringAutoDeployTest method testResourceRedeploymentAfterProcessDefinitionChange.
// Updating the bpmn20 file should lead to a new deployment when restarting
// the Spring container
public void testResourceRedeploymentAfterProcessDefinitionChange() throws Exception {
createAppContext(CTX_PATH);
assertEquals(1, repositoryService.createDeploymentQuery().count());
((AbstractXmlApplicationContext) applicationContext).destroy();
String filePath = "org/activiti/spring/test/autodeployment/autodeploy.a.bpmn20.xml";
String originalBpmnFileContent = IoUtil.readFileAsString(filePath);
String updatedBpmnFileContent = originalBpmnFileContent.replace("flow1", "fromStartToEndFlow");
assertTrue(updatedBpmnFileContent.length() > originalBpmnFileContent.length());
IoUtil.writeStringToFile(updatedBpmnFileContent, filePath);
// Classic produced/consumer problem here:
// The file is already written in Java, but not yet completely persisted by
// the OS
// Constructing the new app context reads the same file which is sometimes
// not yet fully written to disk
waitUntilFileIsWritten(filePath, updatedBpmnFileContent.length());
try {
applicationContext = new ClassPathXmlApplicationContext(CTX_NO_DROP_PATH);
repositoryService = (RepositoryService) applicationContext.getBean("repositoryService");
} finally {
// Reset file content such that future test are not seeing something funny
IoUtil.writeStringToFile(originalBpmnFileContent, filePath);
}
// Assertions come AFTER the file write! Otherwise the process file is
// messed up if the assertions fail.
assertEquals(2, repositoryService.createDeploymentQuery().count());
assertEquals(6, repositoryService.createProcessDefinitionQuery().count());
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project ORCID-Source by ORCID.
the class LoadRinggoldData method init.
@SuppressWarnings("resource")
private void init() {
ApplicationContext context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
orgDisambiguatedDao = (OrgDisambiguatedDao) context.getBean("orgDisambiguatedDao");
orgDisambiguatedSolrDao = (OrgDisambiguatedSolrDao) context.getBean("orgDisambiguatedSolrDao");
orgManager = (OrgManager) context.getBean("orgManager");
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project ORCID-Source by ORCID.
the class MigrateAddressData method init.
@SuppressWarnings("resource")
private void init() {
ApplicationContext context = new ClassPathXmlApplicationContext("orcid-persistence-context.xml");
addressDao = (AddressDao) context.getBean("addressDao");
transactionTemplate = (TransactionTemplate) context.getBean("transactionTemplate");
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project ORCID-Source by ORCID.
the class MigrateEmails method init.
@SuppressWarnings("resource")
private void init() {
ApplicationContext context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
profileDao = (ProfileDao) context.getBean("profileDao");
orcidProfileManager = (OrcidProfileManager) context.getBean("orcidProfileManager");
transactionTemplate = (TransactionTemplate) context.getBean("transactionTemplate");
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project ORCID-Source by ORCID.
the class LoadIdentityProviders method main.
@SuppressWarnings("resource")
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
IdentityProviderManager identityProviderManager = (IdentityProviderManager) context.getBean("identityProviderManager");
identityProviderManager.loadIdentityProviders();
System.exit(0);
}
Aggregations