Upgrade to xbean 3.3-SNAPSHOT to pull in the fix for:

http://issues.apache.org/jira/browse/XBEAN-101
PropertyPlaceholderConfigurer can not be used to resolve values assigned to xbean properties that have a custom PropertyEditor



git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@610502 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2008-01-09 18:44:34 +00:00
parent 3163d48eb1
commit b39430ab17
4 changed files with 151 additions and 1 deletions

View File

@ -0,0 +1,80 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.memory;
import java.io.File;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.xbean.BrokerFactoryBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import junit.framework.TestCase;
public class MemoryPropertyTest extends TestCase {
private static final transient Log LOG = LogFactory.getLog(MemoryPropertyTest.class);
BrokerService broker;
/**
* Sets up a test where the producer and consumer have their own connection.
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
// Create broker from resource
LOG.info("Creating broker... ");
broker = createBroker("xbean:org/apache/activemq/memory/activemq.xml");
LOG.info("Success");
super.setUp();
}
protected BrokerService createBroker(String resource) throws Exception {
return BrokerFactory.createBroker(resource);
}
/*
* Stops the Broker
*
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
LOG.info("Closing Broker");
if (broker != null) {
broker.stop();
}
LOG.info("Broker closed...");
}
public void testBrokerInitialized() {
assertTrue("We should have a broker", broker != null);
assertEquals("test-broker", broker.getBrokerName());
assertEquals(1024, broker.getSystemUsage().getMemoryUsage().getLimit());
assertEquals(34, broker.getSystemUsage().getMemoryUsage().getPercentUsageMinDelta());
}
}

View File

@ -0,0 +1,51 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="org/apache/activemq/memory/usage.properties"/>
</bean>
<broker xmlns="http://activemq.org/config/1.0" brokerName="${name}" persistent="false">
<!-- Use the following to set the broker memory limit -->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="${limit}" percentUsageMinDelta="${delta}"/>
</memoryUsage>
<tempUsage>
<tempUsage limit="100 mb"/>
</tempUsage>
<storeUsage>
<storeUsage limit="1 gb" name="foo"/>
</storeUsage>
</systemUsage>
</systemUsage>
</broker>
</beans>
<!-- END SNIPPET: example -->

View File

@ -0,0 +1,19 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
limit=1k
name=test-broker
delta=34

View File

@ -73,7 +73,7 @@
<xmlbeans-version>2.0.0-beta1</xmlbeans-version>
<xmlpull-version>1.1.3.4d_b4_min</xmlpull-version>
<xstream-version>1.1.2</xstream-version>
<xbean-version>3.2-SNAPSHOT</xbean-version>
<xbean-version>3.3-SNAPSHOT</xbean-version>
<felix-version>1.0.0</felix-version>
<dist-repo-url>scpexe://people.apache.org/www/people.apache.org/repo/m2-incubating-repository</dist-repo-url>
<m1-dist-repo-url>scpexe://people.apache.org/www/people.apache.org/repo/m1-snapshot-repository</m1-dist-repo-url>