/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.pwr.nlprestservice;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import pl.edu.pwr.nlptools.NLPToolException;
import pl.edu.pwr.nlptools.test.Test;

/**
 * REST Web Service
 *
 * @author www_zsk
 */
@Path("test")
public class TestResource {

    @Context
    private UriInfo context;

    /**
     * Creates a new instance of TestResource
     */
    public TestResource() {
    }

    
    @GET
    @Path("{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public String performance(@PathParam("id") int id )throws NLPToolException {
        Test t=new Test();
        String res=t.test(id).toString();
       return res;
    }
    
    @GET
    @Path("{id}/{count}")
    @Produces(MediaType.APPLICATION_JSON)
    public String performancep(@PathParam("id") int id,@PathParam("count") int count )throws NLPToolException {
        Test t=new Test();
        String res=t.paralleltest(id,count).toString();
       return res;
    }
    
    
    /**
     * Retrieves representation of an instance of pl.edu.pwr.nlprestservice.TestResource
     * @return an instance of java.lang.String
     */
    @GET
    @Produces(MediaType.TEXT_HTML)
    public String performance() throws NLPToolException {
        Test t=new Test();
        String res=t.testall();
       return res;
    }

    /**
     * PUT method for updating or creating an instance of TestResource
     * @param content representation for the resource
     * @return an HTTP response with content of the updated or created resource.
     */
    @PUT
    @Consumes("application/xml")
    public void putXml(String content) {
    }
}
