Commit tests
Commit Volatile/Permanent Area storage git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@132224 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bf8d6ab53f
commit
fb47edbfeb
|
@ -15,8 +15,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||
import org.gcube.contentmanagement.blobstorage.service.IClient;
|
||||
import org.gcube.contentmanagement.blobstorage.service.operation.GetHttpUrl;
|
||||
import org.gcube.contentmanager.storageclient.model.protocol.smp.Handler;
|
||||
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
|
||||
import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
|
||||
import org.gcube.contentmanager.storageclient.wrapper.StorageClient;
|
||||
import org.gcube.datatransfer.resolver.MultiReadHttpServletRequest;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -93,12 +95,21 @@ public class StorageIDResolver extends HttpServlet {
|
|||
//we should not unescape the filename with spaces
|
||||
|
||||
logger.info(SMP_ID+" = "+ smpID);
|
||||
MemoryType memory=null;
|
||||
if(smpID.endsWith(GetHttpUrl.VOLATILE_URL_IDENTIFICATOR)){
|
||||
memory=MemoryType.VOLATILE;
|
||||
smpID=smpID.replace(GetHttpUrl.VOLATILE_URL_IDENTIFICATOR, "");
|
||||
}
|
||||
InputStream in = null;
|
||||
String toSEID = null;
|
||||
|
||||
try {
|
||||
OutputStream out = response.getOutputStream();
|
||||
StorageClient client = new StorageClient(StorageIDResolver.class.getName(), StorageIDResolver.class.getSimpleName(), "storageid-resolver", AccessType.PUBLIC);
|
||||
StorageClient client = null;
|
||||
if(memory==null)
|
||||
client=new StorageClient(StorageIDResolver.class.getName(), StorageIDResolver.class.getSimpleName(), "storageid-resolver", AccessType.PUBLIC);
|
||||
else
|
||||
client=new StorageClient(StorageIDResolver.class.getName(), StorageIDResolver.class.getSimpleName(), "storageid-resolver", AccessType.PUBLIC, memory);
|
||||
|
||||
try{
|
||||
IClient icClient = client.getClient();
|
||||
|
|
|
@ -22,9 +22,9 @@ public class GeonetworkQueryTest {
|
|||
|
||||
private String[] scopes = {"/gcube/devsec"};
|
||||
|
||||
private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps"};
|
||||
private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab", "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab"};
|
||||
|
||||
private LoginLevel loginLevel = LoginLevel.CKAN;
|
||||
private LoginLevel loginLevel = LoginLevel.SCOPE;
|
||||
|
||||
private Type accountType = Type.CKAN;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class GeonetworkQueryTest {
|
|||
for(String scope:scopes){
|
||||
ScopeProvider.instance.set(scope);
|
||||
GeoNetworkPublisher reader=GeoNetwork.get();
|
||||
reader.login(loginLevel);
|
||||
|
||||
|
||||
Configuration config = reader.getConfiguration();
|
||||
Account account=config.getScopeConfiguration().getAccounts().get(accountType);
|
||||
|
@ -44,17 +44,23 @@ public class GeonetworkQueryTest {
|
|||
|
||||
// req.addParam("keyword", "Thredds");
|
||||
final GNSearchRequest req=new GNSearchRequest();
|
||||
// req.addParam(GNSearchRequest.Param.any,"");
|
||||
req.addParam(GNSearchRequest.Param.any,"Thredds");
|
||||
GNSearchResponse resp = reader.query(req);
|
||||
int publicCount= resp.getCount();
|
||||
int totalCount=resp.getCount();
|
||||
int publicCount=resp.getCount();
|
||||
reader.login(loginLevel);
|
||||
int totalCount=reader.query(req).getCount();
|
||||
System.out.println("SCOPE "+scope+" found "+totalCount+" (public : "+publicCount+", private :"+(totalCount-publicCount)+")");
|
||||
if(totalCount==0)
|
||||
return;
|
||||
for(int i=0; i<MAX; i++){
|
||||
String xml = reader.getByIdAsRawString(resp.getMetadata(i).getUUID());
|
||||
System.out.println(i+") is Thredds? "+containsString(xml, "Thredds"));
|
||||
}
|
||||
/*try{
|
||||
int last = totalCount>MAX?totalCount:MAX;
|
||||
for(int i=0; i<last; i++){
|
||||
String xml = reader.getByIdAsRawString(resp.getMetadata(i).getUUID());
|
||||
System.out.println(i+") is Thredds? "+containsString(xml, "Thredds"));
|
||||
}
|
||||
}catch(Exception e ){
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
@ -76,7 +82,7 @@ public class GeonetworkQueryTest {
|
|||
GeoNetworkReader reader=GeoNetwork.get();
|
||||
final GNSearchRequest req=new GNSearchRequest();
|
||||
// req.addParam("keyword", "Thredds");
|
||||
req.addParam(GNSearchRequest.Param.any,"Oscar");
|
||||
// req.addParam(GNSearchRequest.Param.any,"Oscar");
|
||||
int publicCount=reader.query(req).getCount();
|
||||
reader.login(loginLevel);
|
||||
int totalCount=reader.query(req).getCount();
|
||||
|
|
|
@ -34,7 +34,7 @@ public class GeonetworkRequestDecoderTest {
|
|||
|
||||
@Test
|
||||
public void test3() throws ServletException{
|
||||
String request = "/geonetwork/gcube|devsec#filterpublicids";
|
||||
String request = "/geonetwork/gcube#filterpublicids";
|
||||
System.out.println("Testing request: "+request);
|
||||
GeonetworkRequestDecoder gd = new GeonetworkRequestDecoder(request,"");
|
||||
System.out.println(gd);
|
||||
|
|
Loading…
Reference in New Issue