@BeforeClass public static void initializeData() { try { Config.loadProperties(); String datasource = Config.getDatasource(); pool = ConnectionPoolFactory.getConnectionPool(datasource); reader = new JSONParser(); DAOFactory factory = new DAOFactory(datasource); workspaceDAO = factory.getWorkspaceDao(connection); userDao = factory.getUserDao(connection); deviceDao = factory.getDeviceDAO(connection); objectDao = factory.getItemDAO(connection); oversionDao = factory.getItemVersionDAO(connection); User user = new User(user1, "tester1", "tester1", "AUTH_12312312", "[email protected]", 100L, 0L, 0L); userDao.add(user); Workspace workspace = new Workspace(null, 1, user, false, false); workspaceDAO.add(workspace); Device device = new Device(null, "junitdevice", user); deviceDao.add(device); } catch (Exception e) { e.printStackTrace(); } }
@BeforeClass public static void initializeData() throws Exception { Config.loadProperties(); String datasource = Config.getDatasource(); ConnectionPool pool = ConnectionPoolFactory.getConnectionPool(datasource); handler = new SQLHandler(pool); DAOFactory factory = new DAOFactory(datasource); Connection connection = pool.getConnection(); workspaceDAO = factory.getWorkspaceDao(connection); userDao = factory.getUserDao(connection); user1 = new User(UUID.randomUUID(), "tester1", "tester1", "AUTH_12312312", "[email protected]", 100, 0); userDao.add(user1); Workspace workspace1 = new Workspace(null, 1, user1, false, false); workspaceDAO.add(workspace1); user2 = new User(UUID.randomUUID(), "tester1", "tester1", "AUTH_12312312", "[email protected]", 100, 0); userDao.add(user2); Workspace workspace2 = new Workspace(null, 1, user2, false, false); workspaceDAO.add(workspace2); }
@Override public AccountInfo getAccountInfo(GetAccountRequest request) throws UserNotFoundException { logger.debug(request); User user = getHandler().doGetUser(request.getEmail()); AccountInfo accountInfo = new AccountInfo(); accountInfo.setUserId(user.getId()); accountInfo.setName(user.getName()); accountInfo.setEmail(user.getEmail()); accountInfo.setQuotaLimit(user.getQuotaLimit()); // TODO: Add real quota used to account info? accountInfo.setQuotaUsed(user.getQuotaUsedLogical()); accountInfo.setSwiftUser(user.getSwiftUser()); accountInfo.setSwiftTenant(Config.getSwiftTenant()); accountInfo.setSwiftAuthUrl(Config.getSwiftAuthUrl()); return accountInfo; }