Remove unused test.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@160672 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Manuele Simi 2017-12-19 03:57:44 +00:00
parent 76183b49f2
commit 5ad360fbb2
1 changed files with 0 additions and 103 deletions

View File

@ -1,103 +0,0 @@
package org.gcube.resourcemanagement.manager.webapp.context;
import static org.junit.Assert.*;
import java.io.IOException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.gcube.informationsystem.impl.entity.ContextImpl;
import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.resourcemanagement.manager.webapp.rs.RMContext;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.MethodSorters;
import com.fasterxml.jackson.core.JsonProcessingException;
/**
* Test cases for the Context methods.
*
* @author Manuele Simi (ISTI-CNR)
*/
@RunWith(BlockJUnit4ClassRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class RMContextTest extends JerseyTest {
private final static String contextName = "firstContext";
@Override
protected Application configure() {
return new ResourceConfig(RMContext.class);
}
/**
* Test method for marshal/unmarshal contexts.
*/
@Test
public void step0_Context() {
Context newContext = new ContextImpl(contextName);
//newContext.setParent(new ContextImpl("parent"));
try {
ISMapper.unmarshal(Context.class, ISMapper.marshal(newContext));
} catch (IOException e) {
e.printStackTrace();
assertFalse("Failed to unmarshal the context.", false);
}
}
/**
* Test method for
* {@link org.gcube.resourcemanagement.manager.webapp.rs.RMContext#create(java.lang.String)}.
*/
@Test
public void step1_Create() {
Context newContext = new ContextImpl(contextName);
try {
System.out.print(ISMapper.marshal(newContext));
Response create = target("context").request()
.post(Entity.entity(ISMapper.marshal(newContext), MediaType.APPLICATION_JSON + ";charset=UTF-8"));
assertNotNull(create);
//TODO: to restore an expected success when create is fully functional
//assertEquals("Unexpected returned code. Reason: " + create.getStatusInfo().getReasonPhrase(),
// Status.CREATED.getStatusCode(), create.getStatus());
//assertEquals("All good", (String) create.readEntity(String.class));
assertEquals("Unexpected returned code. Reason: " + create.getStatusInfo().getReasonPhrase(),
Status.BAD_REQUEST.getStatusCode(), create.getStatus());
} catch (JsonProcessingException e) {
assertFalse("Failed to marshal the context.", false);
}
}
/**
* Test method for
* {@link org.gcube.resourcemanagement.manager.webapp.rs.RMContext#create(java.lang.String)} when the parent does not exist.
*/
@Test
public void step1_CreateWithInvalidParent() {
Context newContext = new ContextImpl(contextName);
newContext.setParent(new ContextImpl("DoNotExist"));
try {
Response create = target("context").request()
.post(Entity.entity(ISMapper.marshal(newContext), MediaType.APPLICATION_JSON + ";charset=UTF-8"));
assertEquals("Unexpected returned code. Reason: " + create.getStatusInfo().getReasonPhrase(),
Status.BAD_REQUEST.getStatusCode(), create.getStatus());
} catch (JsonProcessingException e) {
assertFalse("Failed to marshal the context.", false);
}
}
}