Skip to content

Commit

Permalink
fix bug to display set-up menu on jenkins management page
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowalczyk committed Feb 10, 2016
1 parent 871fb69 commit c0eaf53
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</pluginRepository>
</pluginRepositories>
<build>
<finalName>jenkins-asqatasun-runner-plugin-${version}</finalName>
<finalName>jenkins-asqatasun-runner-plugin-${project.version}</finalName>
</build>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class AsqatasunInstallation {

public static final AsqatasunInstallation get() {
return Jenkins.getInstance().getDescriptorByType(Asqatasun.DescriptorImpl.class).getInstallation();
return Jenkins.getInstance().getDescriptorByType(AsqatasunRunnerBuilder.DescriptorImpl.class).getInstallation();
}

private final String webappUrl;
Expand All @@ -44,7 +44,7 @@ public static final AsqatasunInstallation get() {
private final String databaseLogin;
private String databasePassword;

private final String login;
private final String asqatasunLogin;

@DataBoundConstructor
public AsqatasunInstallation(
Expand All @@ -54,14 +54,14 @@ public AsqatasunInstallation(
String databaseName,
String databaseLogin,
String databasePassword,
String login) {
String asqatasunLogin) {
this.webappUrl = webappUrl;
this.databaseHost = databaseHost;
this.databasePort = databasePort;
this.databaseName = databaseName;
this.databaseLogin = databaseLogin;
setDatabasePassword(databasePassword);
this.login = login;
this.asqatasunLogin = asqatasunLogin;
}

public String getWebappUrl() {
Expand All @@ -84,8 +84,8 @@ public String getDatabaseLogin() {
return databaseLogin;
}

public String getLogin() {
return login;
public String getAsqatasunLogin() {
return asqatasunLogin;
}

public String getDatabasePassword() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/jenkins/plugins/asqatasun/AsqatasunRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public AsqatasunRunner(

public void callService() throws IOException, InterruptedException {
File logFile =
Asqatasun.createTempFile(
AsqatasunRunnerBuilder.createTempFile(
contextDir,
"log-" + new Random().nextInt()+".log",
"");
File scenarioFile =
Asqatasun.createTempFile(
AsqatasunRunnerBuilder.createTempFile(
contextDir,
scenarioName+"_#"+buildNumber,
Asqatasun.forceVersion1ToScenario(scenario));
AsqatasunRunnerBuilder.forceVersion1ToScenario(scenario));

ProcessBuilder pb = new ProcessBuilder(
tgScriptName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
* <p>
* When the user configures the project and enables this builder,
* {@link DescriptorImpl#newInstance(StaplerRequest)} is invoked and a new
* {@link Asqatasun} is created. The created instance is persisted
* {@link AsqatasunRunnerBuilder} is created. The created instance is persisted
* to the project configuration XML by using XStream, so this allows you to use
* instance fields (like {@link #scenarioName}) to remember the configuration.
*
Expand All @@ -64,7 +64,7 @@
*
* @author Jérôme Kowalczyk
*/
public class Asqatasun extends Builder {
public class AsqatasunRunnerBuilder extends Builder {

private static final String PLOT_PLUGIN_YVALUE = "YVALUE=";
private static final String TG_SCRIPT_NAME = "bin/asqatasun.sh";
Expand All @@ -86,7 +86,7 @@ public class Asqatasun extends Builder {

// Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
@DataBoundConstructor
public Asqatasun(
public AsqatasunRunnerBuilder(
String scenarioName,
String scenario,
String refAndLevel,
Expand Down Expand Up @@ -161,7 +161,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
// This is where you 'build' the project.
File contextDir = new File(getDescriptor().getAsqatasunRunnerPath());
if (!contextDir.exists()) {
listener.getLogger().println("Le chemin vers le contexte d'exécution est incorrect");
listener.getLogger().println("Le chemin vers le contexte d'exécution est incorrect " + getDescriptor().getAsqatasunRunnerPath());
return false;
}
File scriptFile = new File(getDescriptor().getAsqatasunRunnerPath()+ "/" + TG_SCRIPT_NAME);
Expand Down Expand Up @@ -225,7 +225,7 @@ private void linkToWebapp(
String projectName) throws IOException, InterruptedException {

File insertProcedureFile =
Asqatasun.createTempFile(
AsqatasunRunnerBuilder.createTempFile(
contextDir,
SQL_PROCEDURE_SCRIPT_NAME,
IOUtils.toString(getClass().getResourceAsStream(SQL_PROCEDURE_NAME)));
Expand All @@ -242,17 +242,17 @@ private void linkToWebapp(
.replace("$procedureFileName", TMP_FOLDER_NAME+SQL_PROCEDURE_SCRIPT_NAME);

File insertActFile =
Asqatasun.createTempFile(
AsqatasunRunnerBuilder.createTempFile(
contextDir,
INSERT_ACT_SCRIPT_NAME,
script);

ProcessBuilder pb = new ProcessBuilder(
TMP_FOLDER_NAME+INSERT_ACT_SCRIPT_NAME,
AsqatasunInstallation.get().getLogin(),
AsqatasunInstallation.get().getAsqatasunLogin(),
projectName.replaceAll("'", "'\"'\"'"),
scenarioName.replaceAll("'", "'\"'\"'"),
Asqatasun.forceVersion1ToScenario(scenario.replaceAll("'", "'\"'\"'")),
AsqatasunRunnerBuilder.forceVersion1ToScenario(scenario.replaceAll("'", "'\"'\"'")),
asqatasunRunner.auditId);

pb.directory(contextDir);
Expand Down Expand Up @@ -369,7 +369,7 @@ public Action getProjectAction(AbstractProject<?, ?> project) {
}

/**
* Descriptor for {@link Asqatasun}. Used as a singleton. The
* Descriptor for {@link AsqatasunRunnerBuilder}. Used as a singleton. The
* class is marked as public so that it can be accessed from views.
*/
@Extension // This indicates to Jenkins that this is an implementation of an extension point.
Expand Down Expand Up @@ -409,7 +409,7 @@ public FormValidation doCheckScenario(@QueryParameter String value)
}

try {
IO.read(Asqatasun.forceVersion1ToScenario(value));
IO.read(AsqatasunRunnerBuilder.forceVersion1ToScenario(value));
} catch (IOException ex) {
return FormValidation.error("Please fill-in a valid scenario");
} catch (ScriptFactory.SuiteException ex) {
Expand Down Expand Up @@ -576,7 +576,7 @@ public String getDisplayName() {
@Override
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {

pathToRunner = formData.getString("asqatasunCliPath");
pathToRunner = formData.getString("asqatasunRunnerPath");
displayPort = formData.getString("displayPort");
firefoxPath = formData.getString("firefoxPath");
asqatasunInstallation =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public String getDisplayName() {

@Override
public String getUrlName() {
String webappUrl = Jenkins.getInstance().getDescriptorByType(Asqatasun.DescriptorImpl.class).getInstallation().getWebappUrl();
String webappUrl = Jenkins.getInstance().getDescriptorByType(AsqatasunRunnerBuilder.DescriptorImpl.class).getInstallation().getWebappUrl();
if (project.getLastBuild() != null) {
try {
for (Object obj : FileUtils.readLines(project.getLastBuild().getLogFile())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<f:entry title="${%mandatoryFields}">
</f:entry>
<j:set var="installation" value="${descriptor.installation}"/>
<f:entry title="${%AsqatasunRunnerPath}" description="${%AsqatasunRunnerPathDescr}" field="AsqatasunRunnerPath">
<f:entry title="${%asqatasunRunnerPath}" description="${%asqatasunRunnerPathDescr}" field="asqatasunRunnerPath">
<f:textbox />
</f:entry>
<f:entry title="${%displayPort}" description="${%displayPortDescr}" field="displayPort">
Expand All @@ -47,8 +47,8 @@
<f:entry title="${%databasePassword}" field="databasePassword">
<f:password value="${installation.databasePassword}" />
</f:entry>
<f:entry title="${%login}" description="${%loginDescr}" field="login">
<f:textbox value="${installation.login}" />
<f:entry title="${%asqatasunLogin}" description="${%asqatasunLoginDescr}" field="asqatasunLogin">
<f:textbox value="${installation.asqatasunLogin}" />
</f:entry>
<f:entry title="${%isDebug}" description="${%isDebugDescr}" field="isDebug">
<f:checkbox/>
Expand Down

0 comments on commit c0eaf53

Please sign in to comment.