Search in sources :

Example 46 with Asset

use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.

the class SyncSensorMetaDataJobTest method createAsset1.

Asset createAsset1() {
    Asset asset = new Asset();
    asset.setAssetName("pek-wor-pdu-02");
    asset.setAssetNumber(89765);
    asset.setAssetSource("po09imkhdplbvf540fwusy67n");
    asset.setCategory(AssetCategory.PDU);
    asset.setModel("Dell 750");
    asset.setManufacturer("Dell");
    return asset;
}
Also used : Asset(com.vmware.flowgate.common.model.Asset)

Example 47 with Asset

use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.

the class SyncSensorMetaDataJobTest method createAsset.

Asset createAsset() {
    Asset asset = new Asset();
    asset.setAssetName("pek-wor-sensor-02");
    asset.setAssetNumber(12345);
    asset.setAssetSource("l9i8728d55368540fcba1692");
    asset.setCategory(AssetCategory.Sensors);
    HashMap<String, String> justificationfields = generateExtraInfo("106");
    asset.setJustificationfields(justificationfields);
    asset.setModel("Dell 750");
    asset.setManufacturer("Dell");
    return asset;
}
Also used : Asset(com.vmware.flowgate.common.model.Asset)

Example 48 with Asset

use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.

the class SyncSensorMetaDataJobTest method getAssets.

public List<Asset> getAssets(AssetCategory category) {
    List<Asset> assets = new ArrayList<Asset>();
    switch(category) {
        case Sensors:
            assets.add(createAsset());
            break;
        case PDU:
            Asset pdu = createAsset1();
            pdu.setFloor("1st");
            pdu.setRoom("SJC31");
            pdu.setBuilding("2805 Lafayette St");
            pdu.setCity("Santa Clara");
            pdu.setCountry("USA");
            pdu.setRegion("NASA");
            assets.add(pdu);
            break;
        default:
            break;
    }
    return assets;
}
Also used : ArrayList(java.util.ArrayList) Asset(com.vmware.flowgate.common.model.Asset)

Example 49 with Asset

use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.

the class SyncSensorMetaDataJobTest method testAggregatorSensorIdAndSourceForPdu3.

@Test
public void testAggregatorSensorIdAndSourceForPdu3() {
    Asset pdu = createAsset1();
    HashMap<String, String> justificationfields = new HashMap<String, String>();
    justificationfields.put(AssetSubCategory.Temperature.toString(), "509_l9i8728d55368540fcba1692");
    pdu.setJustificationfields(justificationfields);
    Sensor sensor = new Sensor();
    sensor.setId(606);
    sensor.setType(PowerIQService.HumiditySensor);
    String source = "l9i8728d55368540fcba1692";
    pdu = powerIQService.aggregatorSensorIdAndSourceForPdu(pdu, sensor, source);
    TestCase.assertEquals(sensor.getId() + FlowgateConstant.SEPARATOR + source, pdu.getJustificationfields().get(AssetSubCategory.Humidity.toString()));
}
Also used : HashMap(java.util.HashMap) Asset(com.vmware.flowgate.common.model.Asset) Sensor(com.vmware.flowgate.poweriqworker.model.Sensor) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 50 with Asset

use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.

the class SyncSensorMetaDataJobTest method testAggregatorSensorIdAndSourceForPdu2.

@Test
public void testAggregatorSensorIdAndSourceForPdu2() {
    Asset pdu = createAsset1();
    HashMap<String, String> justificationfields = new HashMap<String, String>();
    String filed = "509" + FlowgateConstant.SEPARATOR + "l9i8728d55368540fcba1692,606" + FlowgateConstant.SEPARATOR + "l9i8728d55368540fcba1692";
    justificationfields.put(AssetSubCategory.Humidity.toString(), filed);
    pdu.setJustificationfields(justificationfields);
    Sensor sensor = new Sensor();
    sensor.setId(610);
    sensor.setType(PowerIQService.HumiditySensor);
    String source = "l9i8728d55368540fcba1692";
    pdu = powerIQService.aggregatorSensorIdAndSourceForPdu(pdu, sensor, source);
    TestCase.assertEquals(filed + FlowgateConstant.SPILIT_FLAG + sensor.getId() + FlowgateConstant.SEPARATOR + source, pdu.getJustificationfields().get(AssetSubCategory.Humidity.toString()));
}
Also used : HashMap(java.util.HashMap) Asset(com.vmware.flowgate.common.model.Asset) Sensor(com.vmware.flowgate.poweriqworker.model.Sensor) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Asset (com.vmware.flowgate.common.model.Asset)173 Test (org.junit.Test)96 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)90 HashMap (java.util.HashMap)86 ArrayList (java.util.ArrayList)82 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)36 NlyteAsset (com.vmware.flowgate.nlyteworker.model.NlyteAsset)35 Map (java.util.Map)34 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)31 RealTimeData (com.vmware.flowgate.common.model.RealTimeData)23 IOException (java.io.IOException)23 ServerMapping (com.vmware.flowgate.common.model.ServerMapping)22 MetricData (com.vmware.flowgate.common.model.MetricData)16 HandleAssetUtil (com.vmware.flowgate.nlyteworker.scheduler.job.common.HandleAssetUtil)16 HashSet (java.util.HashSet)15 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)13 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)13 List (java.util.List)12 MvcResult (org.springframework.test.web.servlet.MvcResult)12 TypeReference (com.fasterxml.jackson.core.type.TypeReference)10