use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.
the class SycnRealTimeDataJobTest method testGenerateRealTimeData.
@Test
public void testGenerateRealTimeData() {
Asset asset = createAsset();
asset.setId("5x4ff46982db22e1b040e0f2");
HashMap<AdvanceSettingType, String> advanceSettingMap = new HashMap<AdvanceSettingType, String>();
advanceSettingMap.put(AdvanceSettingType.DateFormat, NlyteDataService.DateFormat);
advanceSettingMap.put(AdvanceSettingType.TimeZone, "GMT");
RealTimeData data = nlyteDataService.generateRealTimeData(asset, nlyteAPIClient, advanceSettingMap);
TestCase.assertEquals("5x4ff46982db22e1b040e0f2", data.getAssetID());
}
use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.
the class SycnRealTimeDataJobTest method testSupplementChassisInfo1.
@Test
public void testSupplementChassisInfo1() {
Asset asset = createAsset();
HashMap<String, String> justficationMap = new HashMap<String, String>();
Map<String, String> chassisInfoMap = new HashMap<String, String>();
ObjectMapper mapper = new ObjectMapper();
try {
chassisInfoMap.put(FlowgateConstant.CHASSIS_AIR_FLOW_TYPE, "frontToBack");
String chassisInfo = mapper.writeValueAsString(chassisInfoMap);
justficationMap.put(FlowgateConstant.CHASSIS, chassisInfo);
asset.setJustificationfields(justficationMap);
HandleAssetUtil util = new HandleAssetUtil();
util.supplementChassisInfo(asset, FlowgateConstant.CHASSIS_AIR_FLOW_TYPE, "backToFront");
justficationMap = asset.getJustificationfields();
chassisInfo = justficationMap.get(FlowgateConstant.CHASSIS);
chassisInfoMap = mapper.readValue(chassisInfo, new TypeReference<Map<String, String>>() {
});
TestCase.assertEquals("backToFront", chassisInfoMap.get(FlowgateConstant.CHASSIS_AIR_FLOW_TYPE));
} catch (Exception e) {
TestCase.fail(e.getMessage());
}
}
use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.
the class SycnRealTimeDataJobTest method testGetAssetsFromNlytePdu.
@Test
public void testGetAssetsFromNlytePdu() {
String nlyteSource = "3cf0f5daff8e448da449ac88d5aa9428";
List<NlyteAsset> nlyteAssets = getNlyteAsset();
HashMap<Integer, LocationGroup> locationMap = getLocationMap();
HashMap<Integer, Material> materialMap = getMaterialMap();
Material material = new Material();
material.setMaterialID(6251);
material.setManufacturerID(14);
material.setMaterialName("Cisco 1721 Modular Access Router");
material.setMaterialType(AssetCategory.Server);
materialMap.put(6251, material);
HashMap<Integer, Manufacturer> manufacturerMap = getManufacturerMap();
Manufacturer manufacturer = new Manufacturer();
manufacturer.setManufacturerID(14);
manufacturer.setDetail("Cisco");
manufacturerMap.put(14, manufacturer);
HashMap<Long, String> chassisMountedAssetNumberAndChassisIdMap = null;
HandleAssetUtil util = new HandleAssetUtil();
List<Asset> assets = util.getAssetsFromNlyte(nlyteSource, nlyteAssets, locationMap, materialMap, manufacturerMap, chassisMountedAssetNumberAndChassisIdMap);
}
use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.
the class SycnRealTimeDataJobTest method testGenerateNewAsset.
@Test
public void testGenerateNewAsset() {
List<NlyteAsset> nlyteAssets = getNlyteAsset();
HashMap<Integer, LocationGroup> locationMap = getLocationMap();
HashMap<Integer, Material> materialMap = new HashMap<Integer, Material>();
Material material = new Material();
material.setMaterialID(6251);
material.setManufacturerID(14);
material.setMaterialName("Cisco 1721 Modular Access Router");
material.setMaterialType(AssetCategory.Server);
material.setMaterialSubtype(AssetSubCategory.Blade);
materialMap.put(6251, material);
HashMap<Integer, Manufacturer> manufacturerMap = new HashMap<Integer, Manufacturer>();
Manufacturer manufacturer = new Manufacturer();
manufacturer.setManufacturerID(14);
manufacturer.setDetail("Cisco");
manufacturerMap.put(14, manufacturer);
Mockito.when(this.wormholeAPIClient.getAllAssetsBySourceAndType("l9i8728d55368540fcba1692", AssetCategory.Server)).thenReturn(new ArrayList<Asset>());
HashMap<Long, String> chassisMountedAssetNumberAndChassisIDMap = new HashMap<Long, String>();
chassisMountedAssetNumberAndChassisIDMap.put(197L, "asdqe945kjsdf09uw45ms");
List<Asset> assets = nlyteDataService.generateAssets("l9i8728d55368540fcba1692", nlyteAssets, locationMap, manufacturerMap, materialMap, AssetCategory.Server, chassisMountedAssetNumberAndChassisIDMap);
for (Asset asset : assets) {
if ("sin2-blrqeops-esxstress024".equals(asset.getAssetName())) {
TestCase.assertEquals(197, asset.getAssetNumber());
TestCase.assertEquals("SG-07-04", asset.getRoom());
TestCase.assertEquals("Cisco 1721 Modular Access Router", asset.getModel());
TestCase.assertEquals("Cisco", asset.getManufacturer());
TestCase.assertEquals("asdqe945kjsdf09uw45ms", asset.getParent().getParentId());
}
}
}
use of com.vmware.flowgate.common.model.Asset in project flowgate by vmware.
the class SycnRealTimeDataJobTest method testHandleChassisSolts.
@Test
public void testHandleChassisSolts() {
Asset asset = createAsset();
List<ChassisSlot> chassisSolts = new ArrayList<ChassisSlot>();
NlyteAsset nlyteAsset = getNlyteAsset().get(0);
HandleAssetUtil util = new HandleAssetUtil();
util.handleChassisSolts(asset, nlyteAsset);
TestCase.assertEquals(true, asset.getJustificationfields().isEmpty());
}
Aggregations