Skip to content

Instantly share code, notes, and snippets.

@aslakknutsen
aslakknutsen / ParameterRule.java
Last active November 12, 2018 23:01
Execute @test n number of times incontainer 'injecting' a new value into the test instance pr @test iteration
/*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@aslakknutsen
aslakknutsen / test.md
Last active September 11, 2018 16:57

Start up with user having a running Server:

time="2018-09-11T18:26:25+02:00" level=info msg="UserIdler created." component=user-idler id=xxxxxx-a31f-471c-a3e7-9402c086d1be username=xxxxxxx 
time="2018-09-11T18:26:25+02:00" level=info msg="UserIdler started." checkIdle=5m component=user-idler id=xxxxxx-a31f-471c-a3e7-9402c086d1be maxRetriesQuietInterval=5m username=xxxxxxx 
time="2018-09-11T18:26:25+02:00" level=info msg="Will send user xxxxxxx to idler due to done build" 
time="2018-09-11T18:26:25+02:00" level=info msg="Sending user xxxxxxx to idler from a Build event" 
time="2018-09-11T18:26:26+02:00" level=info msg="Will send user xxxxxxx to idler due to a new version of DC or an existing version is coming up" 
time="2018-09-11T18:26:26+02:00" level=info msg="Sending user xxxxxxx to idler from a Deployment Config event" 
time="2018-09-11T18:26:26+02:00" level=info msg="About to idle jenkins, Reason: DoneBuild BuildName:cuckoo-1 Last:2018-07-20 05:05:22 +0000 UTC" attempt="(1/5)" component=user-idler id
@aslakknutsen
aslakknutsen / CustomerResourceClientTest.java
Created March 23, 2011 00:23
JAX-RS Arquillian TestCase with @ArquillianResource injection
@RunWith(Arquillian.class)
public class CustomerResourceClientTest
{
private static final String REST_PATH = "rest";
@Deployment(testable = false)
public static Archive<?> createDeployment()
{
return ShrinkWrap.create(WebArchive.class)
.addPackage(Customer.class.getPackage())
@aslakknutsen
aslakknutsen / 1.adoc
Last active March 21, 2018 04:06
OSiO: Incident Report

The incident report is intended as a write up for transparency, cross-team knowledge transfer and to get in the habit of thinking in terms of continues improvement.

An Incident report should be created for each OSiO outage(small or large) in GitHub with label "type/incident": https://github.com/openshiftio/openshift.io/issues

Note: this is a public report so de sensitise data. No tokens, no users, no internal links etc

@aslakknutsen
aslakknutsen / build.gradle
Created June 4, 2013 07:09
Asciidoclet with Gradle
configurations {
asciidoclet
}
dependencies {
asciidoclet 'org.asciidoctor:asciidoclet:0.1.3'
}
javadoc {
options.docletpath = configurations.asciidoclet.files.asType(List)
@aslakknutsen
aslakknutsen / generator_test.go
Last active January 24, 2018 16:56
WIT API Generator (requires pre setup of iterations, randomly distributes across iterations and states)
package wit
import (
"context"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"testing"
@aslakknutsen
aslakknutsen / cache.go
Created October 27, 2017 17:05
Multi level locked cache with Promise, single resovler
package middlewares
import (
"sync"
)
type Cache struct {
mux sync.Mutex
m map[string]Promise
}
@aslakknutsen
aslakknutsen / design.go
Last active September 28, 2017 08:52
JSON API ResourceObject GOA
// Definition
/*
func test() {
account := app.AccountSingle{}
account.Data.ID
account.Data.Type
account.Data.Attributes.Name
account.Data.Relationships.OwnedBy
account.Data.Relationships.OwnedBy.Meta
account.Data.Relationships.OwnedBy.Related
db := requires.Resource(t, Database)
space, wis := requires.Objects(t, Space(1), WorkItems(3, ExtraLongTitle()))
func ExtraLongTitle()  {
return func(wi *WorkItem) {
wi.Data.Attributes["system.title"] = ".. long thing.."
}
}
@aslakknutsen
aslakknutsen / workitem.create.html
Created August 16, 2017 00:49
rendered template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>New Work Item Created</title>
</head>