@Before public void seedTheDht() throws Exception { instanceId = String.format("i-07VO7Y%d", instanceIdIndex); System.err.println("instanceId: " + instanceId); instanceIdIndex++; getBeanReferences(); seed(); putImageIntoDht(); putUserIntoDht(); putInstanceIntoDht(instanceId); putInstanceTypeIntoDht(); instancePath = String.format( "%s/%s/%s", properties.getProperty("instances.directory"), instance.getUserId(), instanceId); instanceImagePath = String.format("%s/%s", instancePath, IMAGE_ID); instanceManagerApplication.becomeActive(); AnycastHandler anycastHandler = (AnycastHandler) context.getBean("anycastHandler"); anycastHandler.refreshInstanceTypes(); Thread.sleep(3000); // to allow async initialisations etc }
@BeforeClass public static void loadCommonApplicationContextAndStartTheNode() { context = new ClassPathXmlApplicationContext("commonApplicationContext.xml"); xenRefreshHandler = (XenRefreshHandler) context.getBean("xenRefreshHandler"); xenRefreshHandler.setInitialIntervalMillis(1000); xenRefreshHandler.setRepeatingIntervalMillis(1000); properties = (Properties) context.getBean("properties"); KoalaNode koalaNode = (KoalaNode) context.getBean("koalaNode"); koalaNode.start(); AnycastHandler anycastHandler = (AnycastHandler) context.getBean("anycastHandler"); anycastHandler.refreshInstanceTypes(); FileUtils.deleteQuietly(new File("tmp")); }