@@ -0,0 +1,2679 @@
+package cc.blynk.server.utils;%0A%0Aimport cc.blynk.server.TestBase;%0Aimport cc.blynk.server.dao.FileManager;%0Aimport cc.blynk.server.model.DashBoard;%0Aimport cc.blynk.server.model.auth.User;%0Aimport cc.blynk.server.model.widgets.Widget;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/**%0A * User: ddumanskiy%0A * Date: 09.12.13%0A * Time: 8:07%0A */%0A@Ignore%0Apublic class UserStatisticsTest extends TestBase %7B%0A%0A    static FileManager fileManager;%0A    static Map%3CString, User%3E users;%0A%0A    @BeforeClass%0A    public static void init() %7B%0A        fileManager = new FileManager(%22/home/doom369/test/root/data%22);%0A        users = fileManager.deserialize();%0A%0A        System.out.println(users.size());%0A    %7D%0A%0A    @Test%0A    public void printBoardTypes() %7B%0A        System.out.println();%0A        System.out.println(%22Board Types :%22);%0A        Map%3CString, Integer%3E boards = new HashMap%3C%3E();%0A        for (User user : users.values()) %7B%0A            if (user.getProfile().getDashBoards() != null) %7B%0A                for (DashBoard dashBoard : user.getProfile().getDashBoards()) %7B%0A                    String type = dashBoard.getBoardType();%0A                    Integer i = boards.get(type);%0A                    if (i == null) %7B%0A                        i = 0;%0A                    %7D%0A                    boards.put(type, ++i);%0A                %7D%0A            %7D%0A        %7D%0A%0A        for (Map.Entry%3CString, Integer%3E entry : boards.entrySet()) %7B%0A            System.out.println(entry.getKey() + %22 : %22 + entry.getValue());%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void printWidgetUsage() %7B%0A        System.out.println();%0A        System.out.println(%22Widget Usage :%22);%0A        Map%3CString, Integer%3E boards = new HashMap%3C%3E();%0A        for (User user : users.values()) %7B%0A            if (user.getProfile().getDashBoards() != null) %7B%0A                for (DashBoard dashBoard : user.getProfile().getDashBoards()) %7B%0A                    if (dashBoard.getWidgets() != null) %7B%0A                        for (Widget widget : dashBoard.getWidgets()) %7B%0A                            Integer i = boards.get(widget.getClass().getSimpleName());%0A                            if (i == null) %7B%0A                                i = 0;%0A                            %7D%0A                            boards.put(widget.getClass().getSimpleName(), ++i);%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D else %7B%0A                System.out.println(JsonParser.toJson(user));%0A            %7D%0A        %7D%0A%0A        for (Map.Entry%3CString, Integer%3E entry : boards.entrySet()) %7B%0A            System.out.println(entry.getKey() + %22 : %22 + entry.getValue());%0A        %7D%0A    %7D%0A%0A%7D%0A

Test for user stats