[
https://issues.apache.org/jira/browse/USERGRID-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Russo updated USERGRID-1293:
------------------------------------
Affects Version/s: 2.1.1
> Asset files do not appear to be deleted
> ---------------------------------------
>
> Key: USERGRID-1293
> URL: https://issues.apache.org/jira/browse/USERGRID-1293
> Project: Usergrid
> Issue Type: Story
> Affects Versions: 2.1.1, 2.1.0
> Reporter: Michael Russo
> Priority: Minor
> Fix For: 2.2.0
>
>
> Need to add a test case to services layer to prove that the asset binary
> files get deleted when an entity is deleted and fix if proven. Per request
> from mailing list, appears there is a bug around this as
> ServiceResults.Type.COLLECTION is almost always used. There does not appear
> to be a services layer test cases for assets, only REST layer tests which
> test creation. Any deletion test in REST would only verify that an entity
> got deleted, but could not check specifically if the asset binary file is
> gone, hence the need for services layer test.
> I think Usergrid is an amazing project, and I use it as my application's
> backbone. But I always cannot delete binary files, and here is my question
> about deleting asset binary files through rest API.
> `stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java`
> has this code snippet:
> {code}
> ServiceResults sr = executeServiceRequest( ui, response,
> ServiceAction.DELETE, null );
> // if we deleted an entity (and not a connection or collection) then
> // we may need to clean up binary asset data associated with that entity
> if ( !sr.getResultsType().equals( ServiceResults.Type.CONNECTION )
> && !sr.getResultsType().equals( ServiceResults.Type.COLLECTION )) {
> // Execute binaryStore.delete()
> {code}
> So I learn Usergrid has a way to delete binary files. Here comes my question.
> The if-else statement does not allow a ServiceResult whose ResultType equals
> COLLECTION. But take a look
> `stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java`
> (I remember almost services extend this class):
> {code}
> @Override
> public ServiceResults deleteItemById( ServiceContext context, UUID id )
> throws Exception {
> checkPermissionsForEntity( context, id );
>
> // skip some contents ...
> return new ServiceResults( this, context, Type.COLLECTION,
> Results.fromEntity( item ), null, null );
> }
> {code}
> Above method always returns a ServiceResults whose ResultType equals
> Type.COLLECTION. So it always cannot access the code snippet inside of the
> if-else statement. Is that a bug? Or it's my misunderstanding ? I look
> forward your help and hope you can explain a little bit more if I'm
> understanding. Thank you so much.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)