Search in sources :

Example 1 with AssetAddress

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

the class AssetControllerTest method createAnAssetExample.

@Test
public void createAnAssetExample() throws JsonProcessingException, Exception {
    Asset asset = createAsset();
    this.mockMvc.perform(post("/v1/assets").contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsString(asset))).andExpect(status().isCreated()).andExpect(header().string("Location", notNullValue())).andDo(document("assets-create-example", requestFields(fieldWithPath("id").description("ID of the asset, created by flowgate"), fieldWithPath("assetNumber").description("A unique number that can identify an asset from third part DCIM/CMDB systems.").type(long.class), fieldWithPath("assetName").description("The name of the asset in the third part DCIM/CMDB systems. Usually it will be a unique identifier of an asset"), fieldWithPath("assetSource").description("From which third part systems does this asset comes from. It will refer to a source collection which contains all the thirdpart systems"), fieldWithPath("category").description("The category of the asset. Can only be one of :Server, PDU, Cabinet, Networks, Sensors, UPS").type(AssetCategory.class), fieldWithPath("subCategory").description("The subcategory of the asset. Only apply to some systems.").type(AssetSubCategory.class).optional(), fieldWithPath("manufacturer").description("The manufacture name"), fieldWithPath("model").description("The model of the asset"), fieldWithPath("serialnumber").description("The SN number of the asset, this number can be used to identify an asset. But only some systems have this number.").optional(), fieldWithPath("tag").description("Some system will use tag to identify an asset. It can be either an number or a string.").type(String.class).optional(), fieldWithPath("assetAddress").description("The access address of the asset").type(AssetAddress.class).optional(), fieldWithPath("region").description("The location region of the asset").optional(), fieldWithPath("country").description("The location country of the asset").optional(), fieldWithPath("city").description("The location city of the asset").optional(), fieldWithPath("building").description("The location building of the asset").optional(), fieldWithPath("floor").description("The location floor of the asset").optional(), fieldWithPath("room").description("The location room of the asset"), fieldWithPath("row").description("The location row of the asset").optional(), fieldWithPath("col").description("The location col of the asset").optional(), fieldWithPath("extraLocation").description("Extra location information. Only valid for some system.").optional(), fieldWithPath("cabinetName").description("The cabinet name where this asset is located. If the asset is cabinet then this filed is empty.").optional(), fieldWithPath("cabinetUnitPosition").description("The cabinet unit number").type(int.class).optional(), fieldWithPath("mountingSide").description("The cabinet unit number").type(MountingSide.class).optional(), fieldWithPath("cabinetAssetNumber").description("The asset number of the cabinet. Will be used to search more detail information about the cabinet.").type(long.class).optional(), fieldWithPath("assetRealtimeDataSpec").description("Only valid for sensor type of asset.").type(AssetRealtimeDataSpec.class).optional(), subsectionWithPath("justificationfields").ignored(), subsectionWithPath("metricsformulars").ignored(), fieldWithPath("lastupdate").ignored(), fieldWithPath("created").ignored(), fieldWithPath("capacity").description("The capacity of asset.").type(int.class).optional(), fieldWithPath("freeCapacity").description("The free capacity of asset.").type(int.class).optional(), subsectionWithPath("parent").description("The parent of asset,it will be null unless the asset's category is Sensors").type(Parent.class).optional(), fieldWithPath("pdus").description("Possible PDUs that this server connected with"), fieldWithPath("switches").description("Physical switchs that this host connected with"), fieldWithPath("tenant").description("Tenant information for the asset").type(Tenant.class).optional(), subsectionWithPath("status").description("This is a collection of states, including the state of the asset, " + "the state of the pdu mapping, and the state of the switch mapping.")))).andReturn().getResponse().getHeader("Location");
    assetRepository.deleteById(asset.getId());
}
Also used : AssetRealtimeDataSpec(com.vmware.flowgate.common.model.AssetRealtimeDataSpec) Tenant(com.vmware.flowgate.common.model.Tenant) Parent(com.vmware.flowgate.common.model.Parent) Asset(com.vmware.flowgate.common.model.Asset) AssetAddress(com.vmware.flowgate.common.model.AssetAddress) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) AssetSubCategory(com.vmware.flowgate.common.AssetSubCategory) MountingSide(com.vmware.flowgate.common.MountingSide) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

AssetSubCategory (com.vmware.flowgate.common.AssetSubCategory)1 MountingSide (com.vmware.flowgate.common.MountingSide)1 Asset (com.vmware.flowgate.common.model.Asset)1 AssetAddress (com.vmware.flowgate.common.model.AssetAddress)1 AssetRealtimeDataSpec (com.vmware.flowgate.common.model.AssetRealtimeDataSpec)1 Parent (com.vmware.flowgate.common.model.Parent)1 Tenant (com.vmware.flowgate.common.model.Tenant)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1