use of com.openshift.restclient.model.build.IWebhookTrigger in project jbosstools-openshift by jbosstools.
the class WebhookUtilTest method testEmptyWebHooks.
@Test
public void testEmptyWebHooks() {
IBuildConfig buildConfig = givenBuildConfigWithTriggers();
List<IWebhookTrigger> webHooks = WebhookUtil.getWebHooks(buildConfig);
assertNotNull(webHooks);
assertEquals(0, webHooks.size());
}
use of com.openshift.restclient.model.build.IWebhookTrigger in project jbosstools-openshift by jbosstools.
the class WebhookUtilTest method testGetWebHooks.
@Test
public void testGetWebHooks() {
IBuildConfig buildConfig = givenBuildConfigWithTriggers(genericTrigger(), imageChangeTrigger(), githubTrigger());
List<IWebhookTrigger> webHooks = WebhookUtil.getWebHooks(buildConfig);
assertEquals(2, webHooks.size());
assertNotNull(webHooks);
assertEquals(BuildTriggerType.GENERIC, webHooks.get(0).getType());
assertEquals(BuildTriggerType.GITHUB, webHooks.get(1).getType());
}
use of com.openshift.restclient.model.build.IWebhookTrigger in project jbosstools-openshift by jbosstools.
the class WebhookUtil method getWebHooks.
public static List<IWebhookTrigger> getWebHooks(IBuildConfig buildConfig) {
if (buildConfig == null) {
return null;
}
List<IBuildTrigger> triggers = buildConfig.getBuildTriggers();
List<IWebhookTrigger> webHooks = null;
if (triggers == null || triggers.isEmpty()) {
webHooks = Collections.emptyList();
} else {
webHooks = new ArrayList<>(triggers.size());
for (IBuildTrigger trigger : triggers) {
IWebhookTrigger webHook = getAsWebHook(trigger);
if (webHook != null) {
webHooks.add(webHook);
}
}
}
return webHooks;
}
Aggregations