@BeforeClass public static void setup() throws AmbariException { injector = Guice.createInjector(new InMemoryDefaultTestModule()); injector.getInstance(GuiceJpaInitializer.class); configHelper = injector.getInstance(ConfigHelper.class); configFactory = injector.getInstance(ConfigFactory.class); clusters = injector.getInstance(Clusters.class); clusters.addHost(HOST1); clusters.getHost(HOST1).persist(); clusters.addCluster(CLUSTER1); Cluster cluster1 = clusters.getCluster(CLUSTER1); SERVICE_SITE_CLUSTER = new HashMap<String, String>(); SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME1, SERVICE_SITE_VAL1); SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2); SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME3, SERVICE_SITE_VAL3); SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME4, SERVICE_SITE_VAL4); SERVICE_SITE_SERVICE = new HashMap<String, String>(); SERVICE_SITE_SERVICE.put(SERVICE_SITE_NAME1, SERVICE_SITE_VAL1_S); SERVICE_SITE_SERVICE.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2_S); SERVICE_SITE_SERVICE.put(SERVICE_SITE_NAME5, SERVICE_SITE_VAL5_S); SERVICE_SITE_HOST = new HashMap<String, String>(); SERVICE_SITE_HOST.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2_H); SERVICE_SITE_HOST.put(SERVICE_SITE_NAME6, SERVICE_SITE_VAL6_H); GLOBAL_CLUSTER = new HashMap<String, String>(); GLOBAL_CLUSTER.put(GLOBAL_NAME1, GLOBAL_CLUSTER_VAL1); GLOBAL_CLUSTER.put(GLOBAL_NAME2, GLOBAL_CLUSTER_VAL2); CONFIG_ATTRIBUTES = new HashMap<String, Map<String, String>>(); // Cluster level global config Config globalConfig = configFactory.createNew(cluster1, GLOBAL_CONFIG, GLOBAL_CLUSTER, CONFIG_ATTRIBUTES); globalConfig.setTag(CLUSTER_VERSION_TAG); cluster1.addConfig(globalConfig); // Cluster level service config Config serviceSiteConfigCluster = configFactory.createNew( cluster1, SERVICE_SITE_CONFIG, SERVICE_SITE_CLUSTER, CONFIG_ATTRIBUTES); serviceSiteConfigCluster.setTag(CLUSTER_VERSION_TAG); cluster1.addConfig(serviceSiteConfigCluster); // Service level service config Config serviceSiteConfigService = configFactory.createNew( cluster1, SERVICE_SITE_CONFIG, SERVICE_SITE_SERVICE, CONFIG_ATTRIBUTES); serviceSiteConfigService.setTag(SERVICE_VERSION_TAG); cluster1.addConfig(serviceSiteConfigService); // Host level service config Config serviceSiteConfigHost = configFactory.createNew( cluster1, SERVICE_SITE_CONFIG, SERVICE_SITE_HOST, CONFIG_ATTRIBUTES); serviceSiteConfigHost.setTag(HOST_VERSION_TAG); cluster1.addConfig(serviceSiteConfigHost); ActionDBAccessor db = injector.getInstance(ActionDBAccessorImpl.class); createTask(db, 1, 1, HOST1, CLUSTER1); }