Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Galinski jangalinski

View GitHub Profile
View ShouldNotInjectStringTest.java
package org.needle4j.injection;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.needle4j.annotation.InjectIntoMany;
import org.needle4j.annotation.ObjectUnderTest;
import org.needle4j.junit.NeedleBuilders;
import org.needle4j.junit.NeedleRule;
View PlaygroundApplication.java
package com.github.jangalinski.deltaspike;
import org.apache.deltaspike.cdise.api.CdiContainer;
import org.apache.deltaspike.cdise.api.CdiContainerLoader;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
View _26177485Test.java
package com.github.jangalinski;
import org.assertj.core.api.Assertions;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@jangalinski
jangalinski / finalLoggerReplace.java
Created Oct 5, 2014
Replace a static final Logger with a mock
View finalLoggerReplace.java
private Logger replaceLoggerConstantWithMock() throws Exception {
final Field field = DropwizardResourceConfig.class.getDeclaredField("LOGGER");
final Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.setAccessible(true);
field.set(null,mock(Logger.class);
return (Logger) field.get(null);
@jangalinski
jangalinski / pom.xml
Created Oct 12, 2014
mixed compile with scala
View pom.xml
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
<build>
@jangalinski
jangalinski / BuzzwordClockApplication.java
Created Oct 5, 2015
A super fancy clock for your browser built with Spring Boot, Reactor, Atmosphere, vaadin, Scheduler ....
View BuzzwordClockApplication.java
package io.github.jangalinski.playground.clock;
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
View jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<!--
I have a ear deployment, I'm specifying only the module which is client of the EJB Remote module running in AS5.
My client class is itself an EJB 3.1 running in JBoss AS7. It is client of an EJB 2.0 running in JBoss AS5.
-->
<sub-deployment name="my-ejb-module-on-as7-${project.version}.jar">
<dependencies>
View GuiceSingletonProviderTest.java
package com.github.jangalinski;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.junit.Test;
import javax.inject.Provider;
import javax.inject.Singleton;
View CandidateAssigneDoesNotWorkTest.java
package org.camunda.bpm.extension.mockito;
import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.delegate.TaskListener;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
View MyBean.java
public MyBean {
private String value;
@PostConstruct
public void initValue() {
value = new PropertyReader("file").getValue("parameter");
}
}