2016-09-14 18:09:03 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.informationsystem.resourceregistry.client.proxy;
|
|
|
|
|
2017-01-12 16:39:53 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.gcube.informationsystem.model.entity.facet.ContactFacet;
|
|
|
|
import org.gcube.informationsystem.model.entity.resource.HostingNode;
|
2017-02-23 17:08:04 +01:00
|
|
|
import org.gcube.informationsystem.model.entity.resource.Service;
|
2017-02-24 12:01:33 +01:00
|
|
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
2017-01-12 16:39:53 +01:00
|
|
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
2016-10-27 17:51:22 +02:00
|
|
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
2017-01-12 16:39:53 +01:00
|
|
|
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
2016-09-14 18:09:03 +02:00
|
|
|
import org.junit.Test;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
/**
|
2016-10-12 14:35:20 +02:00
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
2016-09-14 18:09:03 +02:00
|
|
|
*/
|
2017-01-12 16:39:53 +01:00
|
|
|
public class ResourceRegistryClientTest extends ScopedTest {
|
2016-09-14 18:09:03 +02:00
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory
|
|
|
|
.getLogger(ResourceRegistryClientTest.class);
|
|
|
|
|
2016-10-18 10:52:05 +02:00
|
|
|
protected ResourceRegistryClient resourceRegistryClient;
|
|
|
|
|
2016-11-04 16:52:41 +01:00
|
|
|
public ResourceRegistryClientTest(){
|
2016-10-18 10:52:05 +02:00
|
|
|
resourceRegistryClient = ResourceRegistryClientFactory.create();
|
|
|
|
}
|
|
|
|
|
2016-09-14 18:09:03 +02:00
|
|
|
@Test
|
|
|
|
public void testQuery() throws InvalidQueryException{
|
2016-10-18 10:52:05 +02:00
|
|
|
String res = resourceRegistryClient.query("SELECT FROM V", 0, null);
|
2016-10-31 17:05:00 +01:00
|
|
|
logger.trace(res);
|
2016-09-14 18:09:03 +02:00
|
|
|
}
|
2016-10-18 10:52:05 +02:00
|
|
|
|
2016-10-27 17:51:22 +02:00
|
|
|
@Test
|
2017-02-24 12:01:33 +01:00
|
|
|
public void testGetFacetSchema() throws SchemaNotFoundException, ResourceRegistryException {
|
2017-01-12 16:39:53 +01:00
|
|
|
List<TypeDefinition> typeDefinitions = resourceRegistryClient.getSchema(ContactFacet.class, true);
|
|
|
|
logger.trace("{}", typeDefinitions);
|
2016-10-27 17:51:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-02-24 12:01:33 +01:00
|
|
|
public void testGetResourceSchema() throws SchemaNotFoundException, ResourceRegistryException {
|
2017-01-12 16:39:53 +01:00
|
|
|
List<TypeDefinition> typeDefinitions = resourceRegistryClient.getSchema(HostingNode.class, true);
|
|
|
|
logger.trace("{}", typeDefinitions);
|
2016-10-27 17:51:22 +02:00
|
|
|
}
|
|
|
|
|
2017-02-23 17:08:04 +01:00
|
|
|
interface Aux extends Service {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-02-24 11:00:12 +01:00
|
|
|
@Test(expected=SchemaNotFoundException.class)
|
2017-02-24 12:01:33 +01:00
|
|
|
public void testException() throws SchemaNotFoundException, ResourceRegistryException {
|
2017-02-24 11:00:12 +01:00
|
|
|
resourceRegistryClient.getSchema(Aux.class, true);
|
2017-02-23 17:08:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-14 18:09:03 +02:00
|
|
|
}
|