Skip to content

Instantly share code, notes, and snippets.

View kubamarchwicki's full-sized avatar

Kuba Marchwicki kubamarchwicki

View GitHub Profile
@kubamarchwicki
kubamarchwicki / gist:1295093
Created October 18, 2011 10:12
Importing SQL file after bootstrapping OpenEJB
InputStream stream = ConfigHelper.getResourceAsStream("/filename.sql");
InputStreamReader importFileReader = new InputStreamReader(stream);
Connection connection = ds.getConnection();
Statement statement = connection.createStatement();
BufferedReader reader = new BufferedReader(importFileReader);
for (String sql = reader.readLine(); sql != null; sql = reader.readLine()) {
try {
String trimmedSql = sql.trim();
@kubamarchwicki
kubamarchwicki / HelloMessage.java
Created May 26, 2012 21:38
JAX-WS / JAX-RS TomEE issues
package pl.marchwicki.jee6.basetypes;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="helloMessage")
public class HelloMessage {
@XmlElement(name="message")
public String getMessage() {
@kubamarchwicki
kubamarchwicki / jbossas-remote-6 validation test problems
Last active December 19, 2015 03:09
Validation jbossas-remote-6 gotcha
So the answer was: I used wrong import for @Inject. Not from javax, but org.aqruillian and earlier on haven't put beans.xml in archive. With these two things sorted out - the desired-test example works fine.
-------
So the things is - I have this test to check validation on the server side.
I build arquillian archive and deploy it to a remote server: as shown
in desired-test.java.
As I'm running arquillian test suite I'd rather take this approach that
have a hibernate-validator dependency in my test scope to get validator
from default factory.
@kubamarchwicki
kubamarchwicki / Method.java
Last active December 19, 2015 13:09
Validating method parameters
public class SomeBean {
@Interceptors(ValidationInterceptor.class)
public void addAuthor(@Size(min=5) String name,
String surename) {
Author a = new Author();
a.setName(name);
a.setSurename(surename);
em.persist(a);
@kubamarchwicki
kubamarchwicki / db-list
Created August 18, 2013 19:05
Firefox OS backup files
SMS - 226660312ssm.sqlite
Contacts - 3406066227csotncta.sqlite
@kubamarchwicki
kubamarchwicki / MappingAPIExample.java
Last active January 1, 2016 22:49
Dozer deep index bug
package pl.marchwicki.dozer;
import org.dozer.DozerBeanMapper;
import org.dozer.loader.api.BeanMappingBuilder;
import org.dozer.loader.api.FieldsMappingOptions;
import org.dozer.loader.api.TypeMappingOptions;
import pl.marchwicki.basetypes.BeanA;
import pl.marchwicki.basetypes.BeanC;
import pl.marchwicki.basetypes.TargetBean;
@kubamarchwicki
kubamarchwicki / Tools.java
Last active August 29, 2015 14:01
Browsing randomly through the HR system...
public class Tools {
public static String dateToString(String date)
{
String t="0";
// mmrrr
if (date.length()==6) t=date.substring(2,6)+"0"+date.substring(0,1);
if (date.length()==7) t=date.substring(3,7)+date.substring(0,2);
if (date.length()==9) t=date.substring(5,9)+date.substring(2,4)+"0"+date.substring(0,1);
@kubamarchwicki
kubamarchwicki / exercise.txt
Last active August 29, 2015 14:01
Agile estimation. Ćwiczenie
Zadanie: Jaka jest suma wysokości oznaczonych budynków.
Motoryka:
1. Podzielcie się na kilka zespołów (5)
2. Zadanie1: Zastanówcie się i podajcie sumę wielkości budynków - wyrażoną w metrach
3. Humans are pretty bad at estimating (don't you hate it when people ask you to guess their age or weight?), and the more unknowns there are, the worse we are at doing it. By using relative estimation, we can then just shift things to a matter of scale. It is (generally) much easier to look at two things, and say roughly, one is twice the height of the other, or twice the size of the other.
4. Zadanie2: Budynek 5 ma wielkość "3". Podaj sumę wysokości wyrażoną w punktach.
5. Jeżeli nie czujecie story points, to możecie używać innych abstrakcyjnych wartości: Koszulki, złoty podział
6. Zadanie3: Podajemy rzeczywistą wielkość któregoś z budynków. Liczymy sumę wysokości.
@kubamarchwicki
kubamarchwicki / input.adoc
Last active August 29, 2015 14:04
Asciidoc metadata
//this is just for github to render a literal

== Personal details

[itemtype-Person]
--
[itemprop-name]#Jakub Marchwicki# +
[itemprop-url]#http://jakub.marchwicki.pl[Personal website]# +
[itemprop-email]#somename@gmail.com#
@kubamarchwicki
kubamarchwicki / arq_containerless.adoc
Created October 27, 2015 12:47
Containerless Arquillian without deployment

I would like to use Arquillian Cube containerless to spin of already backed docker images (with an application deployed alread there).

The image is already prepared by a seperate project and what I would like to get is a separate project with integration test (wrtitten in Spock - ideally, but JUnit is ok so far).

This is pretty much as was described in here: on IRC transcription (the only place where I found the reference to something I’d like to get).

What I’m having is a container built elsewhere (a different project) and I’d like to use Arquillian Cube to use it and run tests against it.