Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct wrapper template with test #483

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions vip-portal/src/main/resources/vm/wrapper.vm
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ JSONPARAMETERS
# Command-line execution #
##########################

TOOLNAME="$tool.getName()"
JSONFILE="${TOOLNAME}.json"

# BOSH_CVMFS_PATH is defined by GASW from the settings file
checkBosh $BOSH_CVMFS_PATH

Expand Down Expand Up @@ -204,10 +201,12 @@ TMP_FOLDER=../$TMP_FOLDER
#end
mkdir -p $TMP_FOLDER

#if($imagepath == "")
PYTHONPATH=".:$PYTHONPATH" $BOSHEXEC exec launch $JSONFILE input_param_file.json -v $PWD/../cache:$PWD/../cache -v $TMP_FOLDER:/tmp
#set($jsonFile="${tool.getName()}.json")

#if($imagepath)
PYTHONPATH=".:$PYTHONPATH" $BOSHEXEC exec launch --imagepath $imagepath $jsonFile input_param_file.json -v $PWD/../cache:$PWD/../cache -v $TMP_FOLDER:/tmp
#else
PYTHONPATH=".:$PYTHONPATH" $BOSHEXEC exec launch --imagepath $imagepath $JSONFILE input_param_file.json -v $PWD/../cache:$PWD/../cache -v $TMP_FOLDER:/tmp
PYTHONPATH=".:$PYTHONPATH" $BOSHEXEC exec launch $jsonFile input_param_file.json -v $PWD/../cache:$PWD/../cache -v $TMP_FOLDER:/tmp
#end

if [ $? != 0 ]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package fr.insalyon.creatis.applicationimporter;

import fr.insalyon.creatis.vip.application.client.ApplicationConstants;
import fr.insalyon.creatis.vip.application.client.bean.Descriptor;
import fr.insalyon.creatis.vip.application.client.bean.boutiquesTools.BoutiquesApplication;
import fr.insalyon.creatis.vip.application.client.bean.boutiquesTools.BoutiquesInput;
import fr.insalyon.creatis.vip.application.client.bean.boutiquesTools.BoutiquesNumberInput;
import fr.insalyon.creatis.vip.application.client.bean.boutiquesTools.BoutiquesStringInput;
import fr.insalyon.creatis.vip.application.client.view.boutiquesParsing.InvalidBoutiquesDescriptorException;
import fr.insalyon.creatis.vip.application.server.business.simulation.parser.GwendiaParser;
import fr.insalyon.creatis.vip.applicationimporter.server.business.VelocityUtils;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.xml.sax.SAXException;

import java.io.IOException;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;

/*
This needs te be here to use the production velocity templates
*/
public class WrapperTemplateTest {

final protected String WRAPPER_TEMPLATE = "vm/wrapper.vm";

@Test
public void testImagePathInWrapperTemplate() throws IOException, InvalidBoutiquesDescriptorException, SAXException {
BoutiquesApplication boutiquesApp = new BoutiquesApplication("testApp", "test app desc", "42.43");
VelocityUtils sut = new VelocityUtils();
// if null
String wrapperString = sut.createDocument(null, boutiquesApp, false, WRAPPER_TEMPLATE);
MatcherAssert.assertThat(wrapperString, containsString("exec launch testApp.json input_param_file.json"));
// if present
boutiquesApp.setVipContainer("testContainer");
wrapperString = sut.createDocument(null, boutiquesApp, false, WRAPPER_TEMPLATE);
MatcherAssert.assertThat(wrapperString, containsString("exec launch --imagepath testContainer testApp.json input_param_file.json"));
}

}
Loading