Skip to content

Instantly share code, notes, and snippets.

View rafaeltuelho's full-sized avatar
🎯
Focusing

Rafael T. C. Soares (A.K.A Tuelho) rafaeltuelho

🎯
Focusing
  • Red Hat Inc.
  • Frisco, TX, USA
  • 13:37 (UTC -05:00)
View GitHub Profile
@rafaeltuelho
rafaeltuelho / fuse62-fabric8-maven-plugin.md
Created August 26, 2015 20:03
Fuse 6.2 fabric8-maven-plugin

add this plugin dep to your pom:

<plugins>
  <plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>fabric8-maven-plugin</artifactId>
    <version>1.0.0.redhat-355</version>
 
@rafaeltuelho
rafaeltuelho / OBIEEHttpServletBridge.java
Last active August 29, 2015 13:57
Java HTTP Servlet to be used as a bridge between a Web APP and Oracle BI Server when using OBIEE SOAP API for integration scenarios.
package br.net.rafaeltuelho.servlets;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
@rafaeltuelho
rafaeltuelho / arquillian.xml
Last active August 29, 2015 14:07
Arquillian Descritor example for JBoss/Wildfly Integration tests
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBoss, Home of Professional Open Source
Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. 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
@rafaeltuelho
rafaeltuelho / jboss-as-javaee-6-arquillian-pom.xml
Last active August 29, 2015 14:07
Maven POM example for JBoss EAP/Wildfly JavaEE 6 projects. Includes JBoss EAP and Arquillian BOMs (Maven JBoss/JavaEE 6 standard definitions)
<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>br.net.rafaeltuelho</groupId>
<artifactId>unit1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>JB297 Training</description>
<developers>
<developer>
@rafaeltuelho
rafaeltuelho / jboss-persistence-jta.xml
Last active August 29, 2015 14:07
JPA (2.1) Persistence Unit sample for use in JBoss EAP/Wildfly environments
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="unit1" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
@rafaeltuelho
rafaeltuelho / ShrinkWrap-ArquillianTest-Snippet.java
Last active August 29, 2015 14:08
Shrinkwrap code snippet to generate an Arquillian deployment archive to test inside a JBossAS/EAP
@Deployment
public static Archive<?> createDeployment() {
// You can use war packaging...
@SuppressWarnings("unused")
WebArchive war = ShrinkWrap
.create(WebArchive.class, "test.war")
.addPackage(Bus.class.getPackage())
// .addAsManifestResource(
// new File("src/main/resources/META-INF",
// "persistence.xml"))
@rafaeltuelho
rafaeltuelho / jpa-qry-api-examples.java
Created November 2, 2014 21:44
Some JPA Query API code snippet samples
public void findindAllUsingJpqlQuery() throws Exception {
// given
String fetchingAllInJpql = "select e from " + ENTITY_NAME
+ " e order by e.id";
// when
System.out.println("Selecting (using JPQL)...");
List<Entity> entities = em.createQuery(fetchingAllInJpql,
Entity.class).getResultList();
@rafaeltuelho
rafaeltuelho / EntityManager-sample.java
Created November 7, 2014 17:41
Creating an JPA EntityManager
// in JavaSE environment
EntityManagerFactory emf = Persistence.createEntityManagerFactory("sample");
EntityManager em = emf.createEntityManager();
try{
...
]
finally{
em.close();
@rafaeltuelho
rafaeltuelho / java-eclipse-projects.gitignore
Created November 7, 2014 19:50
.gitignore sample file for java eclipse maven projects
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
@rafaeltuelho
rafaeltuelho / jboss-fuse-camel-osgi-pom.xml
Created November 7, 2014 20:02
Maven POM to package camel routes (Java DSL) projects to deploy in a OSGI Containers like JBoss Fuse (Apache Karaf) without Blueprint or Spring Beans XML descriptors.
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.redhat.workshop.fuse</groupId>
<artifactId>camel-java</artifactId>
<packaging>bundle</packaging>
<version>1.0.0-SNAPSHOT</version>