Skip to content

Instantly share code, notes, and snippets.

View ThomasStuetz's full-sized avatar

OStR Ing Mag Dr Thomas W. Stütz ThomasStuetz

View GitHub Profile
@ThomasStuetz
ThomasStuetz / strings.xml
Created January 7, 2015 09:37
Espresso Test 01
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Espresso Teststellung 02</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="tv_input">Eingabe:</string>
<string name="et_input">Eine Zahl oder ein Wort</string>
<string name="tx_ok">ok</string>
@ThomasStuetz
ThomasStuetz / build.gradle
Created January 7, 2015 09:39
Espresso Test 01
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "at.htl.espressotest"
minSdkVersion 15
targetSdkVersion 21
@ThomasStuetz
ThomasStuetz / persistence.xml
Last active December 9, 2019 19:20
Simple persistence.xml for JavaEE 7
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="myPU" transaction-type="JTA">
<jta-data-source>java:jboss/datasources/MyDS</jta-data-source>
<properties>
<!--
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.transaction.flush_before_completion" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
@ThomasStuetz
ThomasStuetz / pom.xml
Last active December 9, 2019 19:21
Simple pom.xml for JavaEE 7
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>at.htl.vehicle-jpa</groupId>
<artifactId>vehicle-jpa</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
@ThomasStuetz
ThomasStuetz / pom.xml
Last active December 9, 2019 19:20
pom.xml for System Test (Jersey Client + jUnit)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>at.htl</groupId>
<artifactId>vehicle-st</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@ThomasStuetz
ThomasStuetz / persistence.xml
Last active December 9, 2019 19:21
Simple persistence.xml for JavaSE and DerbyDb
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="myPU" transaction-type="RESOURCE_LOCAL">
<class>at.htl.vehicle.entity.Vehicle</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.target-database" value="DERBY"/>
<!--
<property name="javax.persistence.jdbc.driver"
@ThomasStuetz
ThomasStuetz / VehicleTest.java
Created October 14, 2015 08:28
Simple JDBC-Test for JavaSE
package at.htl.vehicle;
import org.junit.BeforeClass;
import org.junit.Test;
import java.sql.*;
import static junit.framework.TestCase.fail;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@ThomasStuetz
ThomasStuetz / web.xml
Created October 26, 2015 22:48
web.xml for JavaEE Web with Primefaces
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
@ThomasStuetz
ThomasStuetz / pom.xml
Last active October 11, 2016 08:37
Simple pom.xml for JavaEE and database access in the tests (JavaSE with eclipselink+derbydb)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>at.htl</groupId>
<artifactId>vehicle</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
@ThomasStuetz
ThomasStuetz / ItemDivider.java
Created May 13, 2017 17:00
Google's sample implementation of dividers displayed between the RecyclerView items
@Override
public void onDrawOver(Canvas c, RecyclerView parent,
RecyclerView.State state) {
super.onDrawOver(c, parent, state);
// calculate left/right x-coordinates for all dividers
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
// for every item but the last, draw a line below it