Search in sources :

Example 6 with AssetStatus

use of com.vmware.flowgate.common.AssetStatus in project flowgate by vmware.

the class AssetControllerTest method createAsset.

Asset createAsset() {
    Asset asset = new Asset();
    BaseDocumentUtil.generateID(asset);
    asset.setAssetName("pek-wor-server-02");
    asset.setAssetNumber(12345);
    asset.setAssetSource("5b7d208d55368540fcba1692");
    asset.setCategory(AssetCategory.Server);
    asset.setModel("Dell 750");
    asset.setManufacturer("Dell");
    asset.setSerialnumber("Serialnumber");
    asset.setRegion("Region");
    asset.setCountry("china");
    asset.setCity("beijing");
    asset.setBuilding("Raycom");
    asset.setFloor("9F");
    asset.setRoom("901");
    asset.setRow("9");
    asset.setCol("9");
    asset.setExtraLocation("");
    asset.setCabinetName("");
    List<String> pdus = new ArrayList<>();
    asset.setPdus(pdus);
    List<String> switches = new ArrayList<>();
    asset.setSwitches(switches);
    AssetStatus status = new AssetStatus();
    asset.setStatus(status);
    Map<String, String> formulas = new HashMap<String, String>();
    Map<String, Map<String, String>> pduMetricFormulas = new HashMap<String, Map<String, String>>();
    Map<String, String> MetricAndIdMap = new HashMap<String, String>();
    MetricAndIdMap.put(MetricName.SERVER_CONNECTED_PDU_CURRENT, "0001bdc8b25d4c2badfd045ab61aabfa");
    MetricAndIdMap.put(MetricName.SERVER_CONNECTED_PDU_POWER, "0001bdc8b25d4c2badfd045ab61aabfa");
    MetricAndIdMap.put(MetricName.SERVER_VOLTAGE, "0001bdc8b25d4c2badfd045ab61aabfa");
    pduMetricFormulas.put("0001bdc8b25d4c2badfd045ab61aabfa", MetricAndIdMap);
    String pduFormulaInfo = null;
    try {
        pduFormulaInfo = mapper.writeValueAsString(pduMetricFormulas);
    } catch (JsonProcessingException e) {
        TestCase.fail(e.getMessage());
    }
    formulas.put(FlowgateConstant.PDU, pduFormulaInfo);
    asset.setMetricsformulars(formulas);
    return asset;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Asset(com.vmware.flowgate.common.model.Asset) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) AssetStatus(com.vmware.flowgate.common.AssetStatus) Map(java.util.Map) HashMap(java.util.HashMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

AssetStatus (com.vmware.flowgate.common.AssetStatus)6 Asset (com.vmware.flowgate.common.model.Asset)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 HashMap (java.util.HashMap)2 Parent (com.vmware.flowgate.common.model.Parent)1 Tenant (com.vmware.flowgate.common.model.Tenant)1 EndDevice (com.vmware.flowgate.labsdb.common.EndDevice)1 CabinetU (com.vmware.flowgate.nlyteworker.model.CabinetU)1 CustomField (com.vmware.flowgate.nlyteworker.model.CustomField)1 NlyteAsset (com.vmware.flowgate.nlyteworker.model.NlyteAsset)1 UMounting (com.vmware.flowgate.nlyteworker.model.UMounting)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1