Search in sources :

Example 1 with TFDataSourceList

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList in project pinpoint by naver.

the class TFDataSourceListBoMapperTest method mapTest.

@Test
public void mapTest() {
    DataSourceListBo dataSourceListBo = new DataSourceListBo();
    dataSourceListBo.setAgentId("test_agent1");
    dataSourceListBo.setStartTimestamp(startTimestamp);
    dataSourceListBo.setTimestamp(collectTime1st);
    DataSourceBo dataSourceBo1 = new DataSourceBo();
    dataSourceBo1.setAgentId("test_agent1");
    dataSourceBo1.setTimestamp(collectTime1st);
    dataSourceBo1.setServiceTypeCode((short) 1000);
    dataSourceBo1.setJdbcUrl("jdbc:mysql");
    dataSourceBo1.setActiveConnectionSize(15);
    dataSourceBo1.setMaxConnectionSize(30);
    dataSourceBo1.setId(1);
    dataSourceBo1.setDatabaseName("pinpoint1");
    DataSourceBo dataSourceBo2 = new DataSourceBo();
    dataSourceBo2.setAgentId("test_agent1");
    dataSourceBo2.setTimestamp(collectTime1st);
    dataSourceBo2.setServiceTypeCode((short) 2000);
    dataSourceBo2.setJdbcUrl("jdbc:mssql");
    dataSourceBo2.setActiveConnectionSize(25);
    dataSourceBo2.setMaxConnectionSize(40);
    dataSourceBo2.setId(2);
    dataSourceBo2.setDatabaseName("pinpoint2");
    dataSourceListBo.add(dataSourceBo1);
    dataSourceListBo.add(dataSourceBo2);
    TFDataSourceListBoMapper tFDataSourceListBoMapper = new TFDataSourceListBoMapper();
    TFDataSourceList tfDataSourceList = tFDataSourceListBoMapper.map(dataSourceListBo);
    List<TFDataSource> dataSourceList = tfDataSourceList.getDataSourceList();
    assertEquals(dataSourceList.size(), 2);
    TFDataSource tfDataSource1 = dataSourceList.get(0);
    assertEquals(tfDataSource1.getId(), 1);
    assertEquals(tfDataSource1.getUrl(), "jdbc:mysql");
    assertEquals(tfDataSource1.getDatabaseName(), "pinpoint1");
    assertEquals(tfDataSource1.getActiveConnectionSize(), 15);
    assertEquals(tfDataSource1.getMaxConnectionSize(), 30);
    assertEquals(tfDataSource1.getServiceTypeCode(), 1000);
    TFDataSource tfDataSource2 = dataSourceList.get(1);
    assertEquals(tfDataSource2.getId(), 2);
    assertEquals(tfDataSource2.getUrl(), "jdbc:mssql");
    assertEquals(tfDataSource2.getDatabaseName(), "pinpoint2");
    assertEquals(tfDataSource2.getActiveConnectionSize(), 25);
    assertEquals(tfDataSource2.getMaxConnectionSize(), 40);
    assertEquals(tfDataSource2.getServiceTypeCode(), 2000);
}
Also used : TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) DataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) Test(org.junit.Test)

Example 2 with TFDataSourceList

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList in project pinpoint by naver.

the class JoinDataSourceListBoMapper method map.

@Override
public JoinDataSourceListBo map(TFAgentStat tFAgentStat) {
    if (!tFAgentStat.isSetDataSourceList()) {
        return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO;
    }
    TFDataSourceList dataSourceList = tFAgentStat.getDataSourceList();
    if (!dataSourceList.isSetDataSourceList()) {
        return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO;
    }
    List<TFDataSource> tFDataSourceList = dataSourceList.getDataSourceList();
    if (tFDataSourceList.isEmpty()) {
        return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO;
    }
    final String agentId = tFAgentStat.getAgentId();
    JoinDataSourceListBo joinDataSourceListBo = new JoinDataSourceListBo();
    joinDataSourceListBo.setId(agentId);
    joinDataSourceListBo.setTimestamp(tFAgentStat.getTimestamp());
    List<JoinDataSourceBo> joinDataSourceBoList = new ArrayList<>();
    for (TFDataSource tFDataSource : tFDataSourceList) {
        JoinDataSourceBo joinDataSourceBo = new JoinDataSourceBo();
        joinDataSourceBo.setServiceTypeCode(tFDataSource.getServiceTypeCode());
        joinDataSourceBo.setUrl(tFDataSource.getUrl());
        final int activeConnectionSize = tFDataSource.getActiveConnectionSize();
        joinDataSourceBo.setActiveConnectionSizeJoinValue(new JoinIntFieldBo(activeConnectionSize, activeConnectionSize, agentId, activeConnectionSize, agentId));
        joinDataSourceBoList.add(joinDataSourceBo);
    }
    joinDataSourceListBo.setJoinDataSourceBoList(joinDataSourceBoList);
    return joinDataSourceListBo;
}
Also used : JoinDataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) ArrayList(java.util.ArrayList) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)

Example 3 with TFDataSourceList

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList in project pinpoint by naver.

the class JoinDataSourceListBoMapperTest method mapTest.

@Test
public void mapTest() {
    JoinDataSourceListBoMapper mapper = new JoinDataSourceListBoMapper();
    TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    TFDataSourceList tFDataSourceList = new TFDataSourceList();
    List<TFDataSource> dataSourceList = new ArrayList<>();
    TFDataSource tFDataSource1 = new TFDataSource();
    tFDataSource1.setUrl("jdbc:mysql");
    tFDataSource1.setMaxConnectionSize(30);
    tFDataSource1.setActiveConnectionSize(13);
    tFDataSource1.setDatabaseName("pinpoint");
    tFDataSource1.setServiceTypeCode((short) 1000);
    TFDataSource tFDataSource2 = new TFDataSource();
    tFDataSource2.setUrl("jdbc:mssql");
    tFDataSource2.setMaxConnectionSize(31);
    tFDataSource2.setActiveConnectionSize(23);
    tFDataSource2.setDatabaseName("pinpoint");
    tFDataSource2.setServiceTypeCode((short) 2000);
    dataSourceList.add(tFDataSource1);
    dataSourceList.add(tFDataSource2);
    tFDataSourceList.setDataSourceList(dataSourceList);
    tFAgentStat.setDataSourceList(tFDataSourceList);
    JoinDataSourceListBo joinDataSourceListBo = mapper.map(tFAgentStat);
    assertEquals(joinDataSourceListBo.getId(), "testAgent");
    assertEquals(joinDataSourceListBo.getTimestamp(), 1491274138454L);
    assertEquals(joinDataSourceListBo.getJoinDataSourceBoList().size(), 2);
    List<JoinDataSourceBo> joinDataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList();
    JoinDataSourceBo joinDataSourceBo1 = joinDataSourceBoList.get(0);
    assertEquals(joinDataSourceBo1.getServiceTypeCode(), 1000);
    assertEquals(joinDataSourceBo1.getUrl(), "jdbc:mysql");
    assertEquals(joinDataSourceBo1.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(13, 13, "testAgent", 13, "testAgent"));
    JoinDataSourceBo joinDataSourceBo2 = joinDataSourceBoList.get(1);
    assertEquals(joinDataSourceBo2.getServiceTypeCode(), 2000);
    assertEquals(joinDataSourceBo2.getUrl(), "jdbc:mssql");
    assertEquals(joinDataSourceBo2.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(23, 23, "testAgent", 23, "testAgent"));
}
Also used : JoinDataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo) Test(org.junit.Test)

Example 4 with TFDataSourceList

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList in project pinpoint by naver.

the class TFDataSourceListBoMapper method map.

public TFDataSourceList map(DataSourceListBo dataSourceListBo) {
    List<DataSourceBo> dataSourceBoList = dataSourceListBo.getList();
    List<TFDataSource> dataSourceList = new ArrayList<>(dataSourceBoList.size());
    for (DataSourceBo dataSourceBo : dataSourceBoList) {
        dataSourceList.add(tFDataSourceBoMapper.map(dataSourceBo));
    }
    TFDataSourceList tFDataSourceList = new TFDataSourceList();
    tFDataSourceList.setDataSourceList(dataSourceList);
    return tFDataSourceList;
}
Also used : TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) ArrayList(java.util.ArrayList) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)

Example 5 with TFDataSourceList

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList in project pinpoint by naver.

the class JoinDataSourceListBoMapperTest method map2Test.

@Test
public void map2Test() {
    JoinDataSourceListBoMapper mapper = new JoinDataSourceListBoMapper();
    TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    JoinDataSourceListBo joinDataSourceListBo = mapper.map(tFAgentStat);
    assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO);
    TFDataSourceList tFDataSourceList = new TFDataSourceList();
    tFAgentStat.setDataSourceList(tFDataSourceList);
    joinDataSourceListBo = mapper.map(tFAgentStat);
    assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO);
    List<TFDataSource> dataSourceList = new ArrayList<>();
    tFDataSourceList.setDataSourceList(dataSourceList);
    joinDataSourceListBo = mapper.map(tFAgentStat);
    assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO);
}
Also used : TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo) Test(org.junit.Test)

Aggregations

TFDataSource (com.navercorp.pinpoint.thrift.dto.flink.TFDataSource)5 TFDataSourceList (com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList)5 ArrayList (java.util.ArrayList)4 JoinDataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)3 Test (org.junit.Test)3 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)2 JoinDataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo)2 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)2 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)2 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)1