use of org.jenkinsci.lib.configprovider.model.Config in project nodejs-plugin by jenkinsci.
the class NodeJSBuildWrapperTest method test_creation_of_config.
@Test
public void test_creation_of_config() throws Exception {
FreeStyleProject job = j.createFreeStyleProject("free");
final Config config = createSetting("my-config-id", "email=foo@acme.com", null);
NodeJSInstallation installation = mockInstaller();
NodeJSBuildWrapper bw = mockWrapper(installation, config);
job.getBuildWrappersList().add(bw);
job.getBuildersList().add(new FileVerifier());
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
}
use of org.jenkinsci.lib.configprovider.model.Config in project nodejs-plugin by jenkinsci.
the class NodeJSBuildWrapperTest method test_inject_path_variable.
@Test
public void test_inject_path_variable() throws Exception {
FreeStyleProject job = j.createFreeStyleProject("free");
final Config config = createSetting("my-config-id", "", null);
NodeJSInstallation installation = spy(new NodeJSInstallation("test", getTestHome(), null));
doReturn(getTestExecutable()).when(installation).getExecutable(any(Launcher.class));
doReturn(installation).when(installation).forNode(any(Node.class), any(TaskListener.class));
doReturn(installation).when(installation).forEnvironment(any(EnvVars.class));
NodeJSBuildWrapper spy = mockWrapper(installation, config);
job.getBuildWrappersList().add(spy);
job.getBuildersList().add(new PathVerifier(installation));
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
}
use of org.jenkinsci.lib.configprovider.model.Config in project nodejs-plugin by jenkinsci.
the class NodeJSCommandInterpreterTest method test_creation_of_config.
@Test
public void test_creation_of_config() throws Exception {
Config config = createSetting("my-config-id", "email=foo@acme.com", null);
NodeJSInstallation installation = mockInstaller();
NodeJSCommandInterpreter builder = CIBuilderHelper.createMock("test_creation_of_config", installation, config.id, new Verifier() {
@Override
public void verify(AbstractBuild<?, ?> build, Launcher launcher, TaskListener listener) throws Exception {
EnvVars env = build.getEnvironment(listener);
String var = NodeJSConstants.NPM_USERCONFIG;
String value = env.get(var);
assertTrue("variable " + var + " not set", env.containsKey(var));
assertNotNull("empty value for environment variable " + var, value);
assertTrue("file of variable " + var + " does not exists or is not a file", new File(value).isFile());
}
});
FreeStyleProject job = j.createFreeStyleProject();
job.getBuildersList().add(builder);
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
}
use of org.jenkinsci.lib.configprovider.model.Config in project nodejs-plugin by jenkinsci.
the class NpmrcFileSupplyTest method createSetting.
private Config createSetting(String id, String content, List<NPMRegistry> registries) {
String providerId = new NPMConfigProvider().getProviderId();
Config config = new NPMConfig(id, null, null, content, providerId, registries);
GlobalConfigFiles globalConfigFiles = j.jenkins.getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
globalConfigFiles.save(config);
return config;
}
Aggregations