Skip to content

Commit

Permalink
#24738 feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrizzio-dotCMS committed Jun 28, 2023
1 parent b3df45b commit ee84636
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.dotmarketing.exception.DotSecurityException;
import com.dotmarketing.portlets.contentlet.model.Contentlet;
import com.dotmarketing.portlets.fileassets.business.FileAsset;
import com.dotmarketing.portlets.fileassets.business.FileAssetAPI;
import com.dotmarketing.portlets.folders.model.Folder;
import com.dotmarketing.portlets.languagesmanager.model.Language;
import com.dotmarketing.util.FileUtil;
Expand Down Expand Up @@ -458,13 +459,16 @@ public void Test_Retrieve_All_Versions()
Assert.assertTrue(singleVersionedAsset.live());
Assert.assertTrue(singleVersionedAsset.working());

//Now we create a new version
//Now we create a new version with a brand-new file different from the previous one
final File testFile3 = FileUtil.createTemporaryFile("new-lol", ".txt", RandomStringUtils.random(1000));
final Contentlet checkout = ContentletDataGen.checkout(contentlet);
checkout.getMap().put(Contentlet.TITTLE_KEY, "new title");
checkout.getMap().put(FileAssetAPI.BINARY_FIELD,testFile3);

final String newInode = UUIDGenerator.generateUuid();
checkout.setInode(newInode);
ContentletDataGen.checkin(checkout);
final Contentlet checkin = ContentletDataGen.checkin(checkout);
System.out.println(checkin);

final AssetVersionsView withMultipleVersions = (AssetVersionsView) webAssetHelper.getAssetInfo(path, APILocator.systemUser());
Assert.assertEquals(2, withMultipleVersions.versions().size());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dotcms.rest.api.v1.asset;

import com.dotcms.rest.InitDataObject;
import com.dotcms.rest.ResponseEntityBooleanView;
import com.dotcms.rest.WebResource;
import com.dotcms.rest.annotation.NoCache;
import com.dotcms.rest.api.v1.asset.view.WebAssetEntityView;
Expand Down Expand Up @@ -172,7 +173,7 @@ public Response deleteAsset(
helper.deleteAsset(form.assetPath(), user);
Logger.info(this,
String.format("User [%s] deleted asset for path [%s] ", user.getUserId(), form.assetPath()));
return Response.ok().build();
return Response.ok(new ResponseEntityBooleanView(true)).build();
}


Expand Down Expand Up @@ -207,7 +208,7 @@ public Response archiveAsset(
helper.archiveAsset(form.assetPath(), user);
Logger.info(this,
String.format("User [%s] deleted asset for path [%s] ", user.getUserId(), form.assetPath()));
return Response.ok().build();
return Response.ok(new ResponseEntityBooleanView(true)).build();
}


Expand Down Expand Up @@ -244,7 +245,7 @@ public Response deleteFolder(
String.format("User [%s] deleted foldr for path [%s]. ",
user.getUserId(), form.assetPath()
));
return Response.ok().build();
return Response.ok(new ResponseEntityBooleanView(true)).build();
}


Expand Down

0 comments on commit ee84636

Please sign in to comment.