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

Miscellaneous minor fixes and improvements #91

Merged
merged 4 commits into from
Nov 5, 2015
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ THE SOFTWARE.
<f:entry title="${%Projects to build}" field="projects">
<f:textbox />
</f:entry>
<!-- TODO: replace with <f:optionalProperty> -->
<f:optionalBlock field="block" title="${%Block until the triggered projects finish their builds}" checked="${instance.block!=null}">
<j:set var="descriptor" value="${app.getDescriptorOrDie(descriptor.getPropertyType(field).clazz)}" />
<j:set var="instance" value="${instance[field]}"/>
<st:include from="${descriptor}" page="${descriptor.configPage}" />
</f:optionalBlock>

<f:optionalProperty field="block" title="${%Block until the triggered projects finish their builds}" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you manually test it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it works according to my test.

<f:block>
<f:hetero-list name="configs" hasHeader="true"
descriptors="${descriptor.getBuilderConfigDescriptors()}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.jvnet.hudson.test.TestBuilder;
import org.junit.Test;

import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -96,7 +97,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
}
});

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.SKIP));

projectA.scheduleBuild2(0).get();
Expand Down Expand Up @@ -135,7 +136,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
return true;
}
});
// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.SKIP));

projectA.scheduleBuild2(0).get();
Expand Down Expand Up @@ -166,7 +167,7 @@ public void testNoFilesSkip() throws Exception {
//create triggering build
FreeStyleProject projectA = createFreeStyleProject();

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.SKIP));

projectA.scheduleBuild2(0).get();
Expand All @@ -188,7 +189,7 @@ public void testNoFilesNoParms() throws Exception {
//create triggering build
FreeStyleProject projectA = createFreeStyleProject();

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.NOPARMS));

projectA.scheduleBuild2(0).get();
Expand All @@ -210,7 +211,7 @@ public void testNoFilesFail() throws Exception {
//create triggering build
FreeStyleProject projectA = createFreeStyleProject();

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.FAIL));

projectA.scheduleBuild2(0).get();
Expand Down Expand Up @@ -242,7 +243,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
}
});

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.SKIP, "UTF-8"));

projectA.scheduleBuild2(0).get();
Expand Down Expand Up @@ -285,7 +286,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
}
});

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.SKIP, "Shift_JIS"));

projectA.scheduleBuild2(0).get();
Expand Down Expand Up @@ -323,7 +324,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
}
});

// add Trigger builder, with file paramter factory
// add Trigger builder, with file parameter factory
projectA.getBuildersList().add(createTriggerBuilder(projectB, NoFilesFoundEnum.SKIP, ""));

projectA.scheduleBuild2(0).get();
Expand All @@ -333,11 +334,15 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
List<FreeStyleBuild> builds = projectB.getBuilds();
assertEquals(1, builds.size());

for (FreeStyleBuild build : builds) {
EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
assertEquals("hello_abc", buildEnvVar.get("TEST"));
// This test explicitly uses the platform's default encoding, which e.g. on Windows is likely to be windows-1250
// or windows-1252. With these single-byte encodings we cannot expect multi-byte strings to be encoded correctly.
final boolean isMultiByteDefaultCharset = Charset.defaultCharset().newEncoder().maxBytesPerChar() > 1.0f;
if (isMultiByteDefaultCharset) {
for (FreeStyleBuild build : builds) {
EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
assertEquals("hello_abc", buildEnvVar.get("TEST"));
}
}

}

public void testDoCheckEncoding() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,14 @@ public void testPlatformDefaultEncodedFile() throws Exception {
hudson.getQueue().getItem(projectB).getFuture().get();

assertNotNull("builder should record environment", builder.getEnvVars());
assertEquals("こんにちは", builder.getEnvVars().get("KEY"));
assertEquals("value", builder.getEnvVars().get("KEY"));

// This test explicitly uses the platform's default encoding, which e.g. on Windows is likely to be windows-1250
// or windows-1252. With these single-byte encodings we cannot expect multi-byte strings to be encoded correctly.
final boolean isMultiByteDefaultCharset = Charset.defaultCharset().newEncoder().maxBytesPerChar() > 1.0f;
if (isMultiByteDefaultCharset) {
assertEquals("こんにちは", builder.getEnvVars().get("KEY"));
assertEquals("value", builder.getEnvVars().get("KEY"));
}
}

public void testDoCheckEncoding() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void testTriggerByAbortedBuild() throws Exception {
assertEquals(2, projectB.getLastBuild().getNumber());
}

public void testTriggerByAbortedByInturrupted() throws Exception {
public void testTriggerByAbortedByInterrupted() throws Exception {
FreeStyleProject projectA = createFreeStyleProject("projectA");
projectA.getBuildersList().add(new SleepBuilder(10000));
FreeStyleProject projectB = createFreeStyleProject("projectB");
Expand Down