Search in sources :

Example 1 with UserDAOImple

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

the class XmlFile method initUser.

private void initUser() {
    String path = this.xmlPath + System.getProperty("file.separator") + "user.xml";
    init(path, "users");
    UserDAOImple userDAO = new UserDAOImple();
    userDAO.setXmlFileLoader(xmlFileLoader);
    try {
        userDAO.afterPropertiesSet();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        Assert.fail();
    }
    UserDO user = new UserDO();
    user.setPassword("utest");
    user.setRealname("utest");
    user.setStatus("Normal");
    user.setUser_role("SystemAdmin");
    user.setUsername("utest");
    userDAO.addUser(user);
}
Also used : UserDO(com.alibaba.cobar.manager.dataobject.xml.UserDO) UserDAOImple(com.alibaba.cobar.manager.dao.xml.UserDAOImple) IOException(java.io.IOException)

Example 2 with UserDAOImple

use of com.alibaba.cobar.manager.dao.xml.UserDAOImple 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)

Aggregations

UserDAOImple (com.alibaba.cobar.manager.dao.xml.UserDAOImple)2 IOException (java.io.IOException)2 XMLFileLoaderPath (com.alibaba.cobar.manager.dao.xml.XMLFileLoaderPath)1 UserDO (com.alibaba.cobar.manager.dataobject.xml.UserDO)1 Before (org.junit.Before)1