// Path: src/main/java/com/jfcorugedo/rserver/common/collection/CollectionUtils.java
// @SafeVarargs
// public static <T> List<T> newList(T... values) {
// 	List<T> arrayList = new ArrayList<>(values.length);
// 	for(T element : values) {
// 		arrayList.add(element);
// 	}
// 		
// 	return arrayList;
// }
// 
// Path: src/main/java/com/jfcorugedo/rserver/Application.java
// @SpringBootApplication
// @EnableMetrics
// public class Application {
// 
// 	private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
// 	
// 	public static void main(String[] args) {
//         LOGGER.info("\n****************\n* rJava Server *\n****************\n");
//         
//         SpringApplication app = new SpringApplication(Application.class);
//         app.setShowBanner(false);
//         SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
//     	
//         // Check if the selected profile has been set as argument.
//         // if not the development profile will be added
//         addDefaultProfile(app, source);
//         
//         
//         
//         app.run(args);
//     }
// 	
// 	/**
//      * Set a default profile if it has not been set
//      */
//     private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
//         if (!source.containsProperty("spring.profiles.active")) {
//             app.setAdditionalProfiles("local");
//             LOGGER.info("Staring application with profiles: local");
//         } else {
//             LOGGER.info("Staring application with profiles: {}", source.getProperty("spring.profiles.active"));
//         }
//     }
//     
//     /**
//      * This method is needed because Sonar doesn't allow public constructors in a class with only static methods,
//      * but SpringBoot needs a public constructor in this class.
//      * This method should not be invoked
//      */
//     public void avoidSonarViolation(){
//     	LOGGER.warn("This method should not be invoked");
//     }
// }


import static com.jfcorugedo.rserver.common.collection.CollectionUtils.newList;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
import org.apache.commons.math3.distribution.EnumeratedDistribution;
import org.apache.commons.math3.util.Pair;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPDouble;
import org.rosuda.REngine.REXPGenericVector;
import org.rosuda.REngine.REXPInteger;
import org.rosuda.REngine.REXPString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.jfcorugedo.rserver.Application;
package com.jfcorugedo.rserver.engine;






/**
 * In order to make these test work R_HOME environment variable must be present
 * 
 * Export an environment variable with this value:
 * 
 * R_HOME=/Library/Frameworks/R.framework/Resources
 * 
 * @author jfcorugedo
 *
 */
@Ignore("These tests require R environment installed and R_HOME variable setted")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebIntegrationTest
@ActiveProfiles(profiles={"local", "integrationtest"})
public class RServeEngineProviderServiceIT {
	
	public static final Logger LOGGER = LoggerFactory.getLogger(RServeEngineProviderServiceIT.class);
	
	public static final double[] TEST_POPULATION = new double[20];
	static{
		TEST_POPULATION[0] = 10;
		TEST_POPULATION[1] = 5;
		TEST_POPULATION[2] = 20;
		TEST_POPULATION[3] = 12;
		TEST_POPULATION[4] = 4;
		TEST_POPULATION[5] = 11;
		TEST_POPULATION[6] = 23;
		TEST_POPULATION[7] = 0;
// Path: src/main/java/com/jfcorugedo/rserver/common/collection/CollectionUtils.java
// @SafeVarargs
// public static <T> List<T> newList(T... values) {
// 	List<T> arrayList = new ArrayList<>(values.length);
// 	for(T element : values) {
// 		arrayList.add(element);
// 	}
// 		
// 	return arrayList;
// }
// 
// Path: src/main/java/com/jfcorugedo/rserver/Application.java
// @SpringBootApplication
// @EnableMetrics
// public class Application {
// 
// 	private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
// 	
// 	public static void main(String[] args) {
//         LOGGER.info("\n****************\n* rJava Server *\n****************\n");
//         
//         SpringApplication app = new SpringApplication(Application.class);
//         app.setShowBanner(false);
//         SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
//     	
//         // Check if the selected profile has been set as argument.
//         // if not the development profile will be added
//         addDefaultProfile(app, source);
//         
//         
//         
//         app.run(args);
//     }
// 	
// 	/**
//      * Set a default profile if it has not been set
//      */
//     private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
//         if (!source.containsProperty("spring.profiles.active")) {
//             app.setAdditionalProfiles("local");
//             LOGGER.info("Staring application with profiles: local");
//         } else {
//             LOGGER.info("Staring application with profiles: {}", source.getProperty("spring.profiles.active"));
//         }
//     }
//     
//     /**
//      * This method is needed because Sonar doesn't allow public constructors in a class with only static methods,
//      * but SpringBoot needs a public constructor in this class.
//      * This method should not be invoked
//      */
//     public void avoidSonarViolation(){
//     	LOGGER.warn("This method should not be invoked");
//     }
// }


// Path: src/test/java/com/jfcorugedo/rserver/engine/RServeEngineProviderServiceIT.java
import static com.jfcorugedo.rserver.common.collection.CollectionUtils.newList;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
import org.apache.commons.math3.distribution.EnumeratedDistribution;
import org.apache.commons.math3.util.Pair;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPDouble;
import org.rosuda.REngine.REXPGenericVector;
import org.rosuda.REngine.REXPInteger;
import org.rosuda.REngine.REXPString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.jfcorugedo.rserver.Application;

package com.jfcorugedo.rserver.engine;






/**
 * In order to make these test work R_HOME environment variable must be present
 * 
 * Export an environment variable with this value:
 * 
 * R_HOME=/Library/Frameworks/R.framework/Resources
 * 
 * @author jfcorugedo
 *
 */
@Ignore("These tests require R environment installed and R_HOME variable setted")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebIntegrationTest
@ActiveProfiles(profiles={"local", "integrationtest"})
public class RServeEngineProviderServiceIT {
	
	public static final Logger LOGGER = LoggerFactory.getLogger(RServeEngineProviderServiceIT.class);
	
	public static final double[] TEST_POPULATION = new double[20];
	static{
		TEST_POPULATION[0] = 10;
		TEST_POPULATION[1] = 5;
		TEST_POPULATION[2] = 20;
		TEST_POPULATION[3] = 12;
		TEST_POPULATION[4] = 4;
		TEST_POPULATION[5] = 11;
		TEST_POPULATION[6] = 23;
		TEST_POPULATION[7] = 0;
		TEST_POPULATION[8] = 12;