[Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBoss TS - MQ recovery integration tests
by adrian@jboss.org
No there are no tests for this in the testsuite since at the time I wrote
this JBossTM was integrated into the main build.
The tests in the testsuite deploy a second copy of JBossMQ into JBossAS
that I can reboot and test recovery using the XAResource api directly.
i.e. they are unit tests not integration tests.
The only test I have is in a private ant project that uses the
JMSProviderXAResourceRecovery
with the following change in jbossjta-properties.xml
| <property name="com.arjuna.ats.jta.recovery.XAResourceRecoveryJMS=org.jboss.jta.recovery.jms.JMSProviderXAResourceRecovery;DefaultJMSProvider"/>
|
It also includes a subclass of the persistence manager
so I can force the server to crash during commit
| /*
| * JBoss, Home of Professional Open Source
| * Copyright 2006, JBoss Inc., and individual contributors as indicated
| * by the @authors tag. See the copyright.txt 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.jboss.test.jbossmq;
|
| import javax.jms.JMSException;
|
| import org.jboss.mq.pm.Tx;
| import org.jboss.mq.pm.jdbc2.PersistenceManager;
|
| public class TestPersistenceManager extends PersistenceManager implements TestPersistenceManagerMBean
| {
| private boolean crashInCommit = false;
|
| public TestPersistenceManager() throws JMSException
| {
| }
|
| public boolean getCrashInCommit()
| {
| return crashInCommit;
| }
|
| public void makeCrashInCommit(boolean crashInCommit)
| {
| this.crashInCommit = crashInCommit;
| }
|
| public void commitPersistentTx(Tx txId) throws JMSException
| {
| if (crashInCommit)
| {
| System.out.println("I'm going to crash in 20 seconds");
| try
| {
| Thread.sleep(20000);
| }
| catch (Exception ignored) {}
| Runtime.getRuntime().halt(0);
| }
| else
| super.commitPersistentTx(txId);
| }
| }
|
The sleep is just to workaround the fact that hypersonic doesn't
persist data to its transaction log synchronously
It does it on a timer every 10 seconds. UGLY! :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005805#4005805
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005805
17 years, 8 months
[Design the new POJO MicroContainer] - Re: Property replacement
by adrian@jboss.org
None of the property editors should be doing system property replacement.
The best way to fix this and maintain backwards compatibility is the following
diff in ValueConvertor.
| [ejort@warjort plugins]$ svn diff ValueConvertor.java
| Index: ValueConvertor.java
| ===================================================================
| --- ValueConvertor.java (revision 59913)
| +++ ValueConvertor.java (working copy)
| @@ -31,6 +31,7 @@
| import org.jboss.reflect.plugins.introspection.ReflectionUtils;
| import org.jboss.reflect.spi.ProgressionConvertor;
| import org.jboss.reflect.spi.ProgressionConvertorFactory;
| +import org.jboss.util.StringPropertyReplacer;
| import org.jboss.util.propertyeditor.PropertyEditors;
|
| /**
| @@ -69,15 +70,37 @@
| * @return the value or null if there is no editor
| * @throws Throwable for any error
| */
| - @SuppressWarnings("unchecked")
| public static Object convertValue(Class<? extends Object> clazz, Object value) throws Throwable
| {
| + return convertValue(clazz, value, false);
| + }
| +
| + /**
| + * Convert a value
| + *
| + * @param clazz the class
| + * @param value the value
| + * @param replaceProperties whether to replace system properties
| + * @return the value or null if there is no editor
| + * @throws Throwable for any error
| + */
| + @SuppressWarnings("unchecked")
| + public static Object convertValue(Class<? extends Object> clazz, Object value, boolean replaceProperties) throws Throwable
| + {
| if (clazz == null)
| throw new IllegalArgumentException("Null class");
| if (value == null)
| return null;
|
| Class<? extends Object> valueClass = value.getClass();
| +
| + // If we have a string replace any system properties when requested
| + if (replaceProperties && valueClass == String.class)
| + {
| + String string = (String) value;
| + value = StringPropertyReplacer.replaceProperties(string);
| + }
| +
| if (clazz.isAssignableFrom(valueClass))
| return value;
|
Then add the following new method to TypeInfo
that invokes the alternative method in ValueConvertor
| /**
| * Convert a value
| *
| * @param value the original value
| * @param replaceProperties whether to replace properties
| * @return the converted value
| * @throws Throwable for any error
| */
| Object convertValue(Object value, boolean replaceProperties) throws Throwable;
|
The StringValueMetaData should be invoking this new method.
Finally, it would be good if StringValueMetaData also had an additional
parameter to turn off string property replace (like the JMX stuff does)
e.g. (but also for other places that take a "value")
| <!-- This property is not replaced -->
| <property name="blah" replace="false">${hello}</property>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005799#4005799
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005799
17 years, 8 months