[infinispan-commits] Infinispan SVN: r1184 - in trunk/demos: lucene-directory and 12 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Fri Nov 13 11:56:08 EST 2009
Author: sannegrinovero
Date: 2009-11-13 11:56:08 -0500 (Fri, 13 Nov 2009)
New Revision: 1184
Added:
trunk/demos/lucene-directory/
trunk/demos/lucene-directory/README.TXT
trunk/demos/lucene-directory/pom.xml
trunk/demos/lucene-directory/src/
trunk/demos/lucene-directory/src/main/
trunk/demos/lucene-directory/src/main/java/
trunk/demos/lucene-directory/src/main/java/org/
trunk/demos/lucene-directory/src/main/java/org/infinispan/
trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/
trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoActions.java
trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoDriver.java
trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java
trunk/demos/lucene-directory/src/main/resources/
trunk/demos/lucene-directory/src/main/resources/jgroups-configuration.xml
trunk/demos/lucene-directory/src/main/resources/log4j.xml
trunk/demos/lucene-directory/src/test/
trunk/demos/lucene-directory/src/test/java/
trunk/demos/lucene-directory/src/test/java/org/
trunk/demos/lucene-directory/src/test/java/org/infinispan/
trunk/demos/lucene-directory/src/test/java/org/infinispan/lucenedemo/
trunk/demos/lucene-directory/src/test/java/org/infinispan/lucenedemo/CacheConfigurationTest.java
trunk/demos/lucene-directory/src/test/resources/
Log:
[ISPN-274] (Interactive demo of Lucene Directory)
Added: trunk/demos/lucene-directory/README.TXT
===================================================================
--- trunk/demos/lucene-directory/README.TXT (rev 0)
+++ trunk/demos/lucene-directory/README.TXT 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,10 @@
+This is an interactive demo if the Lucene Directory.
+Run several copies of the demo, they should cluster automatically and see
+from the commandline how you can index text on one node and search for it
+on the others.
+
+To build the demo, do:
+
+mvn package appassembler:assemble
+
+this should download dependencies and produce proper scripts to run it in target/assembly
\ No newline at end of file
Added: trunk/demos/lucene-directory/pom.xml
===================================================================
--- trunk/demos/lucene-directory/pom.xml (rev 0)
+++ trunk/demos/lucene-directory/pom.xml 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<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>
+
+ <parent>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>infinispan-lucene-demo</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Infinispan Directory Demo</name>
+ <description>Infinispan - Directory Demo</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>infinispan-lucene-directory</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossjts</artifactId>
+ <version>4.6.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossts-common</artifactId>
+ <version>4.6.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <!-- Creates executable scripts -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>appassembler-maven-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <programs>
+ <program>
+ <mainClass>org.infinispan.lucenedemo.DemoDriver</mainClass>
+ <name>lucene-demo</name>
+ </program>
+ </programs>
+ <extraJvmArguments>-Djava.net.preferIPv4Stack=true -Dprotocol.stack=udp</extraJvmArguments>
+ <assembleDirectory>${project.build.directory}/assembly</assembleDirectory>
+ </configuration>
+ </plugin>
+
+ <!-- Testing Configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <parallel>false</parallel>
+ <threadCount>1</threadCount>
+ <forkMode>once</forkMode>
+ <systemProperties>
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
Property changes on: trunk/demos/lucene-directory/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoActions.java
===================================================================
--- trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoActions.java (rev 0)
+++ trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoActions.java 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.lucenedemo;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriter.MaxFieldLength;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TopDocs;
+import org.infinispan.lucene.InfinispanDirectory;
+import org.infinispan.remoting.transport.Address;
+
+/**
+ * DemoActions.
+ *
+ * @author Sanne Grinovero
+ * @since 4.0
+ */
+public class DemoActions {
+
+ /** The MAIN_FIELD */
+ private static final String MAIN_FIELD = "myField";
+
+ /** The Analyzer used in all methods **/
+ private static final Analyzer analyzer = new StandardAnalyzer();
+
+ private InfinispanDirectory index;
+
+ public DemoActions() {
+ index = DirectoryFactory.getIndex("index");
+ }
+
+ /**
+ * Runs a Query and returns the stored field for each matching document
+ * @throws IOException
+ */
+ public List<String> listStoredValuesMatchingQuery(Query query) throws IOException {
+ IndexSearcher searcher = new IndexSearcher(index);
+ TopDocs topDocs = searcher.search(query, null, 100);// demo limited to 100 documents!
+ ScoreDoc[] scoreDocs = topDocs.scoreDocs;
+ List<String> list = new ArrayList<String>();
+ for (ScoreDoc sd : scoreDocs) {
+ Document doc = searcher.doc(sd.doc);
+ list.add(doc.get(MAIN_FIELD));
+ }
+ return list;
+ }
+
+ /**
+ * Returns all stored fields
+ * @throws IOException
+ */
+ public List<String> listAllDocuments() throws IOException {
+ MatchAllDocsQuery q = new MatchAllDocsQuery();
+ return listStoredValuesMatchingQuery(q);
+ }
+
+ /**
+ * Creates a new document having just one field containing a string.
+ *
+ * @param line The text snippet to add
+ * @throws IOException
+ */
+ public void addNewDocument(String line) throws IOException {
+ IndexWriter iw = new IndexWriter(index, analyzer, MaxFieldLength.UNLIMITED);
+ try {
+ Document doc = new Document();
+ Field field = new Field(MAIN_FIELD, line, Store.YES, Index.ANALYZED);
+ doc.add(field);
+ iw.addDocument(doc);
+ iw.commit();
+ } finally {
+ iw.close();
+ }
+ }
+
+ /**
+ * Parses a query using the single field as default
+ * @throws ParseException
+ */
+ public Query parseQuery(String queryLine) throws ParseException {
+ QueryParser parser = new QueryParser(MAIN_FIELD, analyzer);
+ Query query = parser.parse(queryLine);
+ return query;
+ }
+
+ /**
+ * Returns a list of Adresses of all members in the cluster
+ */
+ public List<Address> listAllMembers() {
+ return index.getCache().getCacheManager().getMembers();
+ }
+
+}
Property changes on: trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoActions.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoDriver.java
===================================================================
--- trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoDriver.java (rev 0)
+++ trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoDriver.java 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.lucenedemo;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Scanner;
+
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.search.Query;
+import org.infinispan.remoting.transport.Address;
+
+/**
+ * DemoBoot.
+ *
+ * @author Sanne Grinovero
+ * @since 4.0
+ */
+public class DemoDriver implements Runnable {
+
+ private final DemoActions actions = new DemoActions();
+
+ public static void main(String[] args) throws IOException {
+ DemoDriver driver = new DemoDriver();
+ driver.run();
+ }
+
+ private void doQuery(Scanner scanner) throws IOException {
+ scanner.nextLine();
+ Query query = null;
+ while (query == null) {
+ System.out.println("Enter a query:");
+ String queryLine = scanner.nextLine();
+ try {
+ query = actions.parseQuery(queryLine);
+ } catch (ParseException e) {
+ System.out.println("Wrong syntax in query: " + e.getMessage());
+ System.out.println("type it again: ");
+ }
+ }
+ List<String> listMatches = actions.listStoredValuesMatchingQuery(query);
+ printResult(listMatches);
+ }
+
+ private void insertNewText(Scanner scanner) throws IOException {
+ System.out.println("Enter string as new document:");
+ scanner.nextLine();
+ String line = scanner.nextLine();
+ actions.addNewDocument(line);
+ }
+
+ private void listAllDocuments() throws IOException {
+ List<String> listMatches = actions.listAllDocuments();
+ printResult(listMatches);
+ }
+
+ private void listMembers() {
+ List<Address> members = actions.listAllMembers();
+ System.out.println("\tmembers:\t" + members);
+ }
+
+ private void showOptions() {
+ System.out.println(
+ "Options:\n" +
+ "\t[1] List cluster members\n" +
+ "\t[2] List all documents in index\n" +
+ "\t[3] insert new text\n" +
+ "\t[4] enter a query\n" +
+ "\t[5] quit");
+ }
+
+ private void printResult(List<String> storedValues) throws IOException {
+ System.out.println("Matching documents:\n");
+ if (storedValues.isEmpty()) {
+ System.out.println("\tNo documents found.");
+ }
+ else {
+ int i = 0;
+ for (String value : storedValues) {
+ System.out.println(++i + "\t\"" + value + "\"");
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ Scanner scanner = new Scanner(System.in);
+ while (true) {
+ showOptions();
+ boolean warned = false;
+ while (!scanner.hasNextInt()) {
+ if (!warned) {
+ System.out.println("Invalid option, try again:");
+ warned = true;
+ }
+ scanner.nextLine();
+ }
+ int result = scanner.nextInt();
+ try {
+ switch (result) {
+ case 1:
+ listMembers();
+ break;
+ case 2:
+ listAllDocuments();
+ break;
+ case 3:
+ insertNewText(scanner);
+ break;
+ case 4:
+ doQuery(scanner);
+ break;
+ case 5:
+ System.out.println("Quit.");
+ System.exit(0);
+ break;
+ default:
+ System.out.println("Invalid option.");
+ }
+ System.out.println("");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
Property changes on: trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DemoDriver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java
===================================================================
--- trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java (rev 0)
+++ trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.lucenedemo;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.lucene.CacheKey;
+import org.infinispan.lucene.InfinispanDirectory;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
+import org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup;
+
+/**
+ * Utility to create a Directory for the demo.
+ *
+ * @author Sanne Grinovero
+ * @since 4.0
+ */
+public class DirectoryFactory {
+
+ public static final String CACHE_NAME_FOR_INDEXES = "LuceneIndex";
+
+ private static CacheManager manager = null;
+ private static final Map<String, InfinispanDirectory> directories = new HashMap<String, InfinispanDirectory>();
+
+ private static Cache<CacheKey, Object> buildCacheForIndexes() {
+ return getCacheManager().getCache(CACHE_NAME_FOR_INDEXES);
+ }
+
+ public static synchronized CacheManager getCacheManager() {
+ if (manager != null)
+ return manager;
+ GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
+ gc.setClusterName("infinispan-lucene-demo-cluster");
+ gc.setTransportClass(JGroupsTransport.class.getName());
+ Properties p = new Properties();
+ p.setProperty("configurationFile", "jgroups-configuration.xml");
+ gc.setTransportProperties(p);
+
+ Configuration config = new Configuration();
+ config.setCacheMode(Configuration.CacheMode.DIST_SYNC);
+ config.setSyncCommitPhase(true);
+ config.setSyncRollbackPhase(true);
+ config.setTransactionManagerLookupClass(JBossStandaloneJTAManagerLookup.class.getName());
+ config.setNumOwners(2);
+ config.setL1CacheEnabled(true);
+ config.setInvocationBatchingEnabled(true);
+ config.setL1Lifespan(6000000);
+ manager = new DefaultCacheManager(gc, config, false);
+ return manager;
+ }
+
+ public static synchronized InfinispanDirectory getIndex(String indexName) {
+ InfinispanDirectory dir = directories.get(indexName);
+ if (dir == null) {
+ dir = new InfinispanDirectory(buildCacheForIndexes(), indexName);
+ directories.put(indexName, dir);
+ }
+ return dir;
+ }
+
+}
Property changes on: trunk/demos/lucene-directory/src/main/java/org/infinispan/lucenedemo/DirectoryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/demos/lucene-directory/src/main/resources/jgroups-configuration.xml
===================================================================
--- trunk/demos/lucene-directory/src/main/resources/jgroups-configuration.xml (rev 0)
+++ trunk/demos/lucene-directory/src/main/resources/jgroups-configuration.xml 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,57 @@
+<config xmlns="urn:org:jgroups"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:org:jgroups file:schema/JGroups-2.8.xsd">
+ <UDP
+ mcast_addr="${jgroups.udp.mcast_addr:228.6.7.8}"
+ mcast_port="${jgroups.udp.mcast_port:46655}"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ ip_ttl="${jgroups.udp.ip_ttl:2}"
+ enable_bundling="true"
+ enable_diagnostics="false"
+
+ thread_naming_pattern="pl"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="2"
+ thread_pool.max_threads="30"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="Discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="2"
+ oob_thread_pool.max_threads="30"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="Discard"
+ />
+
+ <PING timeout="3000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD_ALL/>
+ <BARRIER />
+ <pbcast.NAKACK use_stats_for_retransmission="false"
+ exponential_backoff="0"
+ use_mcast_xmit="true" gc_lag="0"
+ retransmit_timeout="300,600,1200"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="1000000"/>
+ <pbcast.GMS print_local_addr="false" join_timeout="3000" view_bundling="true"/>
+ <FC max_credits="500000" min_threshold="0.20"/>
+ <FRAG2 frag_size="60000" />
+ <!--<pbcast.STREAMING_STATE_TRANSFER/>-->
+ <pbcast.STATE_TRANSFER/>
+ <pbcast.FLUSH timeout="0"/>
+</config>
Property changes on: trunk/demos/lucene-directory/src/main/resources/jgroups-configuration.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/demos/lucene-directory/src/main/resources/log4j.xml
===================================================================
--- trunk/demos/lucene-directory/src/main/resources/log4j.xml (rev 0)
+++ trunk/demos/lucene-directory/src/main/resources/log4j.xml 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!--
+ For more configuration infromation and examples see the Apache Log4j website: http://logging.apache.org/log4j/
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="infinispan.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+ <param name="Threshold" value="TRACE"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="TRACE"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c{1}] (%t) %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.infinispan">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.infinispan.lucene">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.infinispan.profiling">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.infinispan.jmx">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.infinispan.factories">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="WARN"/>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: trunk/demos/lucene-directory/src/main/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/demos/lucene-directory/src/test/java/org/infinispan/lucenedemo/CacheConfigurationTest.java
===================================================================
--- trunk/demos/lucene-directory/src/test/java/org/infinispan/lucenedemo/CacheConfigurationTest.java (rev 0)
+++ trunk/demos/lucene-directory/src/test/java/org/infinispan/lucenedemo/CacheConfigurationTest.java 2009-11-13 16:56:08 UTC (rev 1184)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.lucenedemo;
+
+import org.apache.lucene.store.Directory;
+import org.infinispan.lucenedemo.DirectoryFactory;
+import org.testng.annotations.Test;
+
+/**
+ * CacheCreationTest.
+ *
+ * @author Sanne Grinovero
+ * @since 4.0
+ */
+ at Test
+public class CacheConfigurationTest {
+
+ @Test
+ public void testAbleToCreateCaches() {
+ Directory cacheForIndex1 = DirectoryFactory.getIndex("firstIndex");
+ Directory cacheForIndex2 = DirectoryFactory.getIndex("firstIndex");
+ Directory cacheForIndex3 = DirectoryFactory.getIndex("secondIndex");
+ assert cacheForIndex1 != null;
+ assert cacheForIndex1 == cacheForIndex2;
+ assert cacheForIndex1 != cacheForIndex3;
+ }
+
+}
Property changes on: trunk/demos/lucene-directory/src/test/java/org/infinispan/lucenedemo/CacheConfigurationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the infinispan-commits
mailing list