Search in sources :

Example 1 with Config

use of com.chinaunicom.rundocker.store.Config in project mesosFramework by zhizuqiu.

the class Tools method getObjFromConfigUseJsonPath.

/**
 * 使用jsonPath工具,获取config的json里面的值
 *
 * @param operator jsonPath参数
 * @return 值
 */
public static Object getObjFromConfigUseJsonPath(String operator) {
    Config config = AppDataStore.getConfig();
    if (config == null) {
        return null;
    }
    if (operator == null || operator.trim().isEmpty()) {
        return config;
    }
    Object obj = null;
    try {
        String json = new Gson().toJson(config);
        obj = JsonPath.read(json, operator);
    } catch (Exception e) {
        logger.error(e.getMessage());
    }
    return obj;
}
Also used : Config(com.chinaunicom.rundocker.store.Config)

Example 2 with Config

use of com.chinaunicom.rundocker.store.Config in project mesosFramework by zhizuqiu.

the class EtcdServiceTest method before.

@Before
public void before() {
    // http://192.168.84.131:2379
    Etcd etcd = EtcdClient.getInstance("http://10.124.142.127:5379");
    etcdService = new EtcdService(etcd);
    Config config = new Config();
    config.setFrameworkName("dockerFramework");
    AppDataStore.setConfig(config);
}
Also used : Etcd(com.chinaunicom.etcd.v2.Etcd) EtcdService(com.chinaunicom.rundocker.service.EtcdService) Config(com.chinaunicom.rundocker.store.Config) Before(org.junit.Before)

Example 3 with Config

use of com.chinaunicom.rundocker.store.Config in project mesosFramework by zhizuqiu.

the class SchedulerServiceTest method be.

@Before
public void be() {
    AppDataStore.setConfig(new Config());
    AppDataStore.getConfig().setStoreMustachePath("springcloud/default.mustache");
}
Also used : Config(com.chinaunicom.rundocker.store.Config) Before(org.junit.Before)

Example 4 with Config

use of com.chinaunicom.rundocker.store.Config in project mesosFramework by zhizuqiu.

the class ToolsTest method before.

@Before
public void before() {
    String id = "/2048/1";
    DockerJob dockerJob = new DockerJob();
    dockerJob.setId(id);
    AppDataStore.jobsPut(id.replaceAll("/", "."), dockerJob);
    DockerStatus dockerStatus = new DockerStatus();
    dockerStatus.setId(id);
    AppDataStore.statusPut(id.replaceAll("/", "."), dockerStatus);
    AppDataStore.setConfig(new Config());
    AppDataStore.getConfig().setFrameworkName("2048");
}
Also used : Config(com.chinaunicom.rundocker.store.Config) DockerStatus(com.chinaunicom.rundocker.bean.DockerStatus) DockerJob(com.chinaunicom.rundocker.bean.DockerJob) Before(org.junit.Before)

Aggregations

Config (com.chinaunicom.rundocker.store.Config)4 Before (org.junit.Before)3 Etcd (com.chinaunicom.etcd.v2.Etcd)1 DockerJob (com.chinaunicom.rundocker.bean.DockerJob)1 DockerStatus (com.chinaunicom.rundocker.bean.DockerStatus)1 EtcdService (com.chinaunicom.rundocker.service.EtcdService)1