69 lines
2.2 KiB
Java
69 lines
2.2 KiB
Java
package org.gcube.application.perform.service;
|
|
|
|
import java.net.MalformedURLException;
|
|
import java.nio.file.Paths;
|
|
|
|
import javax.ws.rs.client.WebTarget;
|
|
import javax.ws.rs.core.Application;
|
|
import javax.ws.rs.core.Response;
|
|
|
|
import org.gcube.application.perform.service.engine.utils.ISUtils;
|
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
import org.glassfish.jersey.test.JerseyTest;
|
|
import org.junit.BeforeClass;
|
|
import org.junit.Test;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
public class AnagraphicTests extends JerseyTest{
|
|
|
|
private static final Logger log= LoggerFactory.getLogger(AnagraphicTests.class);
|
|
|
|
@BeforeClass
|
|
public static void init() throws MalformedURLException {
|
|
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
|
TokenSetter.set("/gcube/preprod/preVRE");
|
|
ISUtils.setFixedToken(SecurityTokenProvider.instance.get());
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
protected Application configure() {
|
|
|
|
return new PerformService();
|
|
}
|
|
|
|
|
|
@Test
|
|
public void getBatch() {
|
|
WebTarget target=
|
|
// target(ServiceConstants.SERVICE_NAME).
|
|
// path(ServiceConstants.APPLICATION_PATH).
|
|
target(ServiceConstants.Mappings.PATH).
|
|
path(ServiceConstants.Mappings.BATCHES_METHOD).
|
|
queryParam(ServiceConstants.Mappings.BATCH_NAME_PARAMETER, "gino").
|
|
queryParam(ServiceConstants.Mappings.BATCH_TYPE_PARAMETER, "pino").
|
|
queryParam(ServiceConstants.Mappings.FARM_ID_PARAMETER, 1234);
|
|
|
|
System.out.println(target.getUri());
|
|
Response resp=target.request().get();
|
|
System.out.println(resp.getStatus() + " : "+ resp.readEntity(String.class));
|
|
}
|
|
|
|
@Test
|
|
public void getFarm() {
|
|
WebTarget target=
|
|
// target(ServiceConstants.SERVICE_NAME).
|
|
// path(ServiceConstants.APPLICATION_PATH).
|
|
target(ServiceConstants.Mappings.PATH).
|
|
path(ServiceConstants.Mappings.FARM_METHOD).
|
|
queryParam(ServiceConstants.Mappings.FARM_ID_PARAMETER, 12334).
|
|
queryParam(ServiceConstants.Mappings.FARM_UUID_PARAMETER, "pino");
|
|
|
|
System.out.println(target.getUri());
|
|
Response resp=target.request().get();
|
|
System.out.println(resp.getStatus() + " : "+ resp.readEntity(String.class));
|
|
}
|
|
}
|