Skip to content
Snippets Groups Projects
Commit 9fba9f86 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-3081 : V3 DSS API - searchFiles should return SearchResult - return...

SSDM-3081 : V3 DSS API - searchFiles should return SearchResult - return SearchResult, add DataSetFileFetchOptions and enable V3 DSS tests (they were not run at Hudson)

SVN: 35612
parent 4e3b30cb
No related branches found
No related tags found
No related merge requests found
Showing
with 112 additions and 6 deletions
...@@ -44,6 +44,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetSearchCrit ...@@ -44,6 +44,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetSearchCrit
import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi; import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.DataSetFilePermId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.DataSetFilePermId;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria;
...@@ -128,7 +129,7 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp ...@@ -128,7 +129,7 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp
@Transactional(readOnly = true) @Transactional(readOnly = true)
@RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Override @Override
public List<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria) public SearchResult<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria, DataSetFileFetchOptions fetchOptions)
{ {
getOpenBISService().checkSession(sessionToken); getOpenBISService().checkSession(sessionToken);
...@@ -187,7 +188,7 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp ...@@ -187,7 +188,7 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp
} }
} }
return result; return new SearchResult<DataSetFile>(result, result.size());
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
......
...@@ -3,9 +3,11 @@ package ch.ethz.sis.openbis.generic.server.dssapi.v3; ...@@ -3,9 +3,11 @@ package ch.ethz.sis.openbis.generic.server.dssapi.v3;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult;
import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi; import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria;
import ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerContext; import ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerContext;
...@@ -32,7 +34,7 @@ public class DataStoreServerApiLogger extends AbstractServerLogger implements ...@@ -32,7 +34,7 @@ public class DataStoreServerApiLogger extends AbstractServerLogger implements
} }
@Override @Override
public List<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria) public SearchResult<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria, DataSetFileFetchOptions fetchOptions)
{ {
logAccess(sessionToken, "search-files", "SEARCH_CRITERION:\n%s\n", searchCriteria); logAccess(sessionToken, "search-files", "SEARCH_CRITERION:\n%s\n", searchCriteria);
return null; return null;
......
...@@ -7,7 +7,9 @@ import java.util.List; ...@@ -7,7 +7,9 @@ import java.util.List;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria;
public class SearchFileTest extends AbstractFileTest public class SearchFileTest extends AbstractFileTest
...@@ -19,7 +21,8 @@ public class SearchFileTest extends AbstractFileTest ...@@ -19,7 +21,8 @@ public class SearchFileTest extends AbstractFileTest
DataSetFileSearchCriteria sc = new DataSetFileSearchCriteria(); DataSetFileSearchCriteria sc = new DataSetFileSearchCriteria();
sc.withDataSet().withPermId().thatEquals(dataSetCode); sc.withDataSet().withPermId().thatEquals(dataSetCode);
List<DataSetFile> searchFiles = dss.searchFiles(sessionToken, sc); SearchResult<DataSetFile> searchResult = dss.searchFiles(sessionToken, sc, new DataSetFileFetchOptions());
List<DataSetFile> searchFiles = searchResult.getObjects();
assertThat(searchFiles, containsAll(filesAndDirectories)); assertThat(searchFiles, containsAll(filesAndDirectories));
/* directory structure [dataset id]/original/[root folder] */ /* directory structure [dataset id]/original/[root folder] */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<package name="ch.systemsx.cisd.etlserver.*" /> <package name="ch.systemsx.cisd.etlserver.*" />
<package name="ch.systemsx.cisd.openbis.dss.*" /> <package name="ch.systemsx.cisd.openbis.dss.*" />
<package name="ch.systemsx.cisd.openbis.datastoreserver.*" /> <package name="ch.systemsx.cisd.openbis.datastoreserver.*" />
<package name="ch.ethz.sis.openbis.generic.dss.*" />
</packages> </packages>
</test> </test>
</suite> </suite>
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="V3" verbose="1">
<test name="V3">
<groups>
<run>
<exclude name="broken" />
</run>
</groups>
<packages>
<package name="ch.ethz.sis.openbis.generic.dss.systemtest.api.v3.*" />
</packages>
</test>
</suite>
...@@ -19,8 +19,10 @@ package ch.ethz.sis.openbis.generic.dssapi.v3; ...@@ -19,8 +19,10 @@ package ch.ethz.sis.openbis.generic.dssapi.v3;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.search.SearchResult;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.download.DataSetFileDownloadOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions.DataSetFileFetchOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.id.IDataSetFileId;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search.DataSetFileSearchCriteria;
import ch.systemsx.cisd.common.api.IRpcService; import ch.systemsx.cisd.common.api.IRpcService;
...@@ -42,7 +44,7 @@ public interface IDataStoreServerApi extends IRpcService ...@@ -42,7 +44,7 @@ public interface IDataStoreServerApi extends IRpcService
public static final String JSON_SERVICE_URL = SERVICE_URL + ".json"; public static final String JSON_SERVICE_URL = SERVICE_URL + ".json";
public List<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria); public SearchResult<DataSetFile> searchFiles(String sessionToken, DataSetFileSearchCriteria searchCriteria, DataSetFileFetchOptions fetchOptions);
public InputStream downloadFiles(String sessionToken, List<? extends IDataSetFileId> fileIds, public InputStream downloadFiles(String sessionToken, List<? extends IDataSetFileId> fileIds,
DataSetFileDownloadOptions downloadOptions); DataSetFileDownloadOptions downloadOptions);
......
/*
* Copyright 2014 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonProperty;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.systemsx.cisd.base.annotation.JsonObject;
/**
* @author pkupczyk
*/
@JsonObject("dss.dto.datasetfile.fetchoptions.DataSetFileFetchOptions")
public class DataSetFileFetchOptions extends FetchOptions<DataSetFile> implements Serializable
{
private static final long serialVersionUID = 1L;
@JsonProperty
private DataSetFileSortOptions sort;
@Override
public DataSetFileSortOptions sortBy()
{
if (sort == null)
{
sort = new DataSetFileSortOptions();
}
return sort;
}
@Override
public DataSetFileSortOptions getSortBy()
{
return sort;
}
}
/*
* Copyright 2015 ETH Zuerich, SIS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.fetchoptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.SortOptions;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.systemsx.cisd.base.annotation.JsonObject;
/**
* @author pkupczyk
*/
@JsonObject("dss.dto.datasetfile.fetchoptions.DataSetFileSortOptions")
public class DataSetFileSortOptions extends SortOptions<DataSetFile>
{
private static final long serialVersionUID = 1L;
}
...@@ -996,7 +996,6 @@ getDataProducer ...@@ -996,7 +996,6 @@ getDataProducer
getDataProductionDate getDataProductionDate
setDataProducer setDataProducer
setDataProductionDate setDataProductionDate
Custom AS Service Custom AS Service
Custom AS Service Code Custom AS Service Code
Custom AS Service Context Custom AS Service Context
...@@ -1008,3 +1007,5 @@ execute Custom AS Service ...@@ -1008,3 +1007,5 @@ execute Custom AS Service
I Custom AS Service Executor I Custom AS Service Executor
I Custom AS Service Id I Custom AS Service Id
search Custom AS Services search Custom AS Services
DataSetFileFetchOptions
DataSetFileSortOptions
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment