Skip to content

Instantly share code, notes, and snippets.

View adrianmilne's full-sized avatar

Adrian Milne adrianmilne

View GitHub Profile
@adrianmilne
adrianmilne / test-data-set.xml
Created August 1, 2013 15:06
JPA Lucene - test-data-set.xml
<?xml version='1.0' encoding='UTF-8'?>
<!-- Test Dataset - mix of FANTASY and SC-FI to suppor the BookManagerDBUnitTest -->
<dataset>
<book id="1" title="The Lord of the Rings"
description="the Lord of the Rings is an epic high fantasy novel written by English philologist and University of Oxford professor J. R. R. Tolkien"
category="FANTASY" />
<book id="2" title="The War of the Worlds" description="War in space"
category="FANTASY" />
<book id="3" title="Apollo 13"
description="Apollo 13 was the seventh manned mission in the American Apollo space program and the third intended to land on the Moon"
@adrianmilne
adrianmilne / BookManagerDBUnitTest.java
Created August 1, 2013 14:12
JPA Lucene - DB Unit Test
package com.cor.demo.jpa.manager;
import java.io.InputStream;
import java.util.List;
import org.dbunit.DBTestCase;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
@adrianmilne
adrianmilne / application-context.xml
Last active December 20, 2015 12:29
JPA Lucene - application-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:camel="http://camel.apache.org/schema/spring" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
@adrianmilne
adrianmilne / BookManager.java
Last active December 20, 2015 12:29
JPA Lucene - Book Manager
package com.cor.demo.jpa.manager;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import javax.persistence.Query;
import org.hibernate.search.jpa.FullTextEntityManager;
@adrianmilne
adrianmilne / gist:6131497
Created August 1, 2013 13:47
JPA Lucene - Book Entity
package com.cor.demo.jpa.entity;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import org.hibernate.search.annotations.Boost;
@adrianmilne
adrianmilne / StartDem.java
Created April 18, 2013 06:31
CometD Demo - Demo start client
package com.cor.demo;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@adrianmilne
adrianmilne / MessageDispatcher.java
Created April 18, 2013 06:30
CometDDemo Message Dispatcher
package com.cor.demo;
import java.io.Serializable;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import org.slf4j.Logger;
@adrianmilne
adrianmilne / cometd-consumer.js
Created April 17, 2013 21:40
CometD consumer javascript
google.load("jquery", "1");
/**
* Callback function - Cometd consumer.
*/
google.setOnLoadCallback(function() {
$.getScript("http://jquerycomet.googlecode.com/svn/trunk/jquery.comet.js", function(){
console.log("done loading js");
$.comet.init("http://localhost:9099/cometd");
$.comet.subscribe("/broadcastMessageChannel", broadcastListener);
@adrianmilne
adrianmilne / cometd-route.xml
Created April 17, 2013 21:38
CometD demo - camel route
<!--
Server Camel Context (running inside ActiveMQ)
-->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- Load properties to Camel Context -->
<propertyPlaceholder id="properties" location="application.properties" />
<!-- Camel Broadcast Message Route -->
<route id="processIncomingFilesRoute" trace="true" xmlns="http://camel.apache.org/schema/spring">
@adrianmilne
adrianmilne / cometd-application.properties
Created April 17, 2013 21:34
CometD Camel demo - application.properties
broker.url=tcp://localhost:61616
broker.queue=corsoft.BroadcastMessageQueue
cometd.channel=cometd://0.0.0.0:9099/broadcastMessageChannel