@BeforeClass public static void oneTimeSetUp() { assetKey = CommonUtil.createCompleteServiceAsset(); serviceAssetInfo = CommonUtil.getAssetInfo(assetKey); fdAssetInfo = CommonUtil.createBasicAsset("Functional Domain", "Functional Domain Template"); }
public static String testUpdateAssetAttributes_invalidAsset() { UpdateAssetAttributesConsumer updateAssetAttributesConsumer = new UpdateAssetAttributesConsumer(); int updatedAttributesCount = 3; Properties props = CommonUtil.loadPropertyFile("properties/common.properties"); Library library = new Library(); String libraryId = props.getProperty("libraryId"); String libraryName = props.getProperty("libraryName", "GovernedAssets"); library.setLibraryId(libraryId); library.setLibraryName(libraryName); AssetKey assetKey = new AssetKey(); assetKey.setAssetId(RepositoryServiceClientConstants.INVALID_ASSET_ID); assetKey.setAssetName(RepositoryServiceClientConstants.INVALID_ASSET_NAME); assetKey.setLibrary(library); List<AttributeNameValue> attributeNameValues = new ArrayList<AttributeNameValue>(); AttributeNameValue attributeNameValue = new AttributeNameValue(); attributeNameValue.setAttributeName(RepositoryServiceClientConstants.ATTRIBUTE1_NAME); attributeNameValue.setAttributeValueString(RepositoryServiceClientConstants.ATTRIBUTE1_VALUE); attributeNameValues.add(attributeNameValue); ExtendedAssetInfo extendedAssetInfo = new ExtendedAssetInfo(); extendedAssetInfo.getAttribute().addAll(attributeNameValues); UpdateAssetAttributesRequest updateAssetAttributesRequest = new UpdateAssetAttributesRequest(); updateAssetAttributesRequest.setAssetKey(assetKey); updateAssetAttributesRequest.setExtendedAssetInfo(extendedAssetInfo); updateAssetAttributesRequest.setPartialUpdate(true); updateAssetAttributesRequest.setReplaceCurrent(true); try { UpdateAssetAttributesResponse updateAssetAttributesResponse = updateAssetAttributesConsumer .getProxy() .updateAssetAttributes(updateAssetAttributesRequest); if (updateAssetAttributesResponse == null) { throw new ServiceException(null, "Response object can not be null", null); } if (validateUpdateAssetAttributesResponse(updateAssetAttributesResponse, "negativeCase", 0) .equalsIgnoreCase("success")) { List<CommonErrorData> errorDatas = updateAssetAttributesResponse.getErrorMessage().getError(); System.out.println("The following list of errors occured"); for (CommonErrorData errorData : errorDatas) { System.out.println( "Error id: " + errorData.getErrorId() + " Error message: " + errorData.getMessage()); } return "PASSED"; } else { return "FAILED"; } } catch (ServiceException se) { se.getMessage(); se.printStackTrace(); return "FAILED"; } catch (Exception e) { e.printStackTrace(); return "FAILED"; } }