[jbosscache-commits] JBoss Cache SVN: r5370 - in pojo/tags: 2.1.0.CR4 and 3 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Feb 20 23:28:30 EST 2008
Author: jason.greene at jboss.com
Date: 2008-02-20 23:28:29 -0500 (Wed, 20 Feb 2008)
New Revision: 5370
Added:
pojo/tags/2.1.0.CR4/
pojo/tags/2.1.0.CR4/pom.xml
pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
pojo/tags/2.1.0.CR4/src/test/resources/META-INF/
pojo/tags/2.1.0.CR4/src/test/resources/log4j.xml
Removed:
pojo/tags/2.1.0.CR4/pom.xml
pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
Log:
Tag 2.1.0.CR4
Copied: pojo/tags/2.1.0.CR4 (from rev 5362, pojo/branches/2.1)
Deleted: pojo/tags/2.1.0.CR4/pom.xml
===================================================================
--- pojo/branches/2.1/pom.xml 2008-02-20 16:57:50 UTC (rev 5362)
+++ pojo/tags/2.1.0.CR4/pom.xml 2008-02-21 04:28:29 UTC (rev 5370)
@@ -1,288 +0,0 @@
-<?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>
- <properties>
- <jbosscache-pojo-version>2.1.0.CR4</jbosscache-pojo-version>
- <jbosscache-core-version>2.1.0.CR3</jbosscache-core-version>
- <jboss.aop.version>2.0.0.CR3</jboss.aop.version>
- </properties>
- <parent>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-common-parent</artifactId>
- <version>1.1</version>
- </parent>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-pojo</artifactId>
- <version>${jbosscache-pojo-version}</version>
- <name>JBoss Cache - POJO Edition</name>
- <description>JBoss Cache - POJO Edition</description>
- <packaging>jar</packaging>
- <dependencies>
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <version>${jboss.aop.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>${jbosscache-core-version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>${jbosscache-core-version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <!-- Hack AOP has broken deps -->
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- <version>2.0.0.Beta4</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-1</version>
- <executions>
- <execution>
- <id>assemble</id>
- <phase>install</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>assembly/bin.xml</descriptor>
- <descriptor>assembly/doc.xml</descriptor>
- <descriptor>assembly/all.xml</descriptor>
- </descriptors>
- <finalName>${artifactId}-${jbosscache-pojo-version}</finalName>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>bind.address</name>
- <value>127.0.0.1</value>
- </property>
- <property>
- <name>java.net.preferIPv4Stack</name>
- <value>true</value>
- </property>
- <property>
- <name>jgroups.stack</name>
- <value>udp</value>
- </property>
- </systemProperties>
- <groups>functional</groups>
- <forkMode>always</forkMode>
- <argLine>-Djboss.aop.path=${basedir}/src/main/resources/META-INF/pojocache-aop.xml -javaagent:${settings.localRepository}/org/jboss/aop/jboss-aop/${jboss.aop.version}/jboss-aop-${jboss.aop.version}.jar</argLine>
- <!-- Warning, this does not work right on 2.4-SNAPSHOT, (see SUREFIRE-349) -->
- <!-- This seems to fail in some cases on 2.3 as well, disable for now -->
- <useSystemClassLoader>true</useSystemClassLoader>
- <redirectTestOutputToFile>false</redirectTestOutputToFile>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jbossaop-plugin</artifactId>
- <version>2.0.0.beta1</version>
- <!-- HACK: AOP project and plugin has broken deps -->
- <dependencies>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>${jbosscache-core-version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <version>${jboss.aop.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>aopc</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <verbose>false</verbose>
- <aoppaths>
- <aoppath>${basedir}/src/main/resources/META-INF/pojocache-aop.xml</aoppath>
- </aoppaths>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- the docbook generation plugin for the user guide -->
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.0.0</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-doc-xslt-support</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- <executions>
-
- <!-- The User Guide-->
- <execution>
- <id>userguide_en</id>
- <phase>package</phase>
- <goals>
- <goal>resources</goal>
- <goal>generate</goal>
- </goals>
- <configuration>
- <sourceDocumentName>master.xml</sourceDocumentName>
- <sourceDirectory>${basedir}/src/main/docbook/userguide/en</sourceDirectory>
- <imageResource>
- <directory>${basedir}/src/main/docbook/images</directory>
- </imageResource>
- <cssResource>
- <directory>${basedir}/src/main/docbook/css</directory>
- </cssResource>
- <targetDirectory>${basedir}/target/docbook/userguide_en</targetDirectory>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/standard/fopdf.xsl</stylesheetResource>
- <finalName>userguide_en.pdf</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/standard/html_chunk.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/standard/html.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>false</xincludeSupported>
- </options>
- </configuration>
- </execution>
-
- <!-- The Tutorial -->
- <execution>
- <id>tutorial_en</id>
- <phase>package</phase>
- <goals>
- <goal>resources</goal>
- <goal>generate</goal>
- </goals>
- <configuration>
- <sourceDocumentName>master.xml</sourceDocumentName>
- <sourceDirectory>${basedir}/src/main/docbook/tutorial/en</sourceDirectory>
- <imageResource>
- <directory>${basedir}/src/main/docbook/images</directory>
- </imageResource>
- <cssResource>
- <directory>${basedir}/src/main/docbook/css</directory>
- </cssResource>
- <targetDirectory>${basedir}/target/docbook/tutorial_en</targetDirectory>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/standard/fopdf.xsl</stylesheetResource>
- <finalName>tutorial_en.pdf</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/standard/html_chunk.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/standard/html.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>false</xincludeSupported>
- </options>
- </configuration>
- </execution>
-
- <!-- the FAQs -->
- <execution>
- <id>faq_en</id>
- <phase>package</phase>
- <goals>
- <goal>resources</goal>
- <goal>generate</goal>
- </goals>
- <configuration>
- <sourceDocumentName>master.xml</sourceDocumentName>
- <sourceDirectory>${basedir}/src/main/docbook/faq/en</sourceDirectory>
- <imageResource>
- <directory>${basedir}/src/main/docbook/images</directory>
- </imageResource>
- <cssResource>
- <directory>${basedir}/src/main/docbook/css</directory>
- </cssResource>
- <targetDirectory>${basedir}/target/docbook/faq_en</targetDirectory>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/standard/fopdf.xsl</stylesheetResource>
- <finalName>faq_en.pdf</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/standard/html_chunk.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/standard/html.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>false</xincludeSupported>
- </options>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <!-- basic JBoss repository so that the common parent POM in jbosscache-support can be found -->
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <url>http://repository.jboss.org/maven2</url>
- </repository>
- </repositories>
-</project>
Copied: pojo/tags/2.1.0.CR4/pom.xml (from rev 5369, pojo/branches/2.1/pom.xml)
===================================================================
--- pojo/tags/2.1.0.CR4/pom.xml (rev 0)
+++ pojo/tags/2.1.0.CR4/pom.xml 2008-02-21 04:28:29 UTC (rev 5370)
@@ -0,0 +1,292 @@
+<?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>
+ <properties>
+ <jbosscache-pojo-version>2.1.0.CR4</jbosscache-pojo-version>
+ <jbosscache-core-version>2.1.0.CR4</jbosscache-core-version>
+ <jboss.aop.version>2.0.0.CR3</jboss.aop.version>
+ </properties>
+ <parent>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-common-parent</artifactId>
+ <version>1.1</version>
+ </parent>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-pojo</artifactId>
+ <version>${jbosscache-pojo-version}</version>
+ <name>JBoss Cache - POJO Edition</name>
+ <description>JBoss Cache - POJO Edition</description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <version>${jboss.aop.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>${jbosscache-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>${jbosscache-core-version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ <version>1.0</version>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-1</version>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>install</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/bin.xml</descriptor>
+ <descriptor>assembly/doc.xml</descriptor>
+ <descriptor>assembly/all.xml</descriptor>
+ </descriptors>
+ <finalName>${artifactId}-${jbosscache-pojo-version}</finalName>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
+ </systemProperties>
+ <groups>functional</groups>
+ <forkMode>always</forkMode>
+ <argLine>-Djboss.aop.path=${basedir}/src/main/resources/META-INF/pojocache-aop.xml -javaagent:${settings.localRepository}/org/jboss/aop/jboss-aop/${jboss.aop.version}/jboss-aop-${jboss.aop.version}.jar</argLine>
+ <!-- Warning, this does not work right on 2.4-SNAPSHOT, (see SUREFIRE-349) -->
+ <!-- This seems to fail in some cases on 2.3 as well, disable for now -->
+ <useSystemClassLoader>true</useSystemClassLoader>
+ <redirectTestOutputToFile>false</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jbossaop-plugin</artifactId>
+ <version>2.0.0.beta1</version>
+ <!-- HACK: AOP project and plugin has broken deps -->
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>${jbosscache-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <version>${jboss.aop.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>aopc</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <verbose>false</verbose>
+ <aoppaths>
+ <aoppath>${basedir}/src/main/resources/META-INF/pojocache-aop.xml</aoppath>
+ </aoppaths>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- the docbook generation plugin for the user guide -->
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.0.0</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-doc-xslt-support</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <executions>
+
+ <!-- The User Guide-->
+ <execution>
+ <id>userguide_en</id>
+ <phase>package</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main/docbook/userguide/en</sourceDirectory>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/images</directory>
+ </imageResource>
+ <cssResource>
+ <directory>${basedir}/src/main/docbook/css</directory>
+ </cssResource>
+ <targetDirectory>${basedir}/target/docbook/userguide_en</targetDirectory>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/standard/fopdf.xsl</stylesheetResource>
+ <finalName>userguide_en.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/standard/html_chunk.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/standard/html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>false</xincludeSupported>
+ </options>
+ </configuration>
+ </execution>
+
+ <!-- The Tutorial -->
+ <execution>
+ <id>tutorial_en</id>
+ <phase>package</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main/docbook/tutorial/en</sourceDirectory>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/images</directory>
+ </imageResource>
+ <cssResource>
+ <directory>${basedir}/src/main/docbook/css</directory>
+ </cssResource>
+ <targetDirectory>${basedir}/target/docbook/tutorial_en</targetDirectory>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/standard/fopdf.xsl</stylesheetResource>
+ <finalName>tutorial_en.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/standard/html_chunk.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/standard/html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>false</xincludeSupported>
+ </options>
+ </configuration>
+ </execution>
+
+ <!-- the FAQs -->
+ <execution>
+ <id>faq_en</id>
+ <phase>package</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main/docbook/faq/en</sourceDirectory>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/images</directory>
+ </imageResource>
+ <cssResource>
+ <directory>${basedir}/src/main/docbook/css</directory>
+ </cssResource>
+ <targetDirectory>${basedir}/target/docbook/faq_en</targetDirectory>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/standard/fopdf.xsl</stylesheetResource>
+ <finalName>faq_en.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/standard/html_chunk.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/standard/html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>false</xincludeSupported>
+ </options>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- basic JBoss repository so that the common parent POM in jbosscache-support can be found -->
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+</project>
Deleted: pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java
===================================================================
--- pojo/branches/2.1/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2008-02-20 16:57:50 UTC (rev 5362)
+++ pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2008-02-21 04:28:29 UTC (rev 5370)
@@ -1,270 +0,0 @@
-/*
- *
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo;
-
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Random;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
-
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.lock.UpgradeException;
-import org.jboss.cache.misc.TestingUtil;
-import org.jboss.cache.pojo.test.Address;
-import org.jboss.cache.pojo.test.Person;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-
-/**
- * Local concurrent test for PojoCache. Test attach and detach under load
- * and concurrency.
- *
- * @version $Revision$
- * @author<a href="mailto:bwang at jboss.org">Ben Wang</a> December 2004
- */
- at Test(groups = {"functional"}, enabled = false)
-public class LocalConcurrentTest
-{
- static PojoCache cache_;
- Configuration.CacheMode cachingMode_ = Configuration.CacheMode.LOCAL;
- Properties p_;
- String oldFactory_ = null;
- final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
- static ArrayList<String> nodeList_;
- static final int depth_ = 2;
- static final int children_ = 2;
- static final int MAX_LOOP = 100;
- static final int SLEEP_TIME = 50;
- static Exception thread_ex = null;
- UserTransaction tx_ = null;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
- {
- oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
- DummyTransactionManager.getInstance();
- if (p_ == null)
- {
- p_ = new Properties();
- p_.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
- }
-
- tx_ = (UserTransaction) new InitialContext(p_).lookup("UserTransaction");
-
- initCaches(Configuration.CacheMode.LOCAL);
- nodeList_ = nodeGen(depth_, children_);
-
- log("LocalConcurrentTestCase: cacheMode=TRANSIENT, one cache");
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- thread_ex = null;
- DummyTransactionManager.destroy();
- destroyCaches();
-
- if (oldFactory_ != null)
- {
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, oldFactory_);
- oldFactory_ = null;
- }
-
- }
-
- void initCaches(Configuration.CacheMode caching_mode) throws Exception
- {
- cachingMode_ = caching_mode;
- boolean toStart = false;
- cache_ = PojoCacheFactory.createCache("META-INF/local-service.xml", toStart);
- cache_.start();
- }
-
- void destroyCaches() throws Exception
- {
- cache_.stop();
- cache_ = null;
- }
-
- public void testAll_RWLock() throws Exception
- {
- try
- {
- all();
- }
- catch (UpgradeException ue)
- {
- log("Upgrade exception. Can ingore for repeatable read. " + ue);
- }
- catch (Exception ex)
- {
- log("Exception: " + ex);
- throw ex;
- }
- }
-
- private void all() throws Exception
- {
- RunThread t1 = new RunThread(1);
- RunThread t2 = new RunThread(2);
- RunThread t3 = new RunThread(3);
- RunThread t4 = new RunThread(4);
-
- t1.start();
- TestingUtil.sleepThread(100);
- t2.start();
- TestingUtil.sleepThread(100);
- t3.start();
- TestingUtil.sleepThread(100);
- t4.start();
-
- t1.join(60000);// wait for 20 secs
- t2.join(60000);// wait for 20 secs
- t3.join(60000);// wait for 20 secs
- t4.join(60000);// wait for 20 secs
-
- if (thread_ex != null)
- {
- throw thread_ex;
- }
- }
-
- class RunThread extends Thread
- {
- final int seed_;
- Random random_;
- Person person_;
-
- public RunThread(int seed)
- {
- seed_ = seed;
- random_ = new Random(seed);
- }
-
- private void createPerson()
- {
- person_ = new Person();
- person_.setName("Ben");
- person_.setAge(18);
- ArrayList<String> lang = new ArrayList<String>();
- lang.add("English");
- lang.add("French");
- lang.add("Mandarin");
- person_.setLanguages(lang);
- Address addr = new Address();
- addr.setZip(95123);
- addr.setStreet("Almeria");
- addr.setCity("San Jose");
- person_.setAddress(addr);
- }
-
- public void run()
- {
- try
- {
- _run();
- }
- catch (Exception e)
- {
- thread_ex = e;
- }
- }
-
- /**
- */
- public void _run() throws Exception
- {
- for (int loop = 0; loop < MAX_LOOP; loop++)
- {
- createPerson();// create a new person instance every loop.
- TestingUtil.sleepThread(random_.nextInt(50));
- op1();
- }
- }
-
- // Operation 1
- private void op1()
- {
- int i = random_.nextInt(nodeList_.size() - 1);
- if (i == 0) return;// it is meaningless to test root
- String node = nodeList_.get(i) + "/aop";
- cache_.attach(node, person_);
- TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME));// sleep for max 200 millis
- TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME));// sleep for max 200 millis
- cache_.detach(node);
- }
- }
-
- /**
- * Generate the tree nodes quasi-exponentially. I.e., depth is the level
- * of the hierarchy and children is the number of children under each node.
- * This strucutre is used to add, get, and remove for each node.
- */
- private ArrayList<String> nodeGen(int depth, int children)
- {
- ArrayList<String> strList = new ArrayList<String>();
- ArrayList<String> oldList = new ArrayList<String>();
- ArrayList<String> newList = new ArrayList<String>();
-
- // Skip root node
- oldList.add("/");
- newList.add("/");
- strList.add("/");
-
- while (depth > 0)
- {
- // Trying to produce node name at this depth.
- newList = new ArrayList<String>();
- for (int i = 0; i < oldList.size(); i++)
- {
- for (int j = 0; j < children; j++)
- {
- String tmp = oldList.get(i);
- tmp += Integer.toString(j);
- if (depth != 1)
- {
- tmp += "/";
- }
-
- newList.add(tmp);
- }
- }
- strList.addAll(newList);
- oldList = newList;
- depth--;
- }
-
- // let's prune out root node
- for (int i = 0; i < strList.size(); i++)
- {
- if (strList.get(i).equals("/"))
- {
- strList.remove(i);
- break;
- }
- }
- log("Nodes generated: " + strList.size());
- return strList;
- }
-
-
- private static void log(String str)
- {
- System.out.println("Thread: " + Thread.currentThread() + ": " + str);
- // System.out.println(str);
- }
-
-}
Copied: pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java (from rev 5369, pojo/branches/2.1/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java)
===================================================================
--- pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java (rev 0)
+++ pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/LocalConcurrentTest.java 2008-02-21 04:28:29 UTC (rev 5370)
@@ -0,0 +1,270 @@
+/*
+ *
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.cache.pojo;
+
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.Random;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.lock.UpgradeException;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.pojo.test.Address;
+import org.jboss.cache.pojo.test.Person;
+import org.jboss.cache.transaction.DummyTransactionManager;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+
+/**
+ * Local concurrent test for PojoCache. Test attach and detach under load
+ * and concurrency.
+ *
+ * @version $Revision$
+ * @author<a href="mailto:bwang at jboss.org">Ben Wang</a> December 2004
+ */
+ at Test(groups = {"functional"})
+public class LocalConcurrentTest
+{
+ static PojoCache cache_;
+ Configuration.CacheMode cachingMode_ = Configuration.CacheMode.LOCAL;
+ Properties p_;
+ String oldFactory_ = null;
+ final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
+ static ArrayList<String> nodeList_;
+ static final int depth_ = 2;
+ static final int children_ = 2;
+ static final int MAX_LOOP = 100;
+ static final int SLEEP_TIME = 50;
+ static Exception thread_ex = null;
+ UserTransaction tx_ = null;
+
+ @BeforeMethod(alwaysRun = true)
+ public void setUp() throws Exception
+ {
+ oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
+ DummyTransactionManager.getInstance();
+ if (p_ == null)
+ {
+ p_ = new Properties();
+ p_.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
+ }
+
+ tx_ = (UserTransaction) new InitialContext(p_).lookup("UserTransaction");
+
+ initCaches(Configuration.CacheMode.LOCAL);
+ nodeList_ = nodeGen(depth_, children_);
+
+ log("LocalConcurrentTestCase: cacheMode=TRANSIENT, one cache");
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown() throws Exception
+ {
+ thread_ex = null;
+ DummyTransactionManager.destroy();
+ destroyCaches();
+
+ if (oldFactory_ != null)
+ {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, oldFactory_);
+ oldFactory_ = null;
+ }
+
+ }
+
+ void initCaches(Configuration.CacheMode caching_mode) throws Exception
+ {
+ cachingMode_ = caching_mode;
+ boolean toStart = false;
+ cache_ = PojoCacheFactory.createCache("META-INF/local-service.xml", toStart);
+ cache_.start();
+ }
+
+ void destroyCaches() throws Exception
+ {
+ cache_.stop();
+ cache_ = null;
+ }
+
+ public void testAll_RWLock() throws Exception
+ {
+ try
+ {
+ all();
+ }
+ catch (UpgradeException ue)
+ {
+ log("Upgrade exception. Can ingore for repeatable read. " + ue);
+ }
+ catch (Exception ex)
+ {
+ log("Exception: " + ex);
+ throw ex;
+ }
+ }
+
+ private void all() throws Exception
+ {
+ RunThread t1 = new RunThread(1);
+ RunThread t2 = new RunThread(2);
+ RunThread t3 = new RunThread(3);
+ RunThread t4 = new RunThread(4);
+
+ t1.start();
+ TestingUtil.sleepThread(100);
+ t2.start();
+ TestingUtil.sleepThread(100);
+ t3.start();
+ TestingUtil.sleepThread(100);
+ t4.start();
+
+ t1.join(60000);// wait for 20 secs
+ t2.join(60000);// wait for 20 secs
+ t3.join(60000);// wait for 20 secs
+ t4.join(60000);// wait for 20 secs
+
+ if (thread_ex != null)
+ {
+ throw thread_ex;
+ }
+ }
+
+ class RunThread extends Thread
+ {
+ final int seed_;
+ Random random_;
+ Person person_;
+
+ public RunThread(int seed)
+ {
+ seed_ = seed;
+ random_ = new Random(seed);
+ }
+
+ private void createPerson()
+ {
+ person_ = new Person();
+ person_.setName("Ben");
+ person_.setAge(18);
+ ArrayList<String> lang = new ArrayList<String>();
+ lang.add("English");
+ lang.add("French");
+ lang.add("Mandarin");
+ person_.setLanguages(lang);
+ Address addr = new Address();
+ addr.setZip(95123);
+ addr.setStreet("Almeria");
+ addr.setCity("San Jose");
+ person_.setAddress(addr);
+ }
+
+ public void run()
+ {
+ try
+ {
+ _run();
+ }
+ catch (Exception e)
+ {
+ thread_ex = e;
+ }
+ }
+
+ /**
+ */
+ public void _run() throws Exception
+ {
+ for (int loop = 0; loop < MAX_LOOP; loop++)
+ {
+ createPerson();// create a new person instance every loop.
+ TestingUtil.sleepThread(random_.nextInt(50));
+ op1();
+ }
+ }
+
+ // Operation 1
+ private void op1()
+ {
+ int i = random_.nextInt(nodeList_.size() - 1);
+ if (i == 0) return;// it is meaningless to test root
+ String node = nodeList_.get(i) + "/aop";
+ cache_.attach(node, person_);
+ TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME));// sleep for max 200 millis
+ TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME));// sleep for max 200 millis
+ cache_.detach(node);
+ }
+ }
+
+ /**
+ * Generate the tree nodes quasi-exponentially. I.e., depth is the level
+ * of the hierarchy and children is the number of children under each node.
+ * This strucutre is used to add, get, and remove for each node.
+ */
+ private ArrayList<String> nodeGen(int depth, int children)
+ {
+ ArrayList<String> strList = new ArrayList<String>();
+ ArrayList<String> oldList = new ArrayList<String>();
+ ArrayList<String> newList = new ArrayList<String>();
+
+ // Skip root node
+ oldList.add("/");
+ newList.add("/");
+ strList.add("/");
+
+ while (depth > 0)
+ {
+ // Trying to produce node name at this depth.
+ newList = new ArrayList<String>();
+ for (int i = 0; i < oldList.size(); i++)
+ {
+ for (int j = 0; j < children; j++)
+ {
+ String tmp = oldList.get(i);
+ tmp += Integer.toString(j);
+ if (depth != 1)
+ {
+ tmp += "/";
+ }
+
+ newList.add(tmp);
+ }
+ }
+ strList.addAll(newList);
+ oldList = newList;
+ depth--;
+ }
+
+ // let's prune out root node
+ for (int i = 0; i < strList.size(); i++)
+ {
+ if (strList.get(i).equals("/"))
+ {
+ strList.remove(i);
+ break;
+ }
+ }
+ log("Nodes generated: " + strList.size());
+ return strList;
+ }
+
+
+ private static void log(String str)
+ {
+ System.out.println("Thread: " + Thread.currentThread() + ": " + str);
+ // System.out.println(str);
+ }
+
+}
Deleted: pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java
===================================================================
--- pojo/branches/2.1/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2008-02-20 16:57:50 UTC (rev 5362)
+++ pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2008-02-21 04:28:29 UTC (rev 5370)
@@ -1,268 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.region;
-
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Random;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.lock.UpgradeException;
-import org.jboss.cache.misc.TestingUtil;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.test.Address;
-import org.jboss.cache.pojo.test.Person;
-import org.jboss.cache.transaction.DummyTransactionManager;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- * Local concurrent test for PojoCache. Test attach and detach under load
- * and concurrency.
- *
- * @version $Revision$
- * @author<a href="mailto:bwang at jboss.org">Ben Wang</a> December 2004
- */
- at Test(groups = {"functional"}, enabled = false)
-public class LocalConcurrentTest
-{
- static PojoCache cache_;
- Properties p_;
- String oldFactory_ = null;
- final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
- static ArrayList<String> nodeList_;
- static final int depth_ = 2;
- static final int children_ = 2;
- static final int MAX_LOOP = 100;
- static final int SLEEP_TIME = 50;
- static Exception thread_ex = null;
- UserTransaction tx_ = null;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
- {
- oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
- DummyTransactionManager.getInstance();
- if (p_ == null)
- {
- p_ = new Properties();
- p_.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
- }
-
- tx_ = (UserTransaction) new InitialContext(p_).lookup("UserTransaction");
-
- initCaches();
- nodeList_ = nodeGen(depth_, children_);
-
- log("LocalConcurrentTestCase: cacheMode=TRANSIENT, one cache");
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- thread_ex = null;
- DummyTransactionManager.destroy();
- destroyCaches();
-
- if (oldFactory_ != null)
- {
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, oldFactory_);
- oldFactory_ = null;
- }
-
- }
-
- void initCaches() throws Exception
- {
- boolean toStart = false;
- cache_ = PojoCacheFactory.createCache("META-INF/local-service.xml", toStart);
- cache_.start();
- }
-
- void destroyCaches() throws Exception
- {
- cache_.stop();
- cache_ = null;
- }
-
- public void testAll_RWLock() throws Exception
- {
- try
- {
- all();
- }
- catch (UpgradeException ue)
- {
- log("Upgrade exception. Can ingore for repeatable read. " + ue);
- }
- catch (Exception ex)
- {
- log("Exception: " + ex);
- throw ex;
- }
- }
-
- private void all() throws Exception
- {
- RunThread t1 = new RunThread(1, "t1");
- RunThread t2 = new RunThread(2, "t2");
- RunThread t3 = new RunThread(3, "t3");
- RunThread t4 = new RunThread(4, "t4");
-
- t1.start();
- TestingUtil.sleepThread(100);
- t2.start();
- TestingUtil.sleepThread(100);
- t3.start();
- TestingUtil.sleepThread(100);
- t4.start();
-
- t1.join(60000); // wait for 20 secs
- t2.join(60000); // wait for 20 secs
- t3.join(60000); // wait for 20 secs
- t4.join(60000); // wait for 20 secs
-
- if (thread_ex != null)
- throw thread_ex;
- }
-
- class RunThread extends Thread
- {
- final int seed_;
- Random random_;
- Person person_;
-
- public RunThread(int seed, String threadName)
- {
- super(threadName);
- seed_ = seed;
- random_ = new Random(seed);
- }
-
- private void createPerson()
- {
- person_ = new Person();
- person_.setName("Ben");
- person_.setAge(18);
- ArrayList<String> lang = new ArrayList<String>();
- lang.add("English");
- lang.add("French");
- lang.add("Mandarin");
- person_.setLanguages(lang);
- Address addr = new Address();
- addr.setZip(95123);
- addr.setStreet("Almeria");
- addr.setCity("San Jose");
- person_.setAddress(addr);
- }
-
- public void run()
- {
- try
- {
- cache_.getCache().getRegion(Fqn.fromString(Thread.currentThread().getName()), true);
- _run();
- }
- catch (Exception e)
- {
- thread_ex = e;
- }
- }
-
- /**
- */
- public void _run() throws Exception
- {
- for (int loop = 0; loop < MAX_LOOP; loop++)
- {
- createPerson(); // create a new person instance every loop.
- op1();
- }
- }
-
- // Operation 1
- private void op1()
- {
- int i = random_.nextInt(nodeList_.size() - 1);
- if (i == 0) return; // it is meaningless to test root
- String node = nodeList_.get(i) + "/aop";
- cache_.attach(node, person_);
- TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME)); // sleep for max 200 millis
- TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME)); // sleep for max 200 millis
- cache_.detach(node);
- }
- }
-
- /**
- * Generate the tree nodes quasi-exponentially. I.e., depth is the level
- * of the hierarchy and children is the number of children under each node.
- * This strucutre is used to add, get, and remove for each node.
- */
- private ArrayList<String> nodeGen(int depth, int children)
- {
- ArrayList<String> strList = new ArrayList<String>();
- ArrayList<String> oldList = new ArrayList<String>();
- ArrayList<String> newList = new ArrayList<String>();
-
- // Skip root node
- String str = Thread.currentThread().getName();
- oldList.add(str);
- newList.add(str);
- strList.add(str);
-
- while (depth > 0)
- {
- // Trying to produce node name at this depth.
- newList = new ArrayList<String>();
- for (int i = 0; i < oldList.size(); i++)
- {
- for (int j = 0; j < children; j++)
- {
- String tmp = oldList.get(i);
- tmp += Integer.toString(j);
- if (depth != 1)
- {
- tmp += "/";
- }
-
- newList.add(tmp);
- }
- }
- strList.addAll(newList);
- oldList = newList;
- depth--;
- }
-
- // let's prune out root node
- for (int i = 0; i < strList.size(); i++)
- {
- if (strList.get(i).equals("/"))
- {
- strList.remove(i);
- break;
- }
- }
- log("Nodes generated: " + strList.size());
- return strList;
- }
-
-
- private static void log(String str)
- {
- System.out.println("Thread: " + Thread.currentThread() + ": " + str);
-// System.out.println(str);
- }
-
-}
Copied: pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java (from rev 5369, pojo/branches/2.1/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java)
===================================================================
--- pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java (rev 0)
+++ pojo/tags/2.1.0.CR4/src/test/java/org/jboss/cache/pojo/region/LocalConcurrentTest.java 2008-02-21 04:28:29 UTC (rev 5370)
@@ -0,0 +1,268 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.cache.pojo.region;
+
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.Random;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.lock.UpgradeException;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.pojo.PojoCache;
+import org.jboss.cache.pojo.PojoCacheFactory;
+import org.jboss.cache.pojo.test.Address;
+import org.jboss.cache.pojo.test.Person;
+import org.jboss.cache.transaction.DummyTransactionManager;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Local concurrent test for PojoCache. Test attach and detach under load
+ * and concurrency.
+ *
+ * @version $Revision$
+ * @author<a href="mailto:bwang at jboss.org">Ben Wang</a> December 2004
+ */
+ at Test(groups = {"functional"})
+public class LocalConcurrentTest
+{
+ static PojoCache cache_;
+ Properties p_;
+ String oldFactory_ = null;
+ final String FACTORY = "org.jboss.cache.transaction.DummyContextFactory";
+ static ArrayList<String> nodeList_;
+ static final int depth_ = 2;
+ static final int children_ = 2;
+ static final int MAX_LOOP = 100;
+ static final int SLEEP_TIME = 50;
+ static Exception thread_ex = null;
+ UserTransaction tx_ = null;
+
+ @BeforeMethod(alwaysRun = true)
+ public void setUp() throws Exception
+ {
+ oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
+ DummyTransactionManager.getInstance();
+ if (p_ == null)
+ {
+ p_ = new Properties();
+ p_.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
+ }
+
+ tx_ = (UserTransaction) new InitialContext(p_).lookup("UserTransaction");
+
+ initCaches();
+ nodeList_ = nodeGen(depth_, children_);
+
+ log("LocalConcurrentTestCase: cacheMode=TRANSIENT, one cache");
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown() throws Exception
+ {
+ thread_ex = null;
+ DummyTransactionManager.destroy();
+ destroyCaches();
+
+ if (oldFactory_ != null)
+ {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, oldFactory_);
+ oldFactory_ = null;
+ }
+
+ }
+
+ void initCaches() throws Exception
+ {
+ boolean toStart = false;
+ cache_ = PojoCacheFactory.createCache("META-INF/local-service.xml", toStart);
+ cache_.start();
+ }
+
+ void destroyCaches() throws Exception
+ {
+ cache_.stop();
+ cache_ = null;
+ }
+
+ public void testAll_RWLock() throws Exception
+ {
+ try
+ {
+ all();
+ }
+ catch (UpgradeException ue)
+ {
+ log("Upgrade exception. Can ingore for repeatable read. " + ue);
+ }
+ catch (Exception ex)
+ {
+ log("Exception: " + ex);
+ throw ex;
+ }
+ }
+
+ private void all() throws Exception
+ {
+ RunThread t1 = new RunThread(1, "t1");
+ RunThread t2 = new RunThread(2, "t2");
+ RunThread t3 = new RunThread(3, "t3");
+ RunThread t4 = new RunThread(4, "t4");
+
+ t1.start();
+ TestingUtil.sleepThread(100);
+ t2.start();
+ TestingUtil.sleepThread(100);
+ t3.start();
+ TestingUtil.sleepThread(100);
+ t4.start();
+
+ t1.join(60000); // wait for 20 secs
+ t2.join(60000); // wait for 20 secs
+ t3.join(60000); // wait for 20 secs
+ t4.join(60000); // wait for 20 secs
+
+ if (thread_ex != null)
+ throw thread_ex;
+ }
+
+ class RunThread extends Thread
+ {
+ final int seed_;
+ Random random_;
+ Person person_;
+
+ public RunThread(int seed, String threadName)
+ {
+ super(threadName);
+ seed_ = seed;
+ random_ = new Random(seed);
+ }
+
+ private void createPerson()
+ {
+ person_ = new Person();
+ person_.setName("Ben");
+ person_.setAge(18);
+ ArrayList<String> lang = new ArrayList<String>();
+ lang.add("English");
+ lang.add("French");
+ lang.add("Mandarin");
+ person_.setLanguages(lang);
+ Address addr = new Address();
+ addr.setZip(95123);
+ addr.setStreet("Almeria");
+ addr.setCity("San Jose");
+ person_.setAddress(addr);
+ }
+
+ public void run()
+ {
+ try
+ {
+ cache_.getCache().getRegion(Fqn.fromString(Thread.currentThread().getName()), true);
+ _run();
+ }
+ catch (Exception e)
+ {
+ thread_ex = e;
+ }
+ }
+
+ /**
+ */
+ public void _run() throws Exception
+ {
+ for (int loop = 0; loop < MAX_LOOP; loop++)
+ {
+ createPerson(); // create a new person instance every loop.
+ op1();
+ }
+ }
+
+ // Operation 1
+ private void op1()
+ {
+ int i = random_.nextInt(nodeList_.size() - 1);
+ if (i == 0) return; // it is meaningless to test root
+ String node = nodeList_.get(i) + "/aop";
+ cache_.attach(node, person_);
+ TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME)); // sleep for max 200 millis
+ TestingUtil.sleepThread(random_.nextInt(SLEEP_TIME)); // sleep for max 200 millis
+ cache_.detach(node);
+ }
+ }
+
+ /**
+ * Generate the tree nodes quasi-exponentially. I.e., depth is the level
+ * of the hierarchy and children is the number of children under each node.
+ * This strucutre is used to add, get, and remove for each node.
+ */
+ private ArrayList<String> nodeGen(int depth, int children)
+ {
+ ArrayList<String> strList = new ArrayList<String>();
+ ArrayList<String> oldList = new ArrayList<String>();
+ ArrayList<String> newList = new ArrayList<String>();
+
+ // Skip root node
+ String str = Thread.currentThread().getName();
+ oldList.add(str);
+ newList.add(str);
+ strList.add(str);
+
+ while (depth > 0)
+ {
+ // Trying to produce node name at this depth.
+ newList = new ArrayList<String>();
+ for (int i = 0; i < oldList.size(); i++)
+ {
+ for (int j = 0; j < children; j++)
+ {
+ String tmp = oldList.get(i);
+ tmp += Integer.toString(j);
+ if (depth != 1)
+ {
+ tmp += "/";
+ }
+
+ newList.add(tmp);
+ }
+ }
+ strList.addAll(newList);
+ oldList = newList;
+ depth--;
+ }
+
+ // let's prune out root node
+ for (int i = 0; i < strList.size(); i++)
+ {
+ if (strList.get(i).equals("/"))
+ {
+ strList.remove(i);
+ break;
+ }
+ }
+ log("Nodes generated: " + strList.size());
+ return strList;
+ }
+
+
+ private static void log(String str)
+ {
+ System.out.println("Thread: " + Thread.currentThread() + ": " + str);
+// System.out.println(str);
+ }
+
+}
Copied: pojo/tags/2.1.0.CR4/src/test/resources/META-INF (from rev 5369, pojo/branches/2.1/src/test/resources/META-INF)
Copied: pojo/tags/2.1.0.CR4/src/test/resources/log4j.xml (from rev 5369, pojo/branches/2.1/src/test/resources/log4j.xml)
===================================================================
--- pojo/tags/2.1.0.CR4/src/test/resources/log4j.xml (rev 0)
+++ pojo/tags/2.1.0.CR4/src/test/resources/log4j.xml 2008-02-21 04:28:29 UTC (rev 5370)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 5286 2008-02-01 12:13:53Z mircea.markus $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="output/jbosscache.log"/>
+ <param name="Append" value="true"/>
+
+ <!-- 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="DEBUG"/>
+
+ <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>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <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.jboss.cache">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jboss.tm">
+ <priority value="WARN"/>
+ </category>
+
+ <category name="org.jgroups">
+ <priority value="WARN"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--<appender-ref ref="CONSOLE"/>-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
More information about the jbosscache-commits
mailing list