Set up a embedded Payara 5 for Arquillian tests with DB2 z/OS drivers

Despite a lot of tutorials on using embedded Payara with Arquillian, I struggled a while to get the container running. Here are the steps


Code for configuring and deploying the embedded container

@Deployment public static Archive createDeployment() throws IOException {
File[] files = Maven.configureResolver().withMavenCentralRepo(false).loadPomFromFile("pom.xml").resolve("com.ibm:db2jcc4:version1234", "com.ibm:db2jcc_license_cisuz:version1234").withTransitivity().asFile();
final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war").addPackages(true, "my.org.backend").addPackages(true, "my.org.exceptions").addAsResource("persistence.xml", "META-INF/persistence.xml").addAsLibraries(files); // add all xml required for the queries
Files.walk(Paths.get("src/main/resources/META-INF")).forEach(file - >{
if (file.toFile().isFile() && !file.getFileName().toString().equalsIgnoreCase("MANIFEST.MF") && !file.getFileName().toString().equalsIgnoreCase("persistence.xml")) {
final String fileName = file.toAbsolutePath().toString();
final int start = fileName.indexOf("META-INF");
final String resource = fileName.substring(start - 1);
war.addAsResource(file.toFile(), resource);
}
});
return war;
}


Mind to put the arquillian.xml under „src/test/resources“

Maven dependencies:
org.jboss.arquillian.junit arquillian-junit-container 1.4.1.Final test
org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven 2.2.6 test
junit junit 4.12 test
fish.payara.arquillian arquillian-payara-server-4-embedded 1.0.Beta3 test
fish.payara.extraspayara-embedded-all5.181test

Google Chrome: CORS and Kiosk Mode

In order to avoid any problems with CORS when just running a local app
open -a Google Chrome –args –disable-web-security –user-data-dir=„“
If you want to have a nice full-screen Kiosk mode, install the **drums** „Kiosk“ app from the Chrome store. 

Building a CalDAV client with web components

Some steps and pitfalls on my way creating a CalDAV client with webcomponents
1. If you want to use moment.js include it this way
import moment from ‚moment‘; window.moment = moment; 
2. The template for the „REPORT“ request should look like this, e.g. to get the events for a time range. Mind, there MUST NOT BE any whitespace between the backtick and the start of the xml declaration.
const query = (start,end) => `                                             `;
3. I had to start Chrome like this to get rid of CORS issues
open -a Google Chrome –args –disable-web-security –user-data-dir=„“
4. The fetch request should look like this
  let start = moment().subtract(5,’days‘);         let end = moment();         let startString =  start.format(„YYYYMMDD[T]000000[Z]“);         let endString = end.format(„YYYYMMDD[T]000000[Z]“);         let myHeaders = new Headers();         myHeaders.append(„DEPTH“,“1″);         myHeaders.append(„Authorization“,“Basic “ + authentication);
        console.log(‚caldaving‘, startString,endString)
        fetch(url,{             method: „REPORT“,             headers : myHeaders,             body : query(startString,endString)         })         .then(response => {             console.log(„reso“, response)             let xml = response.text();             console.log(‚Got appointments‘, xml);             return xml;         }).then(xml => console.log(‚xml‘,xml))
5. To get the authentication as base64 use „ echo -n user:password | base64“ Mind the „-n“ otherwise you get a line break at the end!

K8s on Ubuntu

1. Install using snap and proxy: neu.lu/2016/06/ubuntu-snap-mit-proxy/ 2. sudo snap install conjure-up –classic 3. sudo snap install kubectl –classic 4. sudo apt-get update && apt-get install -y apt-transport-https 5. apt-get update && apt-get install -y apt-transport-https curl -s packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add – cat </etc/apt/sources.list.d/kubernetes.list deb apt.kubernetes.io/ kubernetes-xenial main EOF apt-get update apt-get install -y kubelet kubeadm kubectl 6. export KUBECONFIG=/etc/kubernetes/admin.conf als root

Secure Kibana with basic_auth and nginx

If you don’t have the money to afford x-pack, but you want to secure your Kibana at least with basic authentication using nginx, the following entries in default.conf. The target is a kibana instance within the same Docker swarm network.

location /app/kibana {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/app/kibana;
}
location /app/timelion {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/app/timelion;
}
location /bundles {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/bundles;
}
location /ui {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/ui;
}
location /plugins {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/plugins;
}
location /api/console {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/api/console;
}
location /api/status {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/api/status;
}
location /status {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/status;
}
location ~* /api/(.*)$ {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/api/$1$is_args$args;
}
location ~* /elasticsearch/(.*)$ {
auth_basic "Restricted Content"; auth_basic_user_file "/etc/nginx/.htpasswd"; proxy_pass kibana:5601/elasticsearch/$1$is_args$args;
}

Set JAVA_HOME on Mac OS

Props to: coderwall.com/p/esa4sg/set-default-jdk-on-mac-os-x
To set to JDK 6


export JAVA_HOME=$(/usr/libexec/java_home -v 1.6) To set JDK 7
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) To set JDK 8
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Created aliases for my zsh
alias setjdk16='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)' alias setjdk17='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)' alias setjdk18='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)'