49 lines
1.4 KiB
Java
49 lines
1.4 KiB
Java
package org.gcube.data.publishing.gCatFeeder.service;
|
|
|
|
import javax.ws.rs.client.Entity;
|
|
import javax.ws.rs.client.WebTarget;
|
|
import javax.ws.rs.core.Response;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class ExecutionsTest extends BaseTest {
|
|
|
|
|
|
@Test
|
|
public void getAll() {
|
|
WebTarget target=
|
|
target(ServiceConstants.Executions.PATH);
|
|
|
|
System.out.println(target.getUri());
|
|
Response resp=target.request().get();
|
|
System.out.println(resp.getStatus() + " : "+ resp.readEntity(String.class));
|
|
if(resp.getStatus()!=200) throw new RuntimeException("GetAll error should never happen");
|
|
}
|
|
|
|
@Test
|
|
public void submitALLAndPoll() {
|
|
WebTarget target=
|
|
target(ServiceConstants.Executions.PATH);
|
|
|
|
System.out.println(target.getUri());
|
|
Response resp=target.request().post(Entity.json(""));
|
|
System.out.println(resp.getStatus() + " : "+ resp.readEntity(String.class));
|
|
// if(resp.getStatus()!=200) throw new RuntimeException("GetAll error should never happen");
|
|
|
|
|
|
|
|
}
|
|
|
|
@Test
|
|
public void wrongSubmission() {
|
|
WebTarget target=
|
|
target(ServiceConstants.Executions.PATH).
|
|
queryParam(ServiceConstants.Executions.CATALOGUE_ID_PARAMETER, TestCommon.FAKE_CATALOGUE_ID+"_NOT");
|
|
|
|
System.out.println(target.getUri());
|
|
Response resp=target.request().post(Entity.json(""));
|
|
if(resp.getStatus()!=400) throw new RuntimeException("Expected ERROR STATUS 400 BUT received "+resp.getStatus());
|
|
}
|
|
|
|
}
|