Search in sources :

Example 1 with XMLFileLoaderPath

use of com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath in project cobar by alibaba.

the class PropertyDaoTest method initData.

@Before
public void initData() {
    Assert.assertNotNull(xmlPath);
    propertyXmlPath = xmlPath + System.getProperty("file.separator") + "property.xml";
    xmlFileLoader = new XMLFileLoaderPath();
    xmlFileLoader.setXmlPath(xmlPath);
    propertyDao = new PropertyDAOImple();
    propertyDao.setXmlFileLoader(xmlFileLoader);
    XmlFile xmlFile = new XmlFile(propertyXmlPath, "pro");
    try {
        xmlFile.init();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
    read();
}
Also used : PropertyDAOImple(com.alibaba.cobar.manager.dao.xml.PropertyDAOImple) XMLFileLoaderPath(com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath) Before(org.junit.Before)

Example 2 with XMLFileLoaderPath

use of com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath in project cobar by alibaba.

the class UserDaoTest method initData.

@Before
public void initData() {
    Assert.assertNotNull(xmlPath);
    userDao = new UserDAOImple();
    xmlFileLoader = new XMLFileLoaderPath();
    xmlFileLoader.setXmlPath(xmlPath);
    userDao.setXmlFileLoader(xmlFileLoader);
    userXmlPath = xmlPath + System.getProperty("file.separator") + "user.xml";
    XmlFile xmlFile = new XmlFile(userXmlPath, "users");
    try {
        xmlFile.init();
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
    read();
}
Also used : UserDAOImple(com.alibaba.cobar.manager.dao.xml.UserDAOImple) IOException(java.io.IOException) XMLFileLoaderPath(com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath) Before(org.junit.Before)

Example 3 with XMLFileLoaderPath

use of com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath in project cobar by alibaba.

the class CobarAccessTest method main.

public static void main(String[] args) throws Exception {
    String xmlpath = "./src/main/resources/";
    CobarAccesser accesser = new CobarAccesser();
    XmlAccesser xmlAccesser = new XmlAccesser();
    XMLFileLoaderPath xmlFileLoader = new XMLFileLoaderPath();
    xmlFileLoader.setXmlPath(xmlpath);
    ClusterDAOImple cluster = new ClusterDAOImple();
    cluster.setXmlFileLoader(xmlFileLoader);
    cluster.afterPropertiesSet();
    CobarDAOImple cobar = new CobarDAOImple();
    cobar.setXmlFileLoader(xmlFileLoader);
    cobar.afterPropertiesSet();
    xmlAccesser.setClusterDAO(cluster);
    xmlAccesser.setCobarDAO(cobar);
    accesser.setXmlAccesser(xmlAccesser);
    AdapterDelegate res = new AdapterDelegate();
    accesser.setCobarAdapterDelegate(res);
    CobarAdapterDAO perf = accesser.getAccesser(1L);
    String version = perf.getVersion();
    System.out.println(version);
    ServerStatus ss = perf.getServerStatus();
    System.out.println(ss.getMaxMemory());
    System.out.println(ss.getStatus());
    System.out.println(ss.getTotalMemory());
    System.out.println(ss.getUptime());
    System.out.println(ss.getUsedMemory());
    System.out.println(ss.getReloadTime());
    System.out.println(ss.getRollbackTime());
    List<String> databases = perf.listDataBases();
    for (String s : databases) {
        System.out.println(s);
    }
//        perf.reloadConfig();
//        perf.rollbackConfig();
//        int num = perf.switchDataNode("circe,cndb,dubbo,napoli", 0);
//        System.out.println("num: " + num);
//        int num = perf.stopHeartbeat("circe,cndb,dubbo,napoli", -10);
//        System.out.println("num: " + num);
}
Also used : CobarAdapterDAO(com.alibaba.cobar.manager.dao.CobarAdapterDAO) ClusterDAOImple(com.alibaba.cobar.manager.dao.xml.ClusterDAOImple) XmlAccesser(com.alibaba.cobar.manager.service.XmlAccesser) ServerStatus(com.alibaba.cobar.manager.dataobject.cobarnode.ServerStatus) XMLFileLoaderPath(com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath) CobarDAOImple(com.alibaba.cobar.manager.dao.xml.CobarDAOImple) CobarAccesser(com.alibaba.cobar.manager.service.CobarAccesser) AdapterDelegate(com.alibaba.cobar.manager.dao.delegate.AdapterDelegate)

Example 4 with XMLFileLoaderPath

use of com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath in project cobar by alibaba.

the class TestXMLFileLoader method main.

public static void main(String[] args) {
    XMLFileLoaderPath p = new XMLFileLoaderPath();
    System.out.println(p.getFilePath());
}
Also used : XMLFileLoaderPath(com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath)

Example 5 with XMLFileLoaderPath

use of com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath in project cobar by alibaba.

the class ClusterDaoTest method initData.

@Before
public void initData() {
    Assert.assertNotNull(xmlPath);
    xmlFileLoader = new XMLFileLoaderPath();
    xmlFileLoader.setXmlPath(xmlPath);
    clusterDao = new ClusterDAOImple();
    clusterDao.setXmlFileLoader(xmlFileLoader);
    clusterXmlPath = xmlPath + System.getProperty("file.separator") + "cluster.xml";
    XmlFile xmlFile = new XmlFile(clusterXmlPath, "clusters");
    try {
        xmlFile.init();
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
    read();
}
Also used : ClusterDAOImple(com.alibaba.cobar.manager.dao.xml.ClusterDAOImple) IOException(java.io.IOException) XMLFileLoaderPath(com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath) Before(org.junit.Before)

Aggregations

XMLFileLoaderPath (com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath)6 Before (org.junit.Before)4 IOException (java.io.IOException)3 ClusterDAOImple (com.alibaba.cobar.manager.dao.xml.ClusterDAOImple)2 CobarDAOImple (com.alibaba.cobar.manager.dao.xml.CobarDAOImple)2 CobarAdapterDAO (com.alibaba.cobar.manager.dao.CobarAdapterDAO)1 AdapterDelegate (com.alibaba.cobar.manager.dao.delegate.AdapterDelegate)1 PropertyDAOImple (com.alibaba.cobar.manager.dao.xml.PropertyDAOImple)1 UserDAOImple (com.alibaba.cobar.manager.dao.xml.UserDAOImple)1 ServerStatus (com.alibaba.cobar.manager.dataobject.cobarnode.ServerStatus)1 CobarAccesser (com.alibaba.cobar.manager.service.CobarAccesser)1 XmlAccesser (com.alibaba.cobar.manager.service.XmlAccesser)1