@Before public void setUp() throws Exception { Mockito.when(mockHostConfigurationAccess.getConfiguration(Mockito.anyString())) .thenReturn(hostConfiguration); buildInfo.setBaseDirectory(buildInfo.getCurrentBuildEnv().getBaseDirectory()); buildInfo.setEnvVars(buildInfo.getCurrentBuildEnv().getEnvVars()); buildInfo.setBuildTime(buildInfo.getCurrentBuildEnv().getBuildTime()); }
@Test public void testDoNotCreateNodeName() throws Exception { final BPInstanceConfig instanceConfig = createInstanceConfig(publishers, false, false, false, "master"); instanceConfig.setHostConfigurationAccess(mockHostConfigurationAccess); final BapPublisher mockPublisher = createAndAddMockPublisher(hostConfiguration.getName()); mockPublisher.perform(hostConfiguration, buildInfo); assertResult(Result.SUCCESS, instanceConfig); assertFalse(buildInfo.getCurrentBuildEnv().getEnvVars().containsKey(BPBuildInfo.ENV_NODE_NAME)); }
@Test public void testParameterizedPublishing() throws Exception { final String paramName = "PUB_PATTERN"; final ParamPublish paramPublish = new ParamPublish(paramName); buildInfo.getCurrentBuildEnv().getEnvVars().put(paramName, "Bill|Ted"); final BPInstanceConfig instanceConfig = createInstanceConfig(publishers, false, false, false, null, paramPublish); instanceConfig.setHostConfigurationAccess(mockHostConfigurationAccess); createLabeledPublisher("Bill", true); createLabeledPublisher("Neo", false); createLabeledPublisher("Ted", true); createLabeledPublisher("Trinity", false); assertResult(Result.SUCCESS, instanceConfig); }
private void assertFixNodeName( final String nodeName, final String masterNodeName, final String expectedNodeName) throws Exception { assertFixNodeName( buildInfo.getCurrentBuildEnv().getEnvVars(), nodeName, masterNodeName, expectedNodeName); }