use of io.fabric8.arquillian.kubernetes.log.Logger in project fabric8 by fabric8io.
the class SessionListener method loadDependency.
public void loadDependency(Logger log, List<KubernetesList> kubeConfigs, String dependency, Controller controller, Configuration configuration, String namespace) throws Exception {
// lets test if the dependency is a local string
String baseDir = System.getProperty("basedir", ".");
String path = baseDir + "/" + dependency;
File file = new File(path);
if (file.exists()) {
loadDependency(log, kubeConfigs, file, controller, configuration, log, namespace);
} else {
String text = readAsString(createURL(dependency));
Object resources;
if (text.trim().startsWith("---") || dependency.endsWith(".yml") || dependency.endsWith(".yaml")) {
resources = loadYaml(text);
} else {
resources = loadJson(text);
}
addConfig(kubeConfigs, resources, controller, configuration, log, namespace, dependency);
}
}
use of io.fabric8.arquillian.kubernetes.log.Logger in project fabric8 by fabric8io.
the class SuiteListener method start.
public void start(@Observes(precedence = 100) BeforeSuite event, Configuration configuration, Logger logger) {
session = new Session(configuration.getSessionId(), configuration.getNamespace(), logger);
session.init();
sessionProducer.set(session);
controlEvent.fire(new Start(session));
}
use of io.fabric8.arquillian.kubernetes.log.Logger in project fabric8 by fabric8io.
the class SuiteListener method stop.
public void stop(@Observes(precedence = -100) AfterSuite event, Logger logger) {
controlEvent.fire(new Stop(session));
session.destroy();
}
use of io.fabric8.arquillian.kubernetes.log.Logger in project fabric8 by fabric8io.
the class WebHooks method createGogsWebhook.
/**
* Creates a webook in the given gogs repo for the user and password if the webhook does not already exist
*/
public static boolean createGogsWebhook(GitRepoClient repoClient, Logger log, String gogsUser, String repoName, String webhookUrl, String webhookSecret) throws JsonProcessingException {
if (repoClient == null) {
log.info("Cannot create Gogs webhooks as no Gogs service could be found or created");
return false;
}
String gogsAddress = repoClient.getAddress();
log.info("Querying webhooks in gogs at address: " + gogsAddress + " for user " + gogsUser + " repoName: " + repoName);
RepositoryDTO repository = repoClient.getRepository(gogsUser, repoName);
if (repository == null) {
log.info("No repository found for user: " + gogsUser + " repo: " + repoName + " so cannot create any web hooks");
// return false;
}
List<WebHookDTO> webhooks = repoClient.getWebhooks(gogsUser, repoName);
for (WebHookDTO webhook : webhooks) {
String url = null;
WebhookConfig config = webhook.getConfig();
if (config != null) {
url = config.getUrl();
if (Objects.equal(webhookUrl, url)) {
log.info("Already has webhook for: " + url + " so not creating again");
return false;
}
log.info("Ignoring webhook " + url + " from: " + toJson(config));
}
}
CreateWebhookDTO createWebhook = new CreateWebhookDTO();
createWebhook.setType("gogs");
WebhookConfig config = createWebhook.getConfig();
config.setUrl(webhookUrl);
config.setSecret(webhookSecret);
WebHookDTO webhook = repoClient.createWebhook(gogsUser, repoName, createWebhook);
if (log.isDebugEnabled()) {
log.debug("Got created web hook: " + toJson(webhook));
}
log.info("Created webhook for " + webhookUrl + " for user: " + gogsUser + " repoName: " + repoName + " on gogs URL: " + gogsAddress);
return true;
}
use of io.fabric8.arquillian.kubernetes.log.Logger in project docker-maven-plugin by fabric8io.
the class LogMatchCallbackTest method matchingSingleLineSucceeds.
@Test(expected = LogCallback.DoneException.class)
public void matchingSingleLineSucceeds() throws Exception {
final String patternString = "The start has finished right now";
final LogMatchCallback logMatchCallback = new LogMatchCallback(logger, callback, patternString);
new Expectations() {
{
callback.matched();
times = 1;
}
};
logMatchCallback.log(1, new Timestamp(), patternString);
}
Aggregations