Search in sources :

Example 1 with ApplicationIndexDao

use of com.navercorp.pinpoint.web.dao.ApplicationIndexDao in project pinpoint by naver.

the class HeapUsageRateCheckerTest method before.

@BeforeClass
public static void before() {
    jvmGcDao = new AgentStatDao<JvmGcBo>() {

        @Override
        public List<JvmGcBo> getAgentStatList(String agentId, Range range) {
            List<JvmGcBo> jvmGcs = new LinkedList<>();
            for (int i = 0; i < 36; i++) {
                JvmGcBo jvmGcBo = new JvmGcBo();
                jvmGcBo.setHeapUsed(70L);
                jvmGcBo.setHeapMax(100L);
                jvmGcs.add(jvmGcBo);
            }
            return jvmGcs;
        }

        @Override
        public boolean agentStatExists(String agentId, Range range) {
            return true;
        }
    };
    cpuLoadDao = new AgentStatDao<CpuLoadBo>() {

        @Override
        public List<CpuLoadBo> getAgentStatList(String agentId, Range range) {
            return Collections.emptyList();
        }

        @Override
        public boolean agentStatExists(String agentId, Range range) {
            return false;
        }
    };
    applicationIndexDao = new ApplicationIndexDao() {

        @Override
        public List<Application> selectAllApplicationNames() {
            throw new UnsupportedOperationException();
        }

        @Override
        public List<String> selectAgentIds(String applicationName) {
            if (SERVICE_NAME.equals(applicationName)) {
                List<String> agentIds = new LinkedList<String>();
                agentIds.add("local_tomcat");
                return agentIds;
            }
            throw new IllegalArgumentException();
        }

        @Override
        public void deleteApplicationName(String applicationName) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void deleteAgentId(String applicationName, String agentId) {
            throw new UnsupportedOperationException();
        }
    };
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) ApplicationIndexDao(com.navercorp.pinpoint.web.dao.ApplicationIndexDao) Range(com.navercorp.pinpoint.web.vo.Range) List(java.util.List) LinkedList(java.util.LinkedList) BeforeClass(org.junit.BeforeClass)

Example 2 with ApplicationIndexDao

use of com.navercorp.pinpoint.web.dao.ApplicationIndexDao in project pinpoint by naver.

the class ReaderTest method beforeClass.

@BeforeClass
public static void beforeClass() {
    applicationIndexDao = new ApplicationIndexDao() {

        @Override
        public List<Application> selectAllApplicationNames() {
            List<Application> apps = new LinkedList<Application>();
            for (int i = 0; i < 7; i++) {
                apps.add(new Application(APP_NAME + i, ServiceType.STAND_ALONE));
            }
            return apps;
        }

        @Override
        public List<String> selectAgentIds(String applicationName) {
            return null;
        }

        @Override
        public void deleteApplicationName(String applicationName) {
        }

        @Override
        public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
        }

        @Override
        public void deleteAgentId(String applicationName, String agentId) {
        }
    };
    alarmService = new AlarmServiceImpl() {

        private Map<String, Rule> ruleMap;

        {
            ruleMap = new HashMap<String, Rule>();
            for (int i = 0; i <= 6; i++) {
                ruleMap.put(APP_NAME + i, new Rule(APP_NAME + i, SERVICE_TYPE, CheckerCategory.SLOW_COUNT.getName(), 76, "testGroup", false, false, ""));
            }
        }

        @Override
        public List<Rule> selectRuleByApplicationId(String applicationId) {
            List<Rule> rules = new LinkedList<Rule>();
            rules.add(ruleMap.get(applicationId));
            return rules;
        }
    };
    dataCollectorFactory = new DataCollectorFactory() {

        @Override
        public DataCollector createDataCollector(CheckerCategory checker, Application application, long timeSlotEndTime) {
            return new ResponseTimeDataCollector(DataCollectorCategory.RESPONSE_TIME, null, null, 0, 0);
        }
    };
}
Also used : ApplicationIndexDao(com.navercorp.pinpoint.web.dao.ApplicationIndexDao) HashMap(java.util.HashMap) DataCollector(com.navercorp.pinpoint.web.alarm.collector.DataCollector) ResponseTimeDataCollector(com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector) ResponseTimeDataCollector(com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector) AlarmServiceImpl(com.navercorp.pinpoint.web.service.AlarmServiceImpl) List(java.util.List) LinkedList(java.util.LinkedList) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) BeforeClass(org.junit.BeforeClass)

Example 3 with ApplicationIndexDao

use of com.navercorp.pinpoint.web.dao.ApplicationIndexDao in project pinpoint by naver.

the class GcCountCheckerTest method before.

@BeforeClass
public static void before() {
    jvmGcDao = new AgentStatDao<JvmGcBo>() {

        @Override
        public List<JvmGcBo> getAgentStatList(String agentId, Range range) {
            List<JvmGcBo> jvmGcs = new LinkedList<>();
            for (int i = 36; i > 0; i--) {
                JvmGcBo jvmGc = new JvmGcBo();
                jvmGc.setGcOldCount(i);
                jvmGcs.add(jvmGc);
            }
            return jvmGcs;
        }

        @Override
        public boolean agentStatExists(String agentId, Range range) {
            return true;
        }
    };
    cpuLoadDao = new AgentStatDao<CpuLoadBo>() {

        @Override
        public List<CpuLoadBo> getAgentStatList(String agentId, Range range) {
            return Collections.emptyList();
        }

        @Override
        public boolean agentStatExists(String agentId, Range range) {
            return false;
        }
    };
    applicationIndexDao = new ApplicationIndexDao() {

        @Override
        public List<Application> selectAllApplicationNames() {
            throw new UnsupportedOperationException();
        }

        @Override
        public List<String> selectAgentIds(String applicationName) {
            if (SERVICE_NAME.equals(applicationName)) {
                List<String> agentIds = new LinkedList<String>();
                agentIds.add("local_tomcat");
                return agentIds;
            }
            throw new IllegalArgumentException();
        }

        @Override
        public void deleteApplicationName(String applicationName) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void deleteAgentId(String applicationName, String agentId) {
            throw new UnsupportedOperationException();
        }
    };
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) ApplicationIndexDao(com.navercorp.pinpoint.web.dao.ApplicationIndexDao) Range(com.navercorp.pinpoint.web.vo.Range) List(java.util.List) LinkedList(java.util.LinkedList) BeforeClass(org.junit.BeforeClass)

Example 4 with ApplicationIndexDao

use of com.navercorp.pinpoint.web.dao.ApplicationIndexDao in project pinpoint by naver.

the class JvmCpuUsageRateCheckerTest method before.

@BeforeClass
public static void before() {
    jvmGcDao = new AgentStatDao<JvmGcBo>() {

        @Override
        public List<JvmGcBo> getAgentStatList(String agentId, Range range) {
            return Collections.emptyList();
        }

        @Override
        public boolean agentStatExists(String agentId, Range range) {
            return false;
        }
    };
    cpuLoadDao = new AgentStatDao<CpuLoadBo>() {

        public List<CpuLoadBo> getAgentStatList(String agentId, Range range) {
            List<CpuLoadBo> cpuLoads = new LinkedList<>();
            for (int i = 0; i < 36; i++) {
                CpuLoadBo cpuLoad = new CpuLoadBo();
                cpuLoad.setJvmCpuLoad(0.6);
                cpuLoads.add(cpuLoad);
            }
            return cpuLoads;
        }

        @Override
        public boolean agentStatExists(String agentId, Range range) {
            return true;
        }
    };
    applicationIndexDao = new ApplicationIndexDao() {

        @Override
        public List<Application> selectAllApplicationNames() {
            throw new UnsupportedOperationException();
        }

        @Override
        public List<String> selectAgentIds(String applicationName) {
            if (SERVICE_NAME.equals(applicationName)) {
                List<String> agentIds = new LinkedList<String>();
                agentIds.add("local_tomcat");
                return agentIds;
            }
            throw new IllegalArgumentException();
        }

        @Override
        public void deleteApplicationName(String applicationName) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void deleteAgentId(String applicationName, String agentId) {
            throw new UnsupportedOperationException();
        }
    };
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) ApplicationIndexDao(com.navercorp.pinpoint.web.dao.ApplicationIndexDao) Range(com.navercorp.pinpoint.web.vo.Range) List(java.util.List) LinkedList(java.util.LinkedList) BeforeClass(org.junit.BeforeClass)

Aggregations

ApplicationIndexDao (com.navercorp.pinpoint.web.dao.ApplicationIndexDao)4 LinkedList (java.util.LinkedList)4 List (java.util.List)4 BeforeClass (org.junit.BeforeClass)4 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)3 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)3 Range (com.navercorp.pinpoint.web.vo.Range)3 DataCollector (com.navercorp.pinpoint.web.alarm.collector.DataCollector)1 ResponseTimeDataCollector (com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector)1 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)1 AlarmServiceImpl (com.navercorp.pinpoint.web.service.AlarmServiceImpl)1 Application (com.navercorp.pinpoint.web.vo.Application)1 HashMap (java.util.HashMap)1