/**
   * Helper method to validate the asset basic and extended info
   *
   * @return
   */
  private AssetInfo validateAsset(String assetId) {
    // now, i search the service to get all its related objects
    RepositoryServiceProviderImpl provider = new RepositoryServiceProviderImpl();

    GetAssetInfoRequest request = new GetAssetInfoRequest();
    AssetKey key = new AssetKey();
    key.setAssetId(assetId);
    request.setAssetKey(key);
    request.setAssetType("Service");

    GetAssetInfoResponse assetInfoResponse = provider.getAssetInfo(request);
    assertEquals(AckValue.SUCCESS, assetInfoResponse.getAck());
    assertEquals(null, assetInfoResponse.getErrorMessage());

    return assetInfoResponse.getAssetInfo();
  }
  private UpdateAssetDependenciesResponse updateDependencies(String assetId) throws Exception {
    AssetKey key = new AssetKey();
    key.setAssetId(assetId);

    LockAssetRequest lockReq = new LockAssetRequest();
    lockReq.setAssetKey(key);

    RepositoryServiceProviderImpl provider = new RepositoryServiceProviderImpl();
    LockAssetResponse lockRes = provider.lockAsset(lockReq);
    assertEquals(AckValue.SUCCESS, lockRes.getAck());

    FlattenedRelationshipForUpdate relationship = new FlattenedRelationshipForUpdate();
    relationship.setDepth(1);
    relationship.setSourceAsset(key);
    List<RelationForUpdate> relationList = relationship.getRelatedAsset();
    relationList.add(
        new RelationForUpdate() {
          {
            this.setCurrentSourceAsset(
                RSProviderUtil.completeAssetKey(
                    new AssetKey() {
                      {
                        this.setAssetId(resources[0]);
                      }
                    },
                    null,
                    null));
            this.setCurrentTargetAsset(
                RSProviderUtil.completeAssetKey(
                    new AssetKey() {
                      {
                        this.setAssetId(dstAssets[0]);
                      }
                    },
                    null,
                    null));
            this.setNewRelation(
                new Relation() {
                  {
                    this.setSourceAsset(
                        RSProviderUtil.completeAssetKey(
                            new AssetKey() {
                              {
                                this.setAssetId(resources[0]);
                              }
                            },
                            null,
                            null));
                    this.setTargetAsset(
                        RSProviderUtil.completeAssetKey(
                            new AssetKey() {
                              {
                                this.setAssetId(dstAssets[1]);
                              }
                            },
                            null,
                            null));
                    this.setAssetRelationship("DependsOn");
                  }
                });
          }
        });

    UpdateAssetDependenciesRequest request = new UpdateAssetDependenciesRequest();
    request.setAssetKey(key);
    request.setFlattenedRelationshipForUpdate(relationship);
    request.setReplaceCurrent(true);

    return provider.updateAssetDependencies(request);
  }