Initial import.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/whn-manager@86890 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Roberto Cirillo 2013-12-12 15:59:25 +00:00
parent 03b08b3376
commit 2934458cb8
25 changed files with 705 additions and 0 deletions

10
.classpath Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Whn-Manager</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8

View File

@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,5 @@
#Tue Mar 12 12:32:51 CET 2013
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

1
distro/INSTALL Normal file
View File

@ -0,0 +1 @@
Used as service in the gCube Framework

6
distro/LICENSE Normal file
View File

@ -0,0 +1,6 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

2
distro/MAINTAINERS Normal file
View File

@ -0,0 +1,2 @@
Roberto Cirillo (roberto.cirillo@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".

45
distro/README Normal file
View File

@ -0,0 +1,45 @@
The gCube System - tabular data service
------------------------------------------------------------
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2),
D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2),
and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Roberto Cirillo (roberto.cirillo@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
Version and Release Date
------------------------
v. 1.0.0
* First release
Description
-----------
Download information
--------------------
Documentation
-------------
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

6
distro/changelog.xml Normal file
View File

@ -0,0 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.vremanagement.whnmanager.1-0-0" date="2013-12-12">
<Change>first release</Change>
</Changeset>
</ReleaseNotes>

37
distro/descriptor.xml Normal file
View File

@ -0,0 +1,37 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.war</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

29
distro/profile.xml Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>VREManagement</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Description>${description}</Description>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Type>library</Type>
<Files>
<File>${build.finalName}.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

0
distro/svnpath.txt Normal file
View File

94
pom.xml Normal file
View File

@ -0,0 +1,94 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.resourcemanagement</groupId>
<artifactId>whn-manager</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-smartgears-bom</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.7</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>1.1.9.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.gcube.resourcemanagement</groupId>
<artifactId>whnmanager-api</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-jaxws-calls</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- <packagingExcludes>WEB-INF/lib/jaxws-rt-2.1.7.jar,WEB-INF/lib/jaxws-api-2.1.jar,WEB-INF/lib/jaxb-impl-2.1.11.jar,WEB-INF/lib/jaxb-api-2.1.jar</packagingExcludes> -->
<warName>whn-manager</warName>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,125 @@
package org.gcube.vremanagement.whnmanager.jaxws.ws;
import java.util.Arrays;
import java.util.Iterator;
import javax.jws.WebService;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.smartgears.context.container.ContainerContext;
import org.gcube.smartgears.handlers.container.lifecycle.ProfilePublisher;
import org.gcube.vremanagement.whnmanager.utils.ValidationUtils;
import org.gcube.common.resources.gcore.HostingNode;
import org.gcube.common.resources.gcore.ScopeGroup;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.resourcemanagement.whnmanager.api.exception.GCUBEUnrecoverableException;
import org.gcube.resourcemanagement.whnmanager.api.WhnManager;
import org.gcube.resourcemanagement.whnmanager.api.types.AddScopeInputParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@WebService(portName = "WhnManagerIOPort",
serviceName = WhnManager.SERVICE_NAME,
targetNamespace = WhnManager.TNS,
endpointInterface = "org.gcube.resourcemanagement.whnmanager.api.WhnManager" )
//@Singleton
public class WhnManagerImpl implements WhnManager{
private static Logger logger=LoggerFactory.getLogger(WhnManagerImpl.class);
/**
* Add a scope to the ghn profile and publish it on IS
*/
@Override
public boolean addScope(AddScopeInputParams params) throws GCUBEUnrecoverableException {
logger.trace("WHNManager: addScope method invokation");
String scope=params.getScope();
ValidationUtils.valid("scope", scope);
ApplicationContext context = ContextProvider.get();
if(context!=null){
HostingNode ghn=context.container().profile(HostingNode.class);
if(new ScopeBean(scope).is(Type.VRE)){
logger.debug("addScope operation on VRE scope. Check if present VO scope");
scope=new ScopeBean(scope).enclosingScope().toString();
logger.debug("VO scope: "+scope);
}
if(!ValidationUtils.isPresent(ghn, scope)){
ValidationUtils.addEnclosingScopesOnResource(ghn, scope);
logger.debug("addScope method: add scope "+scope+" to resource with id: "+ghn.id());
ghn.scopes().asCollection().add(scope);
ScopeGroup<String> scopes=ghn.scopes();
logger.debug(" resource will be published in scopes: ");
for(Iterator it=scopes.iterator(); it.hasNext();){
String scopeFound=(String)it.next();
logger.debug(" - "+scopeFound);
}
ContainerContext container=context.container();
ProfilePublisher publisher= new ProfilePublisher(container);
publisher.update();
}else{
logger.warn("the scope "+scope+" is already present on ghn profile with id: "+ ghn.id());
}
}else{
logger.warn("addScope method: context is null");
}
return true;
}
/**
* Remove a scope from ghn profile and publish the new profile on IS
*/
@Override
public boolean removeScope(String scope) throws GCUBEUnrecoverableException {
logger.trace("WHN-Manager: removeScope method invokation");
ValidationUtils.valid("scope", scope);
if(new ScopeBean(scope).is(Type.VRE)){
logger.debug("this is a VRE scope. The request will be ignored ");
return true;
}
ApplicationContext context = ContextProvider.get();
if(context!=null){
HostingNode ghn=context.container().profile(HostingNode.class);
if(ValidationUtils.isPresent(ghn, scope)){
logger.debug("removeScope method: remove scope "+scope+" to resource with id: "+ghn.id());
ContainerContext container=context.container();
ProfilePublisher publisher= new ProfilePublisher(container);
publisher.removeFrom(Arrays.asList(scope));
}else{
logger.warn("scope is not present in the resource");
}
}else{
logger.warn("addScope method: context is null");
}
return true;
}
// @Override
// public boolean addRIToScope(ScopeRIParams params) throws GCUBEUnrecoverableException{
// logger.debug("addRIToScope dummy method: Adding scope " + params.getScope() + " to RI <" + params.getClazz() +","+ params.getName() +">");
//
// return true;
// }
//
// @Override
// public boolean activateRI(RIData ri) throws GCUBEUnrecoverableException{
// logger.debug("dummy activereRI method with param "+ri);
// return true;
// }
//
//
// @Override
// public boolean deactivateRI(RIData ri) throws GCUBEUnrecoverableException{
// logger.debug("dummy deactivateRI method with param "+ri);
// return true;
// }
//
// @Override
// public boolean removeRIFromScope(ScopeRIParams params) throws GCUBEUnrecoverableException{
// logger.debug("dummy removeRIFromScope method with param "+params);
// return true;
// }
}

View File

@ -0,0 +1,139 @@
package org.gcube.vremanagement.whnmanager.utils;
import java.util.Iterator;
import org.gcube.common.resources.gcore.Resource;
import org.gcube.common.resources.gcore.ResourceMediator;
import org.gcube.common.resources.gcore.ScopeGroup;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ValidationUtils {
private static final Logger log = LoggerFactory.getLogger(ValidationUtils.class);
public static void valid(String name, Object object){
if (object==null)
throw new IllegalArgumentException(name+" is null");
}
public static < R extends Resource > boolean isPresent(R resource, String currentScope){
ScopeGroup<String> scopes=resource.scopes();
boolean founded= false;
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
String scope=it.next();
if(scope.equals(currentScope))
founded=true;
}
if(founded)
return true;
return false;
}
public static < R extends Resource > boolean isNotPresent(R resource, String currentScope){
ScopeGroup<String> scopes=resource.scopes();
boolean found= false;
for(Iterator<String> it=scopes.iterator(); it.hasNext();){
String scope=it.next();
if(scope.equals(currentScope))
found=true;
}
if(!found)
return true;
return false;
}
/**
* If scope is a VRE scope and the VO and INFRA scopes are not present in the resource, this method add these scopes to the resource
* @param resource the resource
* @param scope a scope
*/
public static <T extends Resource> void addEnclosingScopesOnResource(T resource, String scope){
log.trace("add enclosed scopes of "+scope+" to the resource with id: "+resource.id());
if(new ScopeBean(scope).is(Type.VRE)){
String voScope=new ScopeBean(scope).enclosingScope().toString();
String infraScope=new ScopeBean(voScope).enclosingScope().toString();
// The scope collection is a set, I can add scope without checking
log.debug("adding "+voScope+" to the resource "+resource.id());
ResourceMediator.setScope(resource, voScope);
log.debug("adding "+infraScope+" to the resource "+resource.id());
ResourceMediator.setScope(resource, infraScope);
}else if(new ScopeBean(scope).is(Type.VO)){
String infraScope=new ScopeBean(scope).enclosingScope().toString();
log.debug("adding "+infraScope+" to the resource "+resource.id());
// The scope collection is a set, I can add scope without checking
ResourceMediator.setScope(resource, infraScope);
}
}
public static <T extends Resource> boolean isTheLastScopeOnResource(T resource, String scope){
if(resource.scopes().size() == 0)
return true;
if(new ScopeBean(scope).is(Type.VRE)){
if(anotherBrotherVREOrVOOnResource(resource, scope)){
return false;
}else return true;
}else if(new ScopeBean(scope).is(Type.VO)){
if(anotherSonVREOnResource(resource, scope)){
throw new IllegalArgumentException("the resource "+resource.id()+" have another scope defined in the same VO. The VO is "+scope);
}else return true;
}else{ // is a INFRA scope
if(anotherInfraScopeOnResource(resource, scope)){
throw new IllegalArgumentException("the resource "+resource.id()+" have another scope defined in the same INFRA. The INFRA is "+scope);
}else return true;
}
}
public static <T extends Resource> boolean anotherBrotherVREOrVOOnResource(T resource, String scope){
if(!new ScopeBean(scope).is(Type.VRE))
throw new IllegalArgumentException("anotherBrotherVREOrVOOnResource method: the input scope must be a VRE scope");
String enclosedScope=new ScopeBean(scope).enclosingScope().toString();
for(String s : resource.scopes()){
if(isChildScope(enclosedScope, s)) return true;
}
return false;
}
public static <T extends Resource> boolean anotherSonVREOnResource(T resource, String scope){
if(!new ScopeBean(scope).is(Type.VO))
throw new IllegalArgumentException("anotherSonVREOnResource method: the input scope must be a VO scope");
for(String s : resource.scopes()){
if(isChildScope(scope, s)) return true;
}
return false;
}
public static boolean isChildScope(String fatherScope, String sonScope) {
ScopeBean currentEnclosedScope=new ScopeBean(sonScope).enclosingScope();
if((currentEnclosedScope != null) && (currentEnclosedScope.toString().equals(fatherScope))){
log.debug("check scope"+fatherScope+": found another son VRE scope "+sonScope);
return true;
}else return false;
}
public static <T extends Resource> boolean anotherInfraScopeOnResource(T resource, String scope){
if(!new ScopeBean(scope).is(Type.INFRASTRUCTURE))
throw new IllegalArgumentException("anotherInfraScopeOnResource method: the input scope must be a INFRASTRUCTURE scope");
String infraScopeFound=null;
for(String s : resource.scopes()){
while(new ScopeBean(s).enclosingScope() != null){
s=new ScopeBean(s).enclosingScope().toString();
}
infraScopeFound=s;
if(infraScopeFound.equals(scope)){
log.debug("check scope"+scope+": found another scope on infra "+s);
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,6 @@
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<!-- change here if you want name of unit different -->
<persistence-unit name="tabulardata" transaction-type="RESOURCE_LOCAL">
<!-- change here if your class/Entity package different -->
<class>org.gcube.data.analysis.tabulardata.metadata.StoredTable</class>
<properties>
<!-- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /> -->
<!-- <property name="javax.persistence.jdbc.url" value="jdbc:h2:d://learn_eclipselink" /> -->
<!-- change here if your jdbc driver different -->
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:" />
<property name="javax.persistence.jdbc.user" value="sa" />
<property name="javax.persistence.jdbc.password" value="" />
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
</properties>
</persistence-unit>
</persistence>

View File

@ -0,0 +1,8 @@
<application mode='online'>
<name>WhnManager</name>
<group>VREManagement</group>
<version>1.0.0-SNAPSHOT</version>
<description>Web Hosting Node Service</description>
<local-persistence location='target' />
</application>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<endpoints
xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0">
<endpoint
name="whnmanager"
implementation="org.gcube.vremanagement.whnmanager.jaxws.ws.WhnManagerImpl"
url-pattern="/gcube/vremanagement/ws/whnmanager"/>
</endpoints>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<!-- <listener> -->
<!-- <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class> -->
<!-- </listener> -->
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<!--
<listener>
<listener-class>org.gcube.data.analysis.tabulardata.context.MyContext</listener-class>
</listener>
<listener>
<listener-class>org.gcube.common.ghn.service.ApplicationListener</listener-class>
</listener>
-->
<servlet>
<servlet-name>whnmanager</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>whnmanager</servlet-name>
<url-pattern>/gcube/vremanagement/ws/whnmanager</url-pattern>
</servlet-mapping>
<!--
<filter>
<filter-name>scopeFilter</filter-name>
<filter-class>org.gcube.data.analysis.tabulardata.context.MySoapFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>scopeFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>-->
</web-app>

View File

@ -0,0 +1,50 @@
package org.gcube.vremanagement.whnmanager.client.test;
import static org.junit.Assert.*;
import java.net.URL;
import javax.xml.namespace.QName;
import org.gcube.common.calls.jaxws.GcubeService;
import org.gcube.common.scope.api.ScopeProvider;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.MalformedURLException;
import javax.xml.ws.Service;
import org.gcube.resourcemanagement.whnmanager.api.WhnManager;
import org.gcube.resourcemanagement.whnmanager.api.types.AddScopeInputParams;
public class WhnManagerTest {
private Logger logger = LoggerFactory.getLogger(WhnManagerTest.class);
private final static String address="http://localhost:8080/whn-manager/gcube/vremanagement/ws/whnmanager";
private URL url;
private WhnManager whn;
@Before
public void setup() throws MalformedURLException{
ScopeProvider.instance.set("/gcube/devsec");
url = new URL(address);
QName qname = new QName(WhnManager.TNS, WhnManager.SERVICE_NAME);
GcubeService<WhnManager> serviceManager = GcubeService.service().withName(qname).andInterface(WhnManager.class);
whn=org.gcube.common.calls.jaxws.StubFactory.stubFor(serviceManager).at(address);
}
// @Test
public void addScopeTest() throws Exception{
AddScopeInputParams params = new AddScopeInputParams("/gcube/devsec", "");
assertTrue(whn.addScope(params));
}
// @Test
public void removeScopeTest() throws Exception{
assertTrue(whn.removeScope("/gcube/devsec"));
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
</beans>

Binary file not shown.

View File

@ -0,0 +1,9 @@
log4j.rootCategory = WARN,ROOT
log4j.appender.ROOT=org.apache.log4j.ConsoleAppender
log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
log4j.appender.ROOT.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c{2} [%t,%M:%L] %m%n
log4j.category.org.gcube = TRACE,ROOT
log4j.additivity.org.gcube=false