Search in sources :

Example 6 with PersistService

use of com.alibaba.nacos.config.server.service.repository.PersistService in project nacos by alibaba.

the class ConfigDerbyRaft_DITCase method test_c_publish_config.

@Test
public void test_c_publish_config() throws Exception {
    ThreadUtils.sleep(5000);
    boolean result = iconfig9.publishConfig("raft_test", "cluster_test_2", "this.is.raft_cluster=lessspring_9");
    Assert.assertTrue(result);
    ThreadUtils.sleep(5000);
    ConfigurableApplicationContext context7 = applications.get("8847");
    ConfigurableApplicationContext context8 = applications.get("8848");
    ConfigurableApplicationContext context9 = applications.get("8849");
    PersistService operate7 = context7.getBean(EmbeddedStoragePersistServiceImpl.class);
    PersistService operate8 = context8.getBean(EmbeddedStoragePersistServiceImpl.class);
    PersistService operate9 = context9.getBean(EmbeddedStoragePersistServiceImpl.class);
    String s7 = operate7.findConfigInfo("raft_test", "cluster_test_2", "").getContent();
    String s8 = operate8.findConfigInfo("raft_test", "cluster_test_2", "").getContent();
    String s9 = operate9.findConfigInfo("raft_test", "cluster_test_2", "").getContent();
    Assert.assertArrayEquals("The three nodes must have consistent data", new String[] { s7, s8, s9 }, new String[] { "this.is.raft_cluster=lessspring_9", "this.is.raft_cluster=lessspring_9", "this.is.raft_cluster=lessspring_9" });
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) PersistService(com.alibaba.nacos.config.server.service.repository.PersistService) Test(org.junit.Test) BaseClusterTest(com.alibaba.nacos.test.base.BaseClusterTest)

Aggregations

PersistService (com.alibaba.nacos.config.server.service.repository.PersistService)6 Test (org.junit.Test)5 BaseClusterTest (com.alibaba.nacos.test.base.BaseClusterTest)4 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)4 ConfigInfo (com.alibaba.nacos.config.server.model.ConfigInfo)2 RestResult (com.alibaba.nacos.common.model.RestResult)1 ConfigInfo4Beta (com.alibaba.nacos.config.server.model.ConfigInfo4Beta)1 ConfigInfo4Tag (com.alibaba.nacos.config.server.model.ConfigInfo4Tag)1 ConfigDumpEvent (com.alibaba.nacos.config.server.model.event.ConfigDumpEvent)1 DumpTask (com.alibaba.nacos.config.server.service.dump.task.DumpTask)1 DatabaseOperate (com.alibaba.nacos.config.server.service.repository.embedded.DatabaseOperate)1 File (java.io.File)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1