diff options
author | Kim van der Riet <kpvdr@apache.org> | 2012-08-27 15:40:33 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2012-08-27 15:40:33 +0000 |
commit | 868ce7469262d6fd2fe3f2e7f04cfe7af654d59f (patch) | |
tree | 63e6b5e62554609beb21e8c8d0610569f36d2743 /java | |
parent | 2e5ff8f1b328831043e6d7e323249d62187234c6 (diff) | |
download | qpid-python-868ce7469262d6fd2fe3f2e7f04cfe7af654d59f.tar.gz |
QPID-3858: Updated code to include recent refactoring by Gordon (gsim) - see QPID-4178.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1377715 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
70 files changed, 1143 insertions, 1440 deletions
diff --git a/java/.gitignore b/java/.gitignore index 36097e3820..417b51f12d 100644 --- a/java/.gitignore +++ b/java/.gitignore @@ -1,2 +1,20 @@ +# +# 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. +# *.swp eclipse-projects/* diff --git a/java/amqp-1-0-client-jms/README.txt b/java/amqp-1-0-client-jms/README.txt new file mode 100644 index 0000000000..eac8344aac --- /dev/null +++ b/java/amqp-1-0-client-jms/README.txt @@ -0,0 +1,12 @@ +Documentation +============= + +You can access documentation for the client via our website at: +http://qpid.apache.org/documentation + +and via our wiki at: +http://cwiki.apache.org/confluence/display/qpid/Qpid+Java+Documentation + +The client uses the Java Message Service (JMS) 1.1 API, information on which is +widely available using your favoured search engine. + diff --git a/java/amqp-1-0-client-jms/build.xml b/java/amqp-1-0-client-jms/build.xml index 82d5aa5c7a..cfc6e0babe 100644 --- a/java/amqp-1-0-client-jms/build.xml +++ b/java/amqp-1-0-client-jms/build.xml @@ -22,8 +22,19 @@ <property name="module.genpom" value="true"/> <property name="module.depends" value="amqp-1-0-common amqp-1-0-client"/> + <property name="module.genpom.args" value="-Sgeronimo-jms_1.1_spec=provided"/> + <target name="release-bin-copy-readme"> + <copy todir="${module.release}" overwrite="true" failonerror="true"> + <fileset file="${basedir}/README.txt" /> + </copy> + </target> + + <target name="release-bin-other" depends="release-bin-copy-readme"/> + + <target name="release-bin" depends="release-bin-tasks"/> + <import file="../module.xml"/> </project> diff --git a/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java b/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java new file mode 100644 index 0000000000..03dd7c66a8 --- /dev/null +++ b/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java @@ -0,0 +1,132 @@ +/* + * 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.qpid.server.management.plugin.servlet.rest; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.apache.qpid.server.model.ConfiguredObject; +import org.apache.qpid.server.model.Model; +import org.apache.qpid.server.model.Statistics; + +public class ConfiguredObjectToMapConverter +{ + /** Name of the key used for the statistics map */ + public static final String STATISTICS_MAP_KEY = "statistics"; + + private Model _model = Model.getInstance(); + + public Map<String, Object> convertObjectToMap(final ConfiguredObject confObject, + Class<? extends ConfiguredObject> clazz, + int depth) + { + Map<String, Object> object = new LinkedHashMap<String, Object>(); + + incorporateAttributesIntoMap(confObject, object); + incorporateStatisticsIntoMap(confObject, object); + + if(depth > 0) + { + incorporateChildrenIntoMap(confObject, clazz, depth, object); + } + return object; + } + + /** + * Used for unit test only. + */ + void setModel(Model model) + { + _model = model; + } + + private void incorporateAttributesIntoMap( + final ConfiguredObject confObject, Map<String, Object> object) + { + for(String name : confObject.getAttributeNames()) + { + Object value = confObject.getAttribute(name); + if(value instanceof ConfiguredObject) + { + object.put(name, ((ConfiguredObject) value).getName()); + } + else if(value != null) + { + object.put(name, value); + } + } + } + + private void incorporateStatisticsIntoMap( + final ConfiguredObject confObject, Map<String, Object> object) + { + Statistics statistics = confObject.getStatistics(); + Map<String, Object> statMap = new HashMap<String, Object>(); + + if (statistics != null) + { + for(String name : statistics.getStatisticNames()) + { + Object value = statistics.getStatistic(name); + if(value != null) + { + statMap.put(name, value); + } + } + + if(!statMap.isEmpty()) + { + object.put(STATISTICS_MAP_KEY, statMap); + } + } + } + + private void incorporateChildrenIntoMap( + final ConfiguredObject confObject, + Class<? extends ConfiguredObject> clazz, int depth, + Map<String, Object> object) + { + for(Class<? extends ConfiguredObject> childClass : _model.getChildTypes(clazz)) + { + Collection<? extends ConfiguredObject> children = confObject.getChildren(childClass); + if(children != null) + { + List<Map<String, Object>> childObjects = new ArrayList<Map<String, Object>>(); + + for(ConfiguredObject child : children) + { + childObjects.add(convertObjectToMap(child, childClass, depth-1)); + } + + if(!childObjects.isEmpty()) + { + object.put(childClass.getSimpleName().toLowerCase()+"s",childObjects); + } + } + } + } + + + +} diff --git a/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java b/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java index 593377beed..6a79916d07 100644 --- a/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java +++ b/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java @@ -16,9 +16,9 @@ */ package org.apache.qpid.server.management.plugin.servlet.rest; +import java.io.BufferedWriter; import java.io.IOException; -import java.io.PrintWriter; -import java.net.SocketAddress; +import java.io.Writer; import java.util.*; import javax.servlet.ServletConfig; import javax.servlet.ServletException; @@ -49,6 +49,8 @@ public class RestServlet extends AbstractServlet private volatile boolean initializationRequired = false; + private final ConfiguredObjectToMapConverter _objectConverter = new ConfiguredObjectToMapConverter(); + public RestServlet() { super(); @@ -133,7 +135,7 @@ public class RestServlet extends AbstractServlet for(int i = 0; i < _hierarchy.length; i++) { - if(i == 0 || Model.getChildTypes(_hierarchy[i - 1]).contains(_hierarchy[i])) + if(i == 0 || Model.getInstance().getChildTypes(_hierarchy[i - 1]).contains(_hierarchy[i])) { for(ConfiguredObject parent : parents) @@ -257,7 +259,7 @@ public class RestServlet extends AbstractServlet ConfiguredObject child) { Collection<ConfiguredObject> ancestors = new HashSet<ConfiguredObject>(); - Collection<Class<? extends ConfiguredObject>> parentTypes = Model.getParentTypes(childType); + Collection<Class<? extends ConfiguredObject>> parentTypes = Model.getInstance().getParentTypes(childType); for(Class<? extends ConfiguredObject> parentClazz : parentTypes) { @@ -282,119 +284,33 @@ public class RestServlet extends AbstractServlet return ancestors; } - - protected Map<String, Object> convertObjectToMap(final ConfiguredObject confObject, - Class<? extends ConfiguredObject> clazz, - int depth) - { - Map<String, Object> object = new LinkedHashMap<String, Object>(); - - for(String name : confObject.getAttributeNames()) - { - Object value = confObject.getAttribute(name); - if(value instanceof ConfiguredObject) - { - object.put(name, ((ConfiguredObject) value).getName()); - } - else if(value != null) - { - object.put(name, value); - } - } - - Statistics statistics = confObject.getStatistics(); - Map<String, Object> statMap = new HashMap<String, Object>(); - for(String name : statistics.getStatisticNames()) - { - Object value = statistics.getStatistic(name); - if(value != null) - { - statMap.put(name, value); - } - } - - if(!statMap.isEmpty()) - { - object.put("statistics", statMap); - } - - if(depth > 0) - { - for(Class<? extends ConfiguredObject> childClass : Model.getChildTypes(clazz)) - { - Collection<? extends ConfiguredObject> children = confObject.getChildren(childClass); - if(children != null) - { - List<Map<String, Object>> childObjects = new ArrayList<Map<String, Object>>(); - - for(ConfiguredObject child : children) - { - childObjects.add(convertObjectToMap(child, childClass, depth-1)); - } - - if(!childObjects.isEmpty()) - { - object.put(childClass.getSimpleName().toLowerCase()+"s",childObjects); - } - } - } - } - return object; - } - @Override protected void onGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); response.setStatus(HttpServletResponse.SC_OK); - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); + setCachingHeadersOnResponse(response); Collection<ConfiguredObject> allObjects = getObjects(request); - @SuppressWarnings("unchecked") - Map params = new HashMap(request.getParameterMap()); - - int depth = 1; - try - { - depth = Integer.parseInt(String.valueOf(params.remove("depth"))); - } - catch (NumberFormatException e) - { - // Ignore - } + // TODO - sort special params, everything else should act as a filter + int depth = getDepthParameterFromRequest(request); List<Map<String, Object>> output = new ArrayList<Map<String, Object>>(); - - // TODO - depth and sort special params, everything else should act as a filter - if(request.getParameter(DEPTH_PARAM)!=null) - { - try - { - depth = Integer.parseInt(request.getParameter(DEPTH_PARAM)); - } - catch (NumberFormatException e) - { - - } - } - for(ConfiguredObject configuredObject : allObjects) { - output.add(convertObjectToMap(configuredObject, getConfiguredClass(),depth)); + output.add(_objectConverter.convertObjectToMap(configuredObject, getConfiguredClass(), + depth)); } - final PrintWriter writer = response.getWriter(); + final Writer writer = new BufferedWriter(response.getWriter()); ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); mapper.writeValue(writer, output); response.setContentType("application/json"); response.setStatus(HttpServletResponse.SC_OK); - } private Class<? extends ConfiguredObject> getConfiguredClass() @@ -462,7 +378,7 @@ public class RestServlet extends AbstractServlet { for(int j = i-1; j >=0; j--) { - if(Model.getChildTypes(_hierarchy[j]).contains(_hierarchy[i])) + if(Model.getInstance().getChildTypes(_hierarchy[j]).contains(_hierarchy[i])) { for(ConfiguredObject parent : objects[j]) { @@ -482,7 +398,7 @@ public class RestServlet extends AbstractServlet } List<ConfiguredObject> parents = new ArrayList<ConfiguredObject>(); Class<? extends ConfiguredObject> objClass = getConfiguredClass(); - Collection<Class<? extends ConfiguredObject>> parentClasses = Model.getParentTypes(objClass); + Collection<Class<? extends ConfiguredObject>> parentClasses = Model.getInstance().getParentTypes(objClass); for(int i = _hierarchy.length-2; i >=0 ; i--) { if(parentClasses.contains(_hierarchy[i])) @@ -565,9 +481,7 @@ public class RestServlet extends AbstractServlet response.setContentType("application/json"); response.setStatus(HttpServletResponse.SC_OK); - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); + setCachingHeadersOnResponse(response); try { Collection<ConfiguredObject> allObjects = getObjects(request); @@ -583,4 +497,31 @@ public class RestServlet extends AbstractServlet setResponseStatus(response, e); } } + + private void setCachingHeadersOnResponse(HttpServletResponse response) + { + response.setHeader("Cache-Control","no-cache"); + response.setHeader("Pragma","no-cache"); + response.setDateHeader ("Expires", 0); + } + + private int getDepthParameterFromRequest(HttpServletRequest request) + { + int depth = 1; + final String depthString = request.getParameter(DEPTH_PARAM); + if(depthString!=null) + { + try + { + depth = Integer.parseInt(depthString); + } + catch (NumberFormatException e) + { + LOGGER.warn("Could not parse " + depthString + " as integer"); + } + } + return depth; + } + + } diff --git a/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java b/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java index e4ba374f89..60f977ca66 100644 --- a/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java +++ b/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java @@ -73,7 +73,7 @@ public class StructureServlet extends AbstractServlet structure.put("id", object.getId()); structure.put("name", object.getName()); - for(Class<? extends ConfiguredObject> childClass : Model.getChildTypes(clazz)) + for(Class<? extends ConfiguredObject> childClass : Model.getInstance().getChildTypes(clazz)) { Collection<? extends ConfiguredObject> children = object.getChildren(childClass); if(children != null) diff --git a/java/broker-plugins/management-http/src/main/java/resources/showBroker.html b/java/broker-plugins/management-http/src/main/java/resources/showBroker.html index a39e334c40..f8d80faba8 100644 --- a/java/broker-plugins/management-http/src/main/java/resources/showBroker.html +++ b/java/broker-plugins/management-http/src/main/java/resources/showBroker.html @@ -1,3 +1,23 @@ +<!-- + - + - 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. + - + --> <div class="broker"> <span>Name:</span><span class="broker-name" style="position:absolute; left:6em"></span> <br/> diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/AuthenticationProviderRestTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/AuthenticationProviderRestTest.java index 37bc2733b0..5e6d9a998a 100644 --- a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/AuthenticationProviderRestTest.java +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/AuthenticationProviderRestTest.java @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.management.plugin.servlet.rest; import java.util.List; diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/BindingRestTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/BindingRestTest.java index 527eb16927..1ed0d97185 100644 --- a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/BindingRestTest.java +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/BindingRestTest.java @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.management.plugin.servlet.rest; import java.net.HttpURLConnection; diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java new file mode 100644 index 0000000000..8e5c5e1c10 --- /dev/null +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java @@ -0,0 +1,141 @@ +/* + * 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.qpid.server.management.plugin.servlet.rest; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.STATISTICS_MAP_KEY; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import junit.framework.TestCase; + +import org.apache.qpid.server.model.ConfiguredObject; +import org.apache.qpid.server.model.Model; +import org.apache.qpid.server.model.Statistics; + +public class ConfiguredObjectToMapConverterTest extends TestCase +{ + private ConfiguredObjectToMapConverter _converter = new ConfiguredObjectToMapConverter(); + private ConfiguredObject _configuredObject = mock(ConfiguredObject.class); + + @Override + protected void setUp() throws Exception + { + super.setUp(); + } + + public void testConfiguredObjectWithSingleStatistics() throws Exception + { + final String statisticName = "statisticName"; + final int statisticValue = 10; + + Statistics mockStatistics = createMockStatistics(statisticName, statisticValue); + when(_configuredObject.getStatistics()).thenReturn(mockStatistics); + + Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0); + Map<String, Object> statsAsMap = (Map<String, Object>) resultMap.get(STATISTICS_MAP_KEY); + assertNotNull("Statistics should be part of map", statsAsMap); + assertEquals("Unexpected number of statistics", 1, statsAsMap.size()); + assertEquals("Unexpected statistic value", statisticValue, statsAsMap.get(statisticName)); + } + + public void testConfiguredObjectWithSingleNonConfiguredObjectAttribute() throws Exception + { + final String attributeName = "attribute"; + final String attributeValue = "value"; + configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue); + + Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0); + assertEquals("Unexpected number of attributes", 1, resultMap.size()); + assertEquals("Unexpected attribute value", attributeValue, resultMap.get(attributeName)); + } + + /* + * For now, it is the name of the configured object is returned as the attribute value, rather than the + * configured object itself + */ + public void testConfiguredObjectWithSingleConfiguredObjectAttribute() throws Exception + { + final String attributeName = "attribute"; + final ConfiguredObject attributeValue = mock(ConfiguredObject.class); + when(attributeValue.getName()).thenReturn("attributeConfiguredObjectName"); + + configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue); + + Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 0); + assertEquals("Unexpected number of attributes", 1, resultMap.size()); + assertEquals("Unexpected attribute value", "attributeConfiguredObjectName", resultMap.get(attributeName)); + } + + public void testConfiguredObjectWithChildAndDepth1() + { + final String childAttributeName = "childattribute"; + final String childAttributeValue = "childvalue"; + + Model model = createTestModel(); + _converter.setModel(model); + + TestChild mockChild = mock(TestChild.class); + configureMockToReturnOneAttribute(mockChild, childAttributeName, childAttributeValue); + when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild)); + + Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, ConfiguredObject.class, 1); + assertEquals("Unexpected parent map size", 1, resultMap.size()); + + final List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds"); + assertEquals("Unexpected number of children", 1, childList.size()); + final Map<String, Object> childMap = childList.get(0); + assertEquals("Unexpected child map size", 1, childMap.size()); + assertNotNull(childMap); + + assertEquals("Unexpected child attribute value", childAttributeValue, childMap.get(childAttributeName)); + } + + private Model createTestModel() + { + Model model = mock(Model.class); + final List<Class<? extends ConfiguredObject>> list = new ArrayList<Class<? extends ConfiguredObject>>(); + list.add(TestChild.class); + when(model.getChildTypes(ConfiguredObject.class)).thenReturn(list); + return model; + } + + private void configureMockToReturnOneAttribute(ConfiguredObject mockConfiguredObject, String attributeName, Object attributeValue) + { + when(mockConfiguredObject.getAttributeNames()).thenReturn(Arrays.asList(attributeName)); + when(mockConfiguredObject.getAttribute(attributeName)).thenReturn(attributeValue); + } + + private Statistics createMockStatistics(String statName, int statValue) + { + Statistics mockStatistics = mock(Statistics.class); + when(mockStatistics.getStatisticNames()).thenReturn(Arrays.asList(statName)); + when(mockStatistics.getStatistic(statName)).thenReturn(statValue); + return mockStatistics; + } + + private static interface TestChild extends ConfiguredObject + { + } +} diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java index 59936427f9..4904d2adf3 100644 --- a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ExchangeRestTest.java @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.management.plugin.servlet.rest; import java.net.URLDecoder; diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/PortRestTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/PortRestTest.java index 49f163baae..739ef5c737 100644 --- a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/PortRestTest.java +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/PortRestTest.java @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.management.plugin.servlet.rest; import java.net.URLDecoder; diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslRestTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslRestTest.java index 943466eda7..b504c9fa60 100644 --- a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslRestTest.java +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslRestTest.java @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.management.plugin.servlet.rest; import java.util.List; diff --git a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/UserRestTest.java b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/UserRestTest.java index 378b349a99..e56fa27e21 100644 --- a/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/UserRestTest.java +++ b/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/UserRestTest.java @@ -1,3 +1,23 @@ +/* + * + * 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.qpid.server.management.plugin.servlet.rest; import java.net.HttpURLConnection; diff --git a/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java b/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java index 49f06d5121..a2a0d2d093 100644 --- a/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java +++ b/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java @@ -22,6 +22,7 @@ package org.apache.qpid.server.jmx; import org.apache.log4j.Logger; +import org.apache.qpid.server.logging.LogActor; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.actors.ManagementActor; import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; @@ -38,6 +39,7 @@ import javax.management.MBeanServer; import javax.management.Notification; import javax.management.NotificationListener; import javax.management.ObjectName; +import javax.management.RuntimeErrorException; import javax.management.remote.JMXConnectionNotification; import javax.management.remote.JMXPrincipal; import javax.management.remote.MBeanServerForwarder; @@ -48,6 +50,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.security.AccessControlContext; import java.security.AccessController; +import java.util.Arrays; import java.util.Map; import java.util.Set; @@ -157,77 +160,98 @@ public class MBeanInvocationHandlerImpl implements InvocationHandler, Notificati // Save the subject SecurityManager.setThreadSubject(subject); - - // Get the component, type and impact, which may be null - String type = getType(method, args); - String vhost = getVirtualHost(method, args); - int impact = getImpact(method, args); - - // Get the security manager for the virtual host (if set) - SecurityManager security; - if (vhost == null) + CurrentActor.set(_logActor); + try { - security = _appRegistry.getSecurityManager(); + return authoriseAndInvoke(method, args); } - else + finally { - security = _appRegistry.getVirtualHostRegistry().getVirtualHost(vhost).getSecurityManager(); + CurrentActor.remove(); } + } + catch (InvocationTargetException e) + { + Throwable targetException = e.getCause(); + logTargetException(method, args, targetException); + throw targetException; + } + } - methodName = getMethodName(method, args); - if (isAccessMethod(methodName) || impact == MBeanOperationInfo.INFO) - { - // Check for read-only method invocation permission - if (!security.authoriseMethod(Operation.ACCESS, type, methodName)) - { - throw new SecurityException("Permission denied: Access " + methodName); - } - } - else - { - // Check for setting properties permission - if (!security.authoriseMethod(Operation.UPDATE, type, methodName)) - { - throw new SecurityException("Permission denied: Update " + methodName); - } - } + private void logTargetException(Method method, Object[] args, Throwable targetException) + { + Throwable error = null; + if (targetException instanceof RuntimeErrorException) + { + error = ((RuntimeErrorException)targetException).getCause(); + } + else if (targetException instanceof Error) + { + error = targetException; + } + if (error == null) + { + _logger.debug("Exception was thrown on invoking of " + method + " with arguments " + Arrays.toString(args), targetException); + } + else + { + _logger.error("Unexpected error occured on invoking of " + method + " with arguments " + Arrays.toString(args), targetException); + } + } - boolean oldAccessChecksDisabled = false; - if(_managementRightsInferAllAccess) - { - oldAccessChecksDisabled = SecurityManager.setAccessChecksDisabled(true); - } + private Object authoriseAndInvoke(Method method, Object[] args) throws IllegalAccessException, InvocationTargetException + { + String methodName; + // Get the component, type and impact, which may be null + String type = getType(method, args); + String vhost = getVirtualHost(method, args); + int impact = getImpact(method, args); + + // Get the security manager for the virtual host (if set) + SecurityManager security; + if (vhost == null) + { + security = _appRegistry.getSecurityManager(); + } + else + { + security = _appRegistry.getVirtualHostRegistry().getVirtualHost(vhost).getSecurityManager(); + } - try + methodName = getMethodName(method, args); + if (isAccessMethod(methodName) || impact == MBeanOperationInfo.INFO) + { + // Check for read-only method invocation permission + if (!security.authoriseMethod(Operation.ACCESS, type, methodName)) { - return doInvokeWrappingWithManagementActor(method, args); + throw new SecurityException("Permission denied: Access " + methodName); } - finally + } + else + { + // Check for setting properties permission + if (!security.authoriseMethod(Operation.UPDATE, type, methodName)) { - if(_managementRightsInferAllAccess) - { - SecurityManager.setAccessChecksDisabled(oldAccessChecksDisabled); - } + throw new SecurityException("Permission denied: Update " + methodName); } } - catch (InvocationTargetException e) + + boolean oldAccessChecksDisabled = false; + if(_managementRightsInferAllAccess) { - throw e.getTargetException(); + oldAccessChecksDisabled = SecurityManager.setAccessChecksDisabled(true); } - } - private Object doInvokeWrappingWithManagementActor(Method method, - Object[] args) throws IllegalAccessException, - InvocationTargetException - { try { - CurrentActor.set(_logActor); return method.invoke(_mbs, args); } finally { - CurrentActor.remove(); + if(_managementRightsInferAllAccess) + { + SecurityManager.setAccessChecksDisabled(oldAccessChecksDisabled); + } } } @@ -368,14 +392,17 @@ public class MBeanInvocationHandlerImpl implements InvocationHandler, Notificati user = splitConnectionId[1]; } + // use a separate instance of actor as subject is not set on connect/disconnect + // we need to pass principal name explicitly into log actor + LogActor logActor = new ManagementActor(_appRegistry.getRootMessageLogger(), user); if (JMXConnectionNotification.OPENED.equals(type)) { - _logActor.message(ManagementConsoleMessages.OPEN(user)); + logActor.message(ManagementConsoleMessages.OPEN(user)); } else if (JMXConnectionNotification.CLOSED.equals(type) || JMXConnectionNotification.FAILED.equals(type)) { - _logActor.message(ManagementConsoleMessages.CLOSE(user)); + logActor.message(ManagementConsoleMessages.CLOSE(user)); } } } diff --git a/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/ManagementLogActorTest.java b/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/ManagementLogActorTest.java new file mode 100644 index 0000000000..c1df9afc5d --- /dev/null +++ b/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/ManagementLogActorTest.java @@ -0,0 +1,170 @@ +/* + * + * 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.qpid.server.jmx; + +import java.util.HashMap; +import java.util.Map; + +import javax.management.JMException; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.XMLConfiguration; +import org.apache.qpid.server.configuration.ServerConfiguration; +import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin; +import org.apache.qpid.server.logging.actors.CurrentActor; +import org.apache.qpid.server.registry.ApplicationRegistry; +import org.apache.qpid.server.security.Result; +import org.apache.qpid.server.security.SecurityPlugin; +import org.apache.qpid.server.security.access.ObjectProperties; +import org.apache.qpid.server.security.access.ObjectType; +import org.apache.qpid.server.security.access.Operation; +import org.apache.qpid.server.util.TestApplicationRegistry; +import org.apache.qpid.test.utils.QpidTestCase; + +public class ManagementLogActorTest extends QpidTestCase +{ + private ApplicationRegistry _registry; + private JMXManagedObjectRegistry _objectRegistry; + private int _registryPort; + private int _connectorPort; + private TestPlugin _plugin; + + @Override + public void setUp() throws Exception + { + super.setUp(); + + _registryPort = findFreePort(); + _connectorPort = getNextAvailable(_registryPort + 1); + XMLConfiguration config = new XMLConfiguration(); + config.addProperty(ServerConfiguration.MGMT_JMXPORT_REGISTRYSERVER, _registryPort + ""); + config.addProperty(ServerConfiguration.MGMT_JMXPORT_CONNECTORSERVER, _connectorPort + ""); + _registry = new TestApplicationRegistry(new ServerConfiguration(config)); + ApplicationRegistry.initialise(_registry); + + _plugin = new TestPlugin(); + _registry.getSecurityManager().addHostPlugin(_plugin); + + _objectRegistry = new JMXManagedObjectRegistry(); + new TestMBean(_objectRegistry); + _objectRegistry.start(); + } + + public void tearDown() throws Exception + { + _objectRegistry.close(); + ApplicationRegistry.remove(); + super.tearDown(); + } + + public void testPrincipalInLogMessage() throws Throwable + { + Map<String, Object> environment = new HashMap<String, Object>(); + environment.put(JMXConnector.CREDENTIALS, new String[] { "admin", "admin" }); + String urlString = "service:jmx:rmi:///jndi/rmi://localhost:" + _registryPort + "/jmxrmi"; + JMXServiceURL url = new JMXServiceURL(urlString); + JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment); + MBeanServerConnection mbsc = jmxConnector.getMBeanServerConnection(); + ObjectName mbeanObject = new ObjectName("org.apache.qpid:type=TestMBean,name=test"); + + String actorLogMessage = (String) mbsc.getAttribute(mbeanObject, "ActorLogMessage"); + + assertTrue("Unexpected log principal in security plugin", _plugin.getLogMessage().startsWith("[mng:admin")); + assertTrue("Unexpected log principal in MBean", actorLogMessage.startsWith("[mng:admin")); + } + + public static class TestMBean extends DefaultManagedObject implements CurrentActorRetriever + { + + public TestMBean(ManagedObjectRegistry registry) throws JMException + { + super(CurrentActorRetriever.class, "TestMBean", registry); + register(); + } + + @Override + public String getObjectInstanceName() + { + return "test"; + } + + @Override + public ManagedObject getParentObject() + { + return null; + } + + @Override + public String getActorLogMessage() + { + return CurrentActor.get().getLogMessage(); + } + + } + + public static interface CurrentActorRetriever + { + String getActorLogMessage(); + } + + public static class TestPlugin implements SecurityPlugin + { + private String _logMessage; + + @Override + public void configure(ConfigurationPlugin config) throws ConfigurationException + { + } + + @Override + public Result getDefault() + { + return Result.ALLOWED; + } + + @Override + public Result access(ObjectType objectType, Object instance) + { + return Result.ALLOWED; + } + + @Override + public Result authorise(Operation operation, ObjectType objectType, ObjectProperties properties) + { + // set thread name to work around logic in MangementActor + Thread.currentThread().setName("RMI TCP Connection(1)-" + System.currentTimeMillis()); + _logMessage = CurrentActor.get().getLogMessage(); + return Result.ALLOWED; + } + + public String getLogMessage() + { + return _logMessage; + } + + } + +} diff --git a/java/broker/etc/broker_example.acl b/java/broker/etc/broker_example.acl index 1f32f8463e..45a48bda09 100644 --- a/java/broker/etc/broker_example.acl +++ b/java/broker/etc/broker_example.acl @@ -18,6 +18,7 @@ # ### EXAMPLE ACL V2 FILE +### NOTE: Rules are considered from top to bottom, and the first matching rule governs the decision. ### DEFINE GROUPS ### @@ -27,30 +28,30 @@ GROUP messaging-users client server #Define a group for management web console users GROUP webadmins webadmin -### MANAGEMENT #### +### JMX MANAGEMENT #### # Allow everyone to perform read operations on the ServerInformation mbean # This is used for items such as querying the management API and broker release versions. -ACL ALLOW-LOG ALL ACCESS METHOD component="ServerInformation" +ACL ALLOW ALL ACCESS METHOD component="ServerInformation" -# Allow 'admin' all management operations +# Allow 'admin' all management operations. To reduce log file noise, only non-read-only operations are logged. +ACL ALLOW admin ACCESS METHOD ACL ALLOW-LOG admin ALL METHOD +# Allow 'guest' to view logger levels, and use getter methods on LoggingManagement +ACL ALLOW guest ACCESS METHOD component="LoggingManagement" name="viewEffectiveRuntimeLoggerLevels" +ACL ALLOW guest ACCESS METHOD component="LoggingManagement" name="get*" + # Deny access to Shutdown, UserManagement, ConfigurationManagement and LoggingManagement for all other users -# You could grant specific users access to these beans by adding ALLOW-LOG rules above for them +# You could grant specific users access to these beans by adding rules above to allow them ACL DENY-LOG ALL ACCESS METHOD component="Shutdown" ACL DENY-LOG ALL ACCESS METHOD component="UserManagement" ACL DENY-LOG ALL ACCESS METHOD component="ConfigurationManagement" ACL DENY-LOG ALL ACCESS METHOD component="LoggingManagement" -# Allow 'guest' to view logger levels, and use getter methods on LoggingManagement -# These are examples of redundant rules! The DENY-LOG rule above will be invoked -# first and will deny the access to all methods of LoggingManagement for guest -ACL ALLOW-LOG guest ACCESS METHOD component="LoggingManagement" name="viewEffectiveRuntimeLoggerLevels" -ACL ALLOW-LOG guest ACCESS METHOD component="LoggingManagement" name="get*" - -# Allow everyone to perform all read operations on the mbeans not listened in the DENY-LOG rules above -ACL ALLOW-LOG ALL ACCESS METHOD +# Allow everyone to perform all read operations (using ALLOW rather than ALLOW-LOG to reduce log file noise) +# on the mbeans not listed in the DENY rules above +ACL ALLOW ALL ACCESS METHOD ### MESSAGING ### diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java index 9cd3c66629..a2f3506502 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java @@ -30,16 +30,7 @@ import java.text.MessageFormat; import java.util.Set; /** - * NOTE: This actor is not thread safe. - * - * Sharing of a ManagementActor instance between threads may result in an - * incorrect actor value being logged. - * - * This is due to the fact that calls to message will dynamically query the - * thread name and use that to set the log format during each message() call. - * - * This is currently not an issue as each MBean operation creates a new Actor - * that is unique for each operation. + * Management actor to use in {@link MBeanInvocationHandlerImpl} to log all management operational logging. */ public class ManagementActor extends AbstractActor { @@ -66,38 +57,45 @@ public class ManagementActor extends AbstractActor /** * The logString to be used for logging */ - private String _logString; + private String _logStringContainingPrincipal; + + /** used when the principal name cannot be discovered from the Subject */ + private final String _fallbackPrincipalName; /** @param rootLogger The RootLogger to use for this Actor */ public ManagementActor(RootMessageLogger rootLogger) { super(rootLogger); + _fallbackPrincipalName = UNKNOWN_PRINCIPAL; + } + + public ManagementActor(RootMessageLogger rootLogger, String principalName) + { + super(rootLogger); + _fallbackPrincipalName = principalName; } - private void updateLogString() + private synchronized String getAndCacheLogString() { String currentName = Thread.currentThread().getName(); String actor; + String logString = _logStringContainingPrincipal; + // Record the last thread name so we don't have to recreate the log string - if (!currentName.equals(_lastThreadName)) + if (_logStringContainingPrincipal == null || !currentName.equals(_lastThreadName)) { _lastThreadName = currentName; + String principalName = getPrincipalName(); // Management Thread names have this format. // RMI TCP Connection(2)-169.24.29.116 // This is true for both LocalAPI and JMX Connections // However to be defensive lets test. - String[] split = currentName.split("\\("); if (split.length == 2) { String ip = currentName.split("-")[1]; - String principalName = getPrincipalName(); - if (principalName == null) - { - principalName = UNKNOWN_PRINCIPAL; - } actor = MessageFormat.format(MANAGEMENT_FORMAT, principalName, ip); } else @@ -111,9 +109,14 @@ public class ManagementActor extends AbstractActor actor = currentName; } - _logString = "[" + actor + "] "; + logString = "[" + actor + "] "; + if(principalName != UNKNOWN_PRINCIPAL ) + { + _logStringContainingPrincipal = logString; + } } + return logString; } /** @@ -121,9 +124,9 @@ public class ManagementActor extends AbstractActor * * @return principal name or null if principal can not be found */ - protected String getPrincipalName() + private String getPrincipalName() { - String identity = null; + String identity = _fallbackPrincipalName; // retrieve Subject from current AccessControlContext final Subject subject = Subject.getSubject(AccessController.getContext()); @@ -142,8 +145,7 @@ public class ManagementActor extends AbstractActor public String getLogMessage() { - updateLogString(); - return _logString; + return getAndCacheLogString(); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/model/Model.java b/java/broker/src/main/java/org/apache/qpid/server/model/Model.java index fd429321c8..36179fc105 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/model/Model.java +++ b/java/broker/src/main/java/org/apache/qpid/server/model/Model.java @@ -29,33 +29,20 @@ import java.util.Map; public class Model { - private static final Map<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>> - PARENTS = new HashMap<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>>(); + private static final Model MODEL_INSTANCE = new Model(); + private final Map<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>> + _parents = new HashMap<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>>(); - private static final Map<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>> - CHILDREN = new HashMap<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>>(); + private final Map<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>> + _children = new HashMap<Class<? extends ConfiguredObject>, Collection<Class<? extends ConfiguredObject>>>(); - static void addRelationship(Class<? extends ConfiguredObject> parent, Class<? extends ConfiguredObject> child) + public static Model getInstance() { - Collection<Class<? extends ConfiguredObject>> parents = PARENTS.get(child); - if(parents == null) - { - parents = new ArrayList<Class<? extends ConfiguredObject>>(); - PARENTS.put(child, parents); - } - parents.add(parent); - - Collection<Class<? extends ConfiguredObject>> children = CHILDREN.get(parent); - if(children == null) - { - children = new ArrayList<Class<? extends ConfiguredObject>>(); - CHILDREN.put(parent, children); - } - children.add(child); + return MODEL_INSTANCE; } - static + private Model() { addRelationship(Broker.class, VirtualHost.class); addRelationship(Broker.class, Port.class); @@ -78,20 +65,39 @@ public class Model addRelationship(Session.class, Consumer.class); addRelationship(Session.class, Publisher.class); - } - public static Collection<Class<? extends ConfiguredObject>> getParentTypes(Class<? extends ConfiguredObject> child) + public Collection<Class<? extends ConfiguredObject>> getParentTypes(Class<? extends ConfiguredObject> child) { - Collection<Class<? extends ConfiguredObject>> parentTypes = PARENTS.get(child); - return parentTypes == null ? Collections.EMPTY_LIST + Collection<Class<? extends ConfiguredObject>> parentTypes = _parents.get(child); + return parentTypes == null ? Collections.<Class<? extends ConfiguredObject>>emptyList() : Collections.unmodifiableCollection(parentTypes); } - public static Collection<Class<? extends ConfiguredObject>> getChildTypes(Class<? extends ConfiguredObject> parent) + public Collection<Class<? extends ConfiguredObject>> getChildTypes(Class<? extends ConfiguredObject> parent) { - Collection<Class<? extends ConfiguredObject>> childTypes = CHILDREN.get(parent); - return childTypes == null ? Collections.EMPTY_LIST + Collection<Class<? extends ConfiguredObject>> childTypes = _children.get(parent); + return childTypes == null ? Collections.<Class<? extends ConfiguredObject>>emptyList() : Collections.unmodifiableCollection(childTypes); } + + private void addRelationship(Class<? extends ConfiguredObject> parent, Class<? extends ConfiguredObject> child) + { + Collection<Class<? extends ConfiguredObject>> parents = _parents.get(child); + if(parents == null) + { + parents = new ArrayList<Class<? extends ConfiguredObject>>(); + _parents.put(child, parents); + } + parents.add(parent); + + Collection<Class<? extends ConfiguredObject>> children = _children.get(parent); + if(children == null) + { + children = new ArrayList<Class<? extends ConfiguredObject>>(); + _children.put(parent, children); + } + children.add(child); + } + } diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/actors/ManagementActorTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/actors/ManagementActorTest.java index b431047d66..cb866245f0 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/actors/ManagementActorTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/actors/ManagementActorTest.java @@ -26,15 +26,6 @@ import java.security.PrivilegedAction; import java.util.Collections; import java.util.List; -/** - * Test : AMQPManagementActorTest - * Validate the AMQPManagementActor class. - * - * The test creates a new AMQPActor and then logs a message using it. - * - * The test then verifies that the logged message was the only one created and - * that the message contains the required message. - */ public class ManagementActorTest extends BaseActorTestCase { @@ -131,4 +122,67 @@ public class ManagementActorTest extends BaseActorTestCase assertTrue("Message contains the [mng: prefix", logMessage.contains("[mng:guest(" + IP + ")")); } + public void testGetLogMessageWithSubject() + { + assertLogMessageInRMIThreadWithPrincipal("RMI TCP Connection(" + CONNECTION_ID + ")-" + IP, "my_principal"); + } + + public void testGetLogMessageWithoutSubjectButWithActorPrincipal() + { + String principalName = "my_principal"; + _amqpActor = new ManagementActor(_rootLogger, principalName); + String message = _amqpActor.getLogMessage(); + assertEquals("Unexpected log message", "[mng:" + principalName + "(" + IP + ")] ", message); + } + + /** It's necessary to test successive calls because ManagementActor caches its log message based on thread and principal name */ + public void testGetLogMessageCaching() + { + String originalThreadName = "RMI TCP Connection(1)-" + IP; + assertLogMessageInRMIThreadWithoutPrincipal(originalThreadName); + assertLogMessageInRMIThreadWithPrincipal(originalThreadName, "my_principal"); + assertLogMessageInRMIThreadWithPrincipal("RMI TCP Connection(2)-" + IP, "my_principal"); + } + + public void testGetLogMessageAfterRemovingSubject() + { + assertLogMessageInRMIThreadWithPrincipal("RMI TCP Connection(1)-" + IP, "my_principal"); + + Thread.currentThread().setName("RMI TCP Connection(2)-" + IP ); + String message = _amqpActor.getLogMessage(); + assertEquals("Unexpected log message", "[mng:N/A(" + IP + ")] ", message); + + assertLogMessageWithoutPrincipal("TEST"); + } + + private void assertLogMessageInRMIThreadWithoutPrincipal(String threadName) + { + Thread.currentThread().setName(threadName ); + String message = _amqpActor.getLogMessage(); + assertEquals("Unexpected log message", "[mng:N/A(" + IP + ")] ", message); + } + + private void assertLogMessageWithoutPrincipal(String threadName) + { + Thread.currentThread().setName(threadName ); + String message = _amqpActor.getLogMessage(); + assertEquals("Unexpected log message", "[" + threadName +"] ", message); + } + + private void assertLogMessageInRMIThreadWithPrincipal(String threadName, String principalName) + { + Thread.currentThread().setName(threadName); + Subject subject = new Subject(true, Collections.singleton(new JMXPrincipal(principalName)), Collections.EMPTY_SET, + Collections.EMPTY_SET); + + final String message = Subject.doAs(subject, new PrivilegedAction<String>() + { + public String run() + { + return _amqpActor.getLogMessage(); + } + }); + + assertEquals("Unexpected log message", "[mng:" + principalName + "(" + IP + ")] ", message); + } } diff --git a/java/build.deps b/java/build.deps index 52ae277ce4..4742ec1a8c 100644 --- a/java/build.deps +++ b/java/build.deps @@ -106,7 +106,7 @@ jca.libs=${geronimo-j2ee} ${geronimo-jta} ${geronimo-jms} ${test.libs} ${geronim jca.test.libs=${test.libs} # optional bdbstore module deps -bdb-je=lib/bdbstore/je-5.0.55.jar +bdb-je=lib/bdbstore/je-5.0.58.jar bdbstore.libs=${bdb-je} bdbstore.test.libs=${test.libs} diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java b/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java index 987404cb80..89273599b9 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java @@ -245,13 +245,13 @@ public class AMQBrokerDetails implements BrokerDetails _options.put(key, value); } - public long getTimeout() + private int lookupConnectTimeout() { if (_options.containsKey(OPTIONS_CONNECT_TIMEOUT)) { try { - return Long.parseLong(_options.get(OPTIONS_CONNECT_TIMEOUT)); + return Integer.parseInt(_options.get(OPTIONS_CONNECT_TIMEOUT)); } catch (NumberFormatException nfe) { @@ -290,11 +290,6 @@ public class AMQBrokerDetails implements BrokerDetails } } - public void setTimeout(long timeout) - { - setProperty(OPTIONS_CONNECT_TIMEOUT, Long.toString(timeout)); - } - public String toString() { StringBuffer sb = new StringBuffer(); @@ -460,6 +455,8 @@ public class AMQBrokerDetails implements BrokerDetails getBooleanProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY,true)); } + conSettings.setConnectTimeout(lookupConnectTimeout()); + return conSettings; } } diff --git a/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java b/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java index 71d7ffd2a3..4a7fca1efa 100644 --- a/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java +++ b/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java @@ -59,7 +59,7 @@ public interface BrokerDetails public static final String URL_FORMAT_EXAMPLE = "<transport>://<hostname>[:<port Default=\"" + DEFAULT_PORT + "\">][?<option>='<value>'[,<option>='<value>']]"; - public static final long DEFAULT_CONNECT_TIMEOUT = 30000L; + public static final int DEFAULT_CONNECT_TIMEOUT = 30000; public static final boolean USE_SSL_DEFAULT = false; // pulled these properties from the new BrokerDetails class in the qpid package @@ -101,10 +101,6 @@ public interface BrokerDetails */ public void setProperties(Map<String,String> props); - long getTimeout(); - - void setTimeout(long timeout); - boolean getBooleanProperty(String propName); String toString(); diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java index 506185cbaf..412c458247 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java @@ -24,6 +24,7 @@ import junit.framework.TestCase; import org.apache.qpid.client.AMQBrokerDetails; import org.apache.qpid.jms.BrokerDetails; +import org.apache.qpid.transport.ConnectionSettings; import org.apache.qpid.url.URLSyntaxException; public class BrokerDetailsTest extends TestCase @@ -49,6 +50,29 @@ public class BrokerDetailsTest extends TestCase assertFalse("value should be false", Boolean.valueOf(broker.getProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY))); } + public void testDefaultConnectTimeout() throws URLSyntaxException + { + String brokerURL = "tcp://localhost:5672"; + AMQBrokerDetails broker = new AMQBrokerDetails(brokerURL); + + ConnectionSettings settings = broker.buildConnectionSettings(); + + assertEquals("unexpected default connect timeout value", BrokerDetails.DEFAULT_CONNECT_TIMEOUT, settings.getConnectTimeout()); + } + + public void testOverridingConnectTimeout() throws URLSyntaxException + { + int timeout = 2 * BrokerDetails.DEFAULT_CONNECT_TIMEOUT; + assertTrue(timeout != BrokerDetails.DEFAULT_CONNECT_TIMEOUT); + + String brokerURL = "tcp://localhost:5672?" + BrokerDetails.OPTIONS_CONNECT_TIMEOUT + "='" + timeout + "'"; + AMQBrokerDetails broker = new AMQBrokerDetails(brokerURL); + + ConnectionSettings settings = broker.buildConnectionSettings(); + + assertEquals("unexpected connect timeout value", timeout, settings.getConnectTimeout()); + } + public void testMultiParameters() throws URLSyntaxException { String url = "tcp://localhost:5672?timeout='200',immediatedelivery='true'"; diff --git a/java/client/test/bin/IBM-JNDI-Setup.bat b/java/client/test/bin/IBM-JNDI-Setup.bat deleted file mode 100644 index eb6a87fa9e..0000000000 --- a/java/client/test/bin/IBM-JNDI-Setup.bat +++ /dev/null @@ -1,69 +0,0 @@ -@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-REM Script to run the Qpid Java Broker
-
-set CMD="IBM-JNDI-Setup.bat"
-set JAVACLASS=
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-set CLIENT_TEST_CLASSES=%QPID_HOME%\lib\client-test-launch.jar
-
-echo on
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" org.apache.qpid.IBMPerfTest.JNDIBindConnectionFactory amqp://guest:guest@clientid/testpath?brokerlist='localhost' amq.ConnectionFactory
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" org.apache.qpid.IBMPerfTest.JNDIBindConnectionFactory amqp://guest:guest@clientid/testpath?brokerlist='vm://:1' amq.VMConnectionFactory
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" org.apache.qpid.IBMPerfTest.JNDIBindQueue amq.Queue direct://amq.direct//IBMPerfQueue1
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic1 topic://amq.topic/IBMPerfTopic1/
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic2 topic://amq.topic/IBMPerfTopic2/
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic3 topic://amq.topic/IBMPerfTopic3/
-
-
-
-:end
-
-pause
\ No newline at end of file diff --git a/java/client/test/bin/IBM-JNDI-Setup.sh b/java/client/test/bin/IBM-JNDI-Setup.sh deleted file mode 100755 index e3112f812d..0000000000 --- a/java/client/test/bin/IBM-JNDI-Setup.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# 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. -# - -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindConnectionFactory amqp://guest:guest@clientid/testpath?brokerlist=\'tcp://localhost\' amq.ConnectionFactory -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindConnectionFactory amqp://guest:guest@clientid/testpath?brokerlist=\'vm://:1\' amq.VMConnectionFactory -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindQueue amq.Queue direct://amq.direct//IBMPerfQueue1 -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic1 topic://amq.topic/IBMPerfTopic1/ -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic2 topic://amq.topic/IBMPerfTopic2/ -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic3 topic://amq.topic/IBMPerfTopic3/ -qpid-run org.apache.qpid.IBMPerfTest.JNDIBindTopic amq.Topic4 topic://amq.topic/IBMPerfTopic4/
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Publisher.bat b/java/client/test/bin/IBM-Publisher.bat deleted file mode 100644 index 5bb4343c4c..0000000000 --- a/java/client/test/bin/IBM-Publisher.bat +++ /dev/null @@ -1,62 +0,0 @@ -@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-REM Script to run the Qpid Java Broker
-
-set CMD="IBM-Publisher.bat"
-set JAVACLASS=JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:/C:/temp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Topic -db 1 -dx 4 -tc jms.r11.Publisher -nt 4 %*
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-set CLIENT_TEST_CLASSES=%QPID_HOME%\lib\client-test-launch.jar
-
-echo on
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" %JAVACLASS%
-
-:end
-
-pause
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Publisher.sh b/java/client/test/bin/IBM-Publisher.sh deleted file mode 100755 index adecf040bc..0000000000 --- a/java/client/test/bin/IBM-Publisher.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export MSGSIZE=100 -qpid-run JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:///tmp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Topic -db 1 -dx 4 -tc jms.r11.Publisher -nt 4 $*
\ No newline at end of file diff --git a/java/client/test/bin/IBM-PutGet.bat b/java/client/test/bin/IBM-PutGet.bat deleted file mode 100644 index c4316f1256..0000000000 --- a/java/client/test/bin/IBM-PutGet.bat +++ /dev/null @@ -1,62 +0,0 @@ -@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-REM Script to run the Qpid Java Broker
-
-set CMD="IBM-PutGet.bat"
-set JAVACLASS=JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:/C:/temp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Queue -tc jms.r11.PutGet -nt 6 %*
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-set CLIENT_TEST_CLASSES=%QPID_HOME%\lib\client-test-launch.jar
-
-echo on
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" %JAVACLASS%
-
-:end
-
-pause
\ No newline at end of file diff --git a/java/client/test/bin/IBM-PutGet.sh b/java/client/test/bin/IBM-PutGet.sh deleted file mode 100755 index c75667c9f6..0000000000 --- a/java/client/test/bin/IBM-PutGet.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# 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. -# - -qpid-run JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:///tmp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Queue -tc jms.r11.PutGet -nt 6 $*
\ No newline at end of file diff --git a/java/client/test/bin/IBM-README.txt b/java/client/test/bin/IBM-README.txt deleted file mode 100644 index b076f3b3ca..0000000000 --- a/java/client/test/bin/IBM-README.txt +++ /dev/null @@ -1,19 +0,0 @@ -The IBM JMS Performance Harness scripts have take the following additional parameters - --tx : Enable transactions --pp : Enable persistent messaging - --ms 1000 : Set message size (default 1000 bytes) --cc 1 : Number of messages to per commit (default 1) Only applies to Sender/Subscriber - -The IBM JMS Performance Harness will need to be downloaded and the library added to client/test/lib. - -The Library can be found here: - -http://www.alphaworks.ibm.com/tech/perfharness - -Before running the required test the IBM JNDI Setup script should be run. - -This will create a filesystem based JNDI Context located at: - -System.properties{java.io.tmpdir}/IBMPerfTestsJNDI/
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Receiver.bat b/java/client/test/bin/IBM-Receiver.bat deleted file mode 100644 index dff44d472a..0000000000 --- a/java/client/test/bin/IBM-Receiver.bat +++ /dev/null @@ -1,62 +0,0 @@ -@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-REM Script to run the Qpid Java Broker
-
-set CMD="IBM-Receiver.bat"
-set JAVACLASS=JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:/C:/temp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Queue -tc jms.r11.Receiver %*
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-set CLIENT_TEST_CLASSES=%QPID_HOME%\lib\client-test-launch.jar
-
-echo on
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" %JAVACLASS%
-
-:end
-
-pause
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Receiver.sh b/java/client/test/bin/IBM-Receiver.sh deleted file mode 100755 index f50f0f744e..0000000000 --- a/java/client/test/bin/IBM-Receiver.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export MSGSIZE=100 -qpid-run JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:///tmp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Queue -tc jms.r11.Receiver $*
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Sender.bat b/java/client/test/bin/IBM-Sender.bat deleted file mode 100644 index b8826322e5..0000000000 --- a/java/client/test/bin/IBM-Sender.bat +++ /dev/null @@ -1,62 +0,0 @@ -@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-REM Script to run the Qpid Java Broker
-
-set CMD="IBM-Sender.bat"
-set JAVACLASS=JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:/C:/temp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Queue -tc jms.r11.Sender -ms $MSGSIZE -mg 1000000 %*
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-set CLIENT_TEST_CLASSES=%QPID_HOME%\lib\client-test-launch.jar
-
-echo on
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" %JAVACLASS%
-
-:end
-
-pause
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Sender.sh b/java/client/test/bin/IBM-Sender.sh deleted file mode 100755 index b99429fd54..0000000000 --- a/java/client/test/bin/IBM-Sender.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export MSGSIZE=100 -qpid-run JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:///tmp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Queue -tc jms.r11.Sender -ms $MSGSIZE -mg 1000000 $*
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Subscriber.bat b/java/client/test/bin/IBM-Subscriber.bat deleted file mode 100644 index 5245639eba..0000000000 --- a/java/client/test/bin/IBM-Subscriber.bat +++ /dev/null @@ -1,62 +0,0 @@ -@REM
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM
-
-@echo off
-REM Script to run the Qpid Java Broker
-
-set CMD="IBM-Subscriber.bat"
-set JAVACLASS=JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:/C:/temp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Topic -db 1 -dx 4 -tc jms.r11.Subscriber -nt 4 %*
-
-rem Guess QPID_HOME if not defined
-set CURRENT_DIR=%cd%
-if not "%QPID_HOME%" == "" goto gotHome
-set QPID_HOME=%CURRENT_DIR%
-echo %QPID_HOME%
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-cd ..
-set QPID_HOME=%cd%
-cd %CURRENT_DIR%
-:gotHome
-if exist "%QPID_HOME%\bin\%CMD%" goto okHome
-echo The QPID_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program
-goto end
-:okHome
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo The JAVA_HOME environment variable is not defined
-echo This environment variable is needed to run this program
-goto exit
-:gotJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-goto okJavaHome
-:noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
-echo This environment variable is needed to run this program.
-goto exit
-:okJavaHome
-
-set CLIENT_TEST_CLASSES=%QPID_HOME%\lib\client-test-launch.jar
-
-echo on
-"%JAVA_HOME%\bin\java" -server -Xmx1024m -DQPID_HOME="%QPID_HOME%" -cp "%CLIENT_TEST_CLASSES%" %JAVACLASS%
-
-:end
-
-pause
\ No newline at end of file diff --git a/java/client/test/bin/IBM-Subscriber.sh b/java/client/test/bin/IBM-Subscriber.sh deleted file mode 100755 index 43550100be..0000000000 --- a/java/client/test/bin/IBM-Subscriber.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - -export MSGSIZE=100 -qpid-run JMSPerfHarness -pc JNDI -ii com.sun.jndi.fscontext.RefFSContextFactory -iu file:///tmp/IBMPerfTestsJNDI/ -cf amq.ConnectionFactory -d amq.Topic -db 1 -dx 4 -tc jms.r11.Subscriber -nt 4 $*
\ No newline at end of file diff --git a/java/client/test/bin/headersListener.sh b/java/client/test/bin/headersListener.sh deleted file mode 100755 index 81930b7043..0000000000 --- a/java/client/test/bin/headersListener.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - - -. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.headers.Listener $* diff --git a/java/client/test/bin/headersListenerGroup.sh b/java/client/test/bin/headersListenerGroup.sh deleted file mode 100755 index e1cc05cfd2..0000000000 --- a/java/client/test/bin/headersListenerGroup.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# -# 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. -# - - -for i; do - ./headersListener.sh -host 10.0.0.1 -port 5672 >$i.out 2>$i.err & - echo $! > $i.pid -done; diff --git a/java/client/test/bin/headersPublisher.sh b/java/client/test/bin/headersPublisher.sh deleted file mode 100755 index fd9fd26416..0000000000 --- a/java/client/test/bin/headersPublisher.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - - -. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.headers.Publisher $* diff --git a/java/client/test/bin/run_many.sh b/java/client/test/bin/run_many.sh deleted file mode 100755 index cca2ffec21..0000000000 --- a/java/client/test/bin/run_many.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# 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. -# - - -# args: -# <number of processes to start> -# <name of run> -# <command ro run> - -for i in `seq 1 $1`; do - $3 >$2.$i.out 2>>$2.err & - echo $! > $2.$i.pid -done; diff --git a/java/client/test/bin/serviceProvidingClient.sh b/java/client/test/bin/serviceProvidingClient.sh deleted file mode 100755 index cbcf5a0f4b..0000000000 --- a/java/client/test/bin/serviceProvidingClient.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# 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. -# - -PROFILE=$1 -shift -# XXX -Xms1024m -XX:NewSize=300m -. qpid-run org.apache.qpid.requestreply1.ServiceProvidingClient $1 guest guest /test serviceQ diff --git a/java/client/test/bin/serviceRequestingClient.sh b/java/client/test/bin/serviceRequestingClient.sh deleted file mode 100755 index 213f44c00b..0000000000 --- a/java/client/test/bin/serviceRequestingClient.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# 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. -# - -PROFILE=$1 -shift -thehosts=$1 -shift -echo $thehosts -# XXX -Xms1024m -XX:NewSize=300m -. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.requestreply1.ServiceRequestingClient $thehosts guest guest /test serviceQ "$@" diff --git a/java/client/test/bin/testService.sh b/java/client/test/bin/testService.sh deleted file mode 100755 index 20161c3abf..0000000000 --- a/java/client/test/bin/testService.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - - -. qpid-run org.apache.qpid.requestreply1.TestService 192.168.55.63 5672 foo x x diff --git a/java/client/test/bin/topicListener.sh b/java/client/test/bin/topicListener.sh deleted file mode 100755 index ac0cb63c91..0000000000 --- a/java/client/test/bin/topicListener.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# 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. -# - - -# XXX -Xmx512m -Xms512m -XX:NewSize=150m -. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.topic.Listener $* diff --git a/java/client/test/bin/topicPublisher.sh b/java/client/test/bin/topicPublisher.sh deleted file mode 100755 index e35c131fe8..0000000000 --- a/java/client/test/bin/topicPublisher.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# 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. -# - -# XXX -Xmx512m -Xms512m -XX:NewSize=150m -. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.topic.Publisher $* diff --git a/java/client/test/etc/ApacheDS.properties b/java/client/test/etc/ApacheDS.properties deleted file mode 100644 index 6c5cb4cec4..0000000000 --- a/java/client/test/etc/ApacheDS.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# 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. -# -# Standard JNDI properties -java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory -java.naming.provider.url=ldap://localhost:389/ou=system -java.naming.security.authentication=simple -java.naming.security.principal=uid=admin,ou=system -java.naming.security.credentials=secret diff --git a/java/client/test/example_build.xml b/java/client/test/example_build.xml deleted file mode 100644 index dda3cb4263..0000000000 --- a/java/client/test/example_build.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0"?> -<!-- - - - - 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. - - - --> - -<!-- example Blaze Component Java build file --> - -<project name="example-client" default="jar" basedir="."> - <property name="lib" value="${basedir}/lib"/> - <property name="common.lib" value="${basedir}/../common/lib"/> - <property name="example.dir" value="${basedir}"/> - <property name="example.src" value="${example.dir}/src"/> - <property name="example.lib" value="${example.dir}/lib"/> - <property name="example.tests" value="${example.dir}/test"/> - <property name="example.classes" value="${example.dir}/classes"/> - <property name="dist" value="${basedir}/dist"/> - <property name="dam.dist" value="${basedir}/damPackage"/> - - <!-- Setup details --> - <target name="init"> - <tstamp> - <format property="release" pattern="-dMMMyy" locale="en" timezone="GMT"/> - </tstamp> - <mkdir dir="${example.classes}"/> - </target> - - <path id="example.classpath"> - <fileset dir="${common}/lib"> - <include name="**/*.jar"/> - </fileset> - <pathelement path="${example.classes}"/> - </path> - - <!-- Remove all built files --> - <target name="clean" depends="init"> - <delete dir="${example.classes}"/> - </target> - - <path id="example_amq.classpath"> - <fileset dir="${basedir}/lib"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="${example.lib}"> - <include name="**/*.jar"/> - </fileset> - <pathelement path="${example.classes}"/> - - </path> - - <!-- Compile Java --> - <target name="compile" depends="init"> - <javac destdir="${example.classes}" debug="on" includeantruntime="false"> - <classpath refid="example_amq.classpath"/> - <src path="${example.src}"/> - <exclude name="**/Test*.java"/> - </javac> - - <copy todir="${example.classes}"> - <!-- copy any non java src files into the build tree, e.g. properties files --> - <fileset dir="${example.src}"> - <exclude name="**/*.java"/> - <exclude name="**/package.html"/> - </fileset> - </copy> - </target> - - <!-- Compile and build jar archive --> - <target name="dist" depends="compile"> - <mkdir dir="${dist}"/> - <jar basedir="${example.classes}" jarfile="${dist}/example_amq.jar"/> - </target> - - <!-- Create release zip and tar --> - <target name="release" depends="dist" description="Create a release package"> - - <zip destfile="${dist}/example_client.zip"> - <zipfileset prefix="lib" file="${dist}/example_amq.jar" /> - </zip> - - <tar destfile="${dist}/example_client.tar.gz" compression="gzip"> - <tarfileset prefix="lib" file="${dist}/example_amq.jar" /> - </tar> - </target> - - - -</project> diff --git a/java/common.xml b/java/common.xml index 7e7b9c0c07..2b61ef08c2 100644 --- a/java/common.xml +++ b/java/common.xml @@ -97,7 +97,8 @@ <property name="ivy.jar.dir" value="${project.root}/lib/ivy" /> <property name="ivy.install.version" value="2.2.0" /> <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" /> - <property name="ivy.repo.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy"/> + <property name="ivy.m2repo.url" value="http://repo1.maven.org/maven2"/> + <property name="ivy.repo.url" value="${ivy.m2repo.url}/org/apache/ivy/ivy"/> <property name="ivy.jar.url" value="${ivy.repo.url}/${ivy.install.version}/ivy-${ivy.install.version}.jar"/> <available property="ivy.jar.file.exists" file="${ivy.jar.file}"/> diff --git a/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java b/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java index 97fbd43ea0..5268ce9bc2 100644 --- a/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java +++ b/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java @@ -20,10 +20,11 @@ package org.apache.qpid.configuration; /** * This class centralized the Qpid client properties. + * + * @see CommonProperties */ public class ClientProperties { - /** * Currently with Qpid it is not possible to change the client ID. * If one is not specified upon connection construction, an id is generated automatically. @@ -118,10 +119,6 @@ public class ClientProperties */ public static final String REJECT_BEHAVIOUR_PROP_NAME = "qpid.reject.behaviour"; - private ClientProperties() - { - } - /** * System property used to set the key manager factory algorithm. * @@ -192,4 +189,10 @@ public class ClientProperties * waiting because the client was flow controlled by the broker. */ public static final long DEFAULT_FLOW_CONTROL_WAIT_NOTIFY_PERIOD = 5000L; + + + private ClientProperties() + { + //No instances + } } diff --git a/java/common/src/main/java/org/apache/qpid/transport/ProtocolViolationException.java b/java/common/src/main/java/org/apache/qpid/configuration/CommonProperties.java index 6787157e8e..2449f457e5 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/ProtocolViolationException.java +++ b/java/common/src/main/java/org/apache/qpid/configuration/CommonProperties.java @@ -18,18 +18,24 @@ * under the License. * */ -package org.apache.qpid.transport; - +package org.apache.qpid.configuration; /** - * ProtocolViolationException + * Centralised record of Qpid common properties. * + * @see ClientProperties */ - -public final class ProtocolViolationException extends ConnectionException +public class CommonProperties { - public ProtocolViolationException(String msg,Throwable cause) + /** + * The timeout used by the IO layer for timeouts such as send timeout in IoSender, and the close timeout for IoSender and IoReceiver + */ + public static final String IO_NETWORK_TRANSPORT_TIMEOUT_PROP_NAME = "qpid.io_network_transport_timeout"; + public static final int IO_NETWORK_TRANSPORT_TIMEOUT_DEFAULT = 60000; + + + private CommonProperties() { - super(msg, cause); + //no instances } } diff --git a/java/common/src/main/java/org/apache/qpid/transport/Connection.java b/java/common/src/main/java/org/apache/qpid/transport/Connection.java index 388e3442bf..e87851cf7d 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/Connection.java +++ b/java/common/src/main/java/org/apache/qpid/transport/Connection.java @@ -382,7 +382,7 @@ public class Connection extends ConnectionInvoker { log.debug("SEND: [%s] %s", this, event); } - Sender s = sender; + Sender<ProtocolEvent> s = sender; if (s == null) { throw new ConnectionException("connection closed"); @@ -415,15 +415,23 @@ public class Connection extends ConnectionInvoker public void dispatch(Method method) { - Session ssn = getSession(method.getChannel()); + int channel = method.getChannel(); + Session ssn = getSession(channel); if(ssn != null) { ssn.received(method); } else { - throw new ProtocolViolationException( - "Received frames for an already detached session", null); + /* + * A peer receiving any other control on a detached transport MUST discard it and + * send a session.detached with the "not-attached" reason code. + */ + if(log.isDebugEnabled()) + { + log.debug("Control received on unattached channel : %d", channel); + } + invokeSessionDetached(channel, SessionDetachCode.NOT_ATTACHED); } } @@ -663,7 +671,7 @@ public class Connection extends ConnectionInvoker public void setServerProperties(final Map<String, Object> serverProperties) { - _serverProperties = serverProperties == null ? Collections.EMPTY_MAP : serverProperties; + _serverProperties = serverProperties == null ? Collections.<String, Object>emptyMap() : serverProperties; } public Map<String, Object> getServerProperties() @@ -719,4 +727,12 @@ public class Connection extends ConnectionInvoker { return _localAddress; } + + private void invokeSessionDetached(int channel, SessionDetachCode sessionDetachCode) + { + SessionDetached sessionDetached = new SessionDetached(); + sessionDetached.setChannel(channel); + sessionDetached.setCode(sessionDetachCode); + invoke(sessionDetached); + } } diff --git a/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java b/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java index c90a11594c..14dfeb18ec 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java +++ b/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java @@ -60,9 +60,9 @@ public class ConnectionSettings private int maxChannelCount = 32767; private int maxFrameSize = 65535; private int heartbeatInterval; + private int connectTimeout = 30000; private int readBufferSize = QpidProperty.intProperty(65535, RECEIVE_BUFFER_SIZE_PROP_NAME, LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME).get(); private int writeBufferSize = QpidProperty.intProperty(65535, SEND_BUFFER_SIZE_PROP_NAME, LEGACY_SEND_BUFFER_SIZE_PROP_NAME).get();; - private long transportTimeout = 60000; // SSL props private boolean useSSL; @@ -345,6 +345,16 @@ public class ConnectionSettings this.trustStoreType = trustStoreType; } + public int getConnectTimeout() + { + return connectTimeout; + } + + public void setConnectTimeout(int connectTimeout) + { + this.connectTimeout = connectTimeout; + } + public int getReadBufferSize() { return readBufferSize; @@ -364,14 +374,4 @@ public class ConnectionSettings { this.writeBufferSize = writeBufferSize; } - - public long getTransportTimeout() - { - return transportTimeout; - } - - public void setTransportTimeout(long transportTimeout) - { - this.transportTimeout = transportTimeout; - } } diff --git a/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java b/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java index dfb318b80c..9b6f0a0b1b 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java +++ b/java/common/src/main/java/org/apache/qpid/transport/network/io/IoNetworkTransport.java @@ -33,6 +33,8 @@ import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSocket; + +import org.apache.qpid.configuration.CommonProperties; import org.apache.qpid.protocol.ProtocolEngine; import org.apache.qpid.protocol.ProtocolEngineFactory; import org.apache.qpid.transport.ConnectionSettings; @@ -47,7 +49,8 @@ import org.slf4j.LoggerFactory; public class IoNetworkTransport implements OutgoingNetworkTransport, IncomingNetworkTransport { private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(IoNetworkTransport.class); - private static final int TIMEOUT = 60000; + private static final int TIMEOUT = Integer.getInteger(CommonProperties.IO_NETWORK_TRANSPORT_TIMEOUT_PROP_NAME, + CommonProperties.IO_NETWORK_TRANSPORT_TIMEOUT_DEFAULT); private Socket _socket; private IoNetworkConnection _connection; @@ -75,7 +78,7 @@ public class IoNetworkTransport implements OutgoingNetworkTransport, IncomingNet InetAddress address = InetAddress.getByName(settings.getHost()); - _socket.connect(new InetSocketAddress(address, settings.getPort()), TIMEOUT); + _socket.connect(new InetSocketAddress(address, settings.getPort()), settings.getConnectTimeout()); } catch (SocketException e) { diff --git a/java/ivy.retrieve.xml b/java/ivy.retrieve.xml index 98d3d3785d..3af847a48a 100644 --- a/java/ivy.retrieve.xml +++ b/java/ivy.retrieve.xml @@ -74,7 +74,7 @@ <!-- The following are optional dependencies, for modules providing optional functionlity or for use in optional build/test steps. Their optional status is usually indicative of licences which are not compatible with the Apache Licence --> - <dependency org="com.sleepycat" name="je" rev="5.0.55" transitive="false" conf="bdbje"/> + <dependency org="com.sleepycat" name="je" rev="5.0.58" transitive="false" conf="bdbje"/> <dependency org="jfree" name="jfreechart" rev="1.0.13" transitive="false" conf="jfree"/> <dependency org="jfree" name="jcommon" rev="1.0.16" transitive="false" conf="jfree"/> <dependency org="net.sourceforge.csvjdbc" name="csvjdbc" rev="1.0.8" transitive="false" conf="csvjdbc"/> diff --git a/java/ivysettings.retrieve.xml b/java/ivysettings.retrieve.xml index 8faf23c2d1..e31af1e5b5 100644 --- a/java/ivysettings.retrieve.xml +++ b/java/ivysettings.retrieve.xml @@ -18,7 +18,6 @@ <property name="ivy.default.resolver" value="chain" override="false"/> <property name="ivy.localfs.root" value="${project.root}/localfs_repo" override="false"/> <property name="ivy.localfs.pattern" value="[artifact]-[revision](-[classifier]).[ext]" override="false"/> - <property name="ivy.m2repo.url" value="http://repo1.maven.org/maven2" override="false"/> <settings defaultResolver="${ivy.default.resolver}"/> <resolvers> diff --git a/java/lib/poms/je-5.0.55.xml b/java/lib/poms/je-5.0.58.xml index 0c40ea541a..d71a935dff 100644 --- a/java/lib/poms/je-5.0.55.xml +++ b/java/lib/poms/je-5.0.58.xml @@ -18,5 +18,5 @@ <dep> <groupId>com.sleepycat</groupId> <artifactId>je</artifactId> - <version>5.0.55</version> + <version>5.0.58</version> </dep> diff --git a/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transacted.chartdef b/java/perftests/etc/chartdefs/1021-AcknowledgementModes-Persistent.chartdef index 5dcfa5a85e..30aee40c27 100644 --- a/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transacted.chartdef +++ b/java/perftests/etc/chartdefs/1021-AcknowledgementModes-Persistent.chartdef @@ -19,14 +19,17 @@ chartType=BAR chartTitle=Performance of acknowledgement modes -chartSubtitle=Transacted -xAxisTitle=Persistence +chartSubtitle=Persistent messages (1024b) +xAxisTitle=Acknowledge mode (0=session transacted; 1=auto-acknowledge) yAxisTitle=Throughput (KB/s) -series.1.statement=SELECT testName, throughputKbPerS FROM AcknowledgementModes WHERE acknowledgeMode = '0' AND participantName = 'All' +series.1.statement=SELECT acknowledgeMode, throughputKbPerS FROM AcknowledgementModes WHERE testName like 'Persistent%' AND participantName = 'All' ORDER BY acknowledgeMode series.1.legend=Current series.1.dir=${csvCurrentDir} -series.2.statement=SELECT testName, throughputKbPerS FROM AcknowledgementModes WHERE acknowledgeMode = '0' AND participantName = 'All' + + +series.2.statement=SELECT acknowledgeMode, throughputKbPerS FROM AcknowledgementModes WHERE testName like 'Persistent%' AND participantName = 'All' ORDER BY acknowledgeMode series.2.legend=Baseline series.2.dir=${csvBaselineDir} + diff --git a/java/perftests/etc/chartdefs/1021-AcknowledgementModes-AutoAck.chartdef b/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transient.chartdef index 009ac6d80f..7a26391deb 100644 --- a/java/perftests/etc/chartdefs/1021-AcknowledgementModes-AutoAck.chartdef +++ b/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transient.chartdef @@ -19,15 +19,14 @@ chartType=BAR chartTitle=Performance of acknowledgement modes -chartSubtitle=Auto-acknowledge -xAxisTitle=Persistence +chartSubtitle=Transient messages (1024b) +xAxisTitle=Acknowledge mode (0=session transacted; 1=auto-acknowledge) yAxisTitle=Throughput (KB/s) -series.1.statement=SELECT testName, throughputKbPerS FROM AcknowledgementModes WHERE acknowledgeMode = '1' AND participantName = 'All' +series.1.statement=SELECT acknowledgeMode, throughputKbPerS FROM AcknowledgementModes WHERE testName like 'Transient%' AND participantName = 'All' ORDER BY acknowledgeMode series.1.legend=Current series.1.dir=${csvCurrentDir} -series.2.statement=SELECT testName, throughputKbPerS FROM AcknowledgementModes WHERE acknowledgeMode = '1' AND participantName = 'All' +series.2.statement=SELECT acknowledgeMode, throughputKbPerS FROM AcknowledgementModes WHERE testName like 'Transient%' AND participantName = 'All' ORDER BY acknowledgeMode series.2.legend=Baseline series.2.dir=${csvBaselineDir} - diff --git a/java/perftests/etc/testdefs/Topic-AckModes.js b/java/perftests/etc/testdefs/Topic-AckModes.js index 5c4dee88e3..63c4b8646e 100644 --- a/java/perftests/etc/testdefs/Topic-AckModes.js +++ b/java/perftests/etc/testdefs/Topic-AckModes.js @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ var duration = 30000; var topicName = "topic://amq.topic/?routingkey='testTopic'"; @@ -30,6 +50,7 @@ var jsonObject = { { "_name": "Producer", "_destinationName": topicName, + "_deliveryMode": 1, "_maximumDuration": duration, "_startDelay": 2000 // gives the consumers time to implicitly create the topic } diff --git a/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js b/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js index 751b8b1528..58ae2f5862 100644 --- a/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js +++ b/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ var jsonObject = { _tests:[] }; @@ -26,6 +46,7 @@ for(i=0; i < numbersOfConsumers.length ; i++) { "_name": "Producer1", "_destinationName": topicName, + "_deliveryMode": 1, "_maximumDuration": duration, "_startDelay": 2000 // gives the consumers time to implicitly create the topic } diff --git a/java/perftests/etc/testdefs/Topic-NumberOfTopics.js b/java/perftests/etc/testdefs/Topic-NumberOfTopics.js index 89e5ecf56c..d31dd36c76 100644 --- a/java/perftests/etc/testdefs/Topic-NumberOfTopics.js +++ b/java/perftests/etc/testdefs/Topic-NumberOfTopics.js @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ var jsonObject = { _tests:[] }; @@ -29,6 +49,7 @@ for(i=0; i < numbersOfTopics.length ; i++) { "_name": "Producer-__INDEX", "_destinationName": topicName, + "_deliveryMode": 1, "_maximumDuration": duration, "_startDelay": 2000 // gives the consumers time to implicitly create the topic } diff --git a/java/perftests/etc/testdefs/Topic-Persistence.js b/java/perftests/etc/testdefs/Topic-Persistence.js index fd92560fc3..bbec7ab8ed 100644 --- a/java/perftests/etc/testdefs/Topic-Persistence.js +++ b/java/perftests/etc/testdefs/Topic-Persistence.js @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ var duration = 30000; var topicName = "topic://amq.topic/?routingkey='testTopic'"; diff --git a/java/perftests/example/perftests.js b/java/perftests/example/perftests.js index 51160e7214..be7d5e0be4 100644 --- a/java/perftests/example/perftests.js +++ b/java/perftests/example/perftests.js @@ -1,4 +1,23 @@ - +/* + * + * 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. + * + */ var jsonObject = { _tests:[] }; diff --git a/java/perftests/src/main/java/test-utils.js b/java/perftests/src/main/java/test-utils.js index 7bfe233266..cbf27786b7 100644 --- a/java/perftests/src/main/java/test-utils.js +++ b/java/perftests/src/main/java/test-utils.js @@ -1,3 +1,23 @@ +/* + * + * 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. + * + */ var QPID; if (!QPID) { QPID = {}; diff --git a/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java b/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java index 08bdf122ba..5d4a9b6b7e 100644 --- a/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java +++ b/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java @@ -105,8 +105,17 @@ public class ChartWriter writer = new BufferedWriter(new FileWriter(summaryFile)); writer.write(htmlHeader); + + writer.write(" <ul>\n"); + for (File chartFile : _chartFiles) + { + writer.write(" <li><a href='#"+ chartFile.getName() +"'>" + chartFile.getName() + "</a></li>\n"); + } + writer.write(" </ul>\n"); + for (File chartFile : _chartFiles) { + writer.write(" <a name='" + chartFile.getName() + "'/>\n"); writer.write(" <img src='" + chartFile.getName() + "'/>\n"); } writer.write(htmlFooter); diff --git a/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html b/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html index d1f039f44a..89c508a77e 100644..100755 --- a/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html +++ b/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html @@ -3,7 +3,13 @@ <title>Performance Charts</title> </head> <body> + <ul> + <li><a href='#chart1.png'>chart1.png</a></li> + <li><a href='#chart2.png'>chart2.png</a></li> + </ul> + <a name='chart1.png'/> <img src='chart1.png'/> + <a name='chart2.png'/> <img src='chart2.png'/> </body> </html>
\ No newline at end of file diff --git a/java/systests/etc/log.properties b/java/systests/etc/log.properties index 745c5187c9..ff36b7cd0c 100644 --- a/java/systests/etc/log.properties +++ b/java/systests/etc/log.properties @@ -1,2 +1,21 @@ +# +# 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. +# + com.sleepycat.je.util.FileHandler.level=ALL com.sleepycat.je.util.ConsoleHandler.level=ALL diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/PersistentTestManual.java b/java/systests/src/main/java/org/apache/qpid/server/queue/PersistentTestManual.java deleted file mode 100644 index 62ea5fdcc9..0000000000 --- a/java/systests/src/main/java/org/apache/qpid/server/queue/PersistentTestManual.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * 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.qpid.server.queue; - -import org.apache.log4j.Logger; - -import org.apache.qpid.AMQChannelClosedException; -import org.apache.qpid.AMQConnectionClosedException; -import org.apache.qpid.AMQException; -import org.apache.qpid.client.AMQConnection; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.url.URLSyntaxException; -import org.apache.qpid.util.CommandLineParser; - -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import java.io.IOException; -import java.util.Properties; - -public class PersistentTestManual -{ - private static final Logger _logger = Logger.getLogger(PersistentTestManual.class); - - - private static final String QUEUE = "direct://amq.direct//PersistentTest-Queue2?durable='true',exclusive='true'"; - - protected AMQConnection _connection; - - protected Session _session; - - protected Queue _queue; - private Properties properties; - - private String _brokerDetails; - private String _username; - private String _password; - private String _virtualpath; - - public PersistentTestManual(Properties overrides) - { - properties = new Properties(defaults); - properties.putAll(overrides); - - _brokerDetails = properties.getProperty(BROKER_PROPNAME); - _username = properties.getProperty(USERNAME_PROPNAME); - _password = properties.getProperty(PASSWORD_PROPNAME); - _virtualpath = properties.getProperty(VIRTUAL_HOST_PROPNAME); - - createConnection(); - } - - protected void createConnection() - { - try - { - _connection = new AMQConnection(_brokerDetails, _username, _password, "PersistentTest", _virtualpath); - - _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - _connection.start(); - } - catch (Exception e) - { - _logger.error("Unable to create test class due to:" + e.getMessage(), e); - System.exit(0); - } - } - - public void test() throws AMQException, URLSyntaxException - { - - //Create the Durable Queue - try - { - _session.createConsumer(_session.createQueue(QUEUE)).close(); - } - catch (JMSException e) - { - _logger.error("Unable to create Queue due to:" + e.getMessage(), e); - System.exit(0); - } - - try - { - if (testQueue()) - { - // close connection - _connection.close(); - // wait - System.out.println("Restart Broker Now"); - try - { - System.in.read(); - } - catch (IOException e) - { - // - } - finally - { - System.out.println("Continuing...."); - } - - //Test queue is still there. - AMQConnection connection = new AMQConnection(_brokerDetails, _username, _password, "DifferentClientID", _virtualpath); - - AMQSession session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - try - { - session.createConsumer(session.createQueue(QUEUE)); - _logger.error("Create consumer succeeded." + - " This shouldn't be allowed as this means the queue didn't exist when it should"); - - connection.close(); - - exit(); - } - catch (JMSException e) - { - try - { - connection.close(); - } - catch (JMSException cce) - { - if (cce.getLinkedException() instanceof AMQConnectionClosedException) - { - _logger.error("Channel Close Bug still present QPID-432, should see an 'Error closing session'"); - } - else - { - exit(cce); - } - } - - if (e.getLinkedException() instanceof AMQChannelClosedException) - { - _logger.info("AMQChannelClosedException received as expected"); - } - else - { - exit(e); - } - } - } - } - catch (JMSException e) - { - _logger.error("Unable to test Queue due to:" + e.getMessage(), e); - System.exit(0); - } - } - - private void exit(JMSException e) - { - _logger.error("JMSException received:" + e.getMessage()); - e.printStackTrace(); - exit(); - } - - private void exit() - { - try - { - _connection.close(); - } - catch (JMSException e) - { - // - } - System.exit(0); - } - - private boolean testQueue() throws JMSException - { - String TEST_TEXT = "init"; - - //Create a new session to send producer - Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - Queue q = session.createQueue(QUEUE); - MessageProducer producer = session.createProducer(q); - - producer.send(session.createTextMessage(TEST_TEXT)); - - //create a new consumer on the original session - TextMessage m = (TextMessage) _session.createConsumer(q).receive(); - - - if ((m != null) && m.getText().equals(TEST_TEXT)) - { - return true; - } - else - { - _logger.error("Incorrect values returned from Queue Test:" + m); - System.exit(0); - return false; - } - } - - /** Holds the name of the property to get the test broker url from. */ - public static final String BROKER_PROPNAME = "broker"; - - /** Holds the default broker url for the test. */ - public static final String BROKER_DEFAULT = "tcp://localhost:5672"; - - /** Holds the name of the property to get the test broker virtual path. */ - public static final String VIRTUAL_HOST_PROPNAME = "virtualHost"; - - /** Holds the default virtual path for the test. */ - public static final String VIRTUAL_HOST_DEFAULT = ""; - - /** Holds the name of the property to get the broker access username from. */ - public static final String USERNAME_PROPNAME = "username"; - - /** Holds the default broker log on username. */ - public static final String USERNAME_DEFAULT = "guest"; - - /** Holds the name of the property to get the broker access password from. */ - public static final String PASSWORD_PROPNAME = "password"; - - /** Holds the default broker log on password. */ - public static final String PASSWORD_DEFAULT = "guest"; - - /** Holds the default configuration properties. */ - public static Properties defaults = new Properties(); - - static - { - defaults.setProperty(BROKER_PROPNAME, BROKER_DEFAULT); - defaults.setProperty(USERNAME_PROPNAME, USERNAME_DEFAULT); - defaults.setProperty(PASSWORD_PROPNAME, PASSWORD_DEFAULT); - defaults.setProperty(VIRTUAL_HOST_PROPNAME, VIRTUAL_HOST_DEFAULT); - } - - public static void main(String[] args) - { - PersistentTestManual test; - - Properties options = - CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][]{}), System.getProperties()); - - test = new PersistentTestManual(options); - try - { - test.test(); - System.out.println("Test was successfull."); - } - catch (Exception e) - { - _logger.error("Unable to test due to:" + e.getMessage(), e); - } - } -} diff --git a/java/test-profiles/python_tests/Java010PythonExcludes b/java/test-profiles/python_tests/Java010PythonExcludes index d3c058a2e9..f99a6d5bba 100644 --- a/java/test-profiles/python_tests/Java010PythonExcludes +++ b/java/test-profiles/python_tests/Java010PythonExcludes @@ -58,6 +58,7 @@ qpid_tests.broker_0_10.dtx.DtxTests.test_simple_prepare_commit qpid_tests.broker_0_10.dtx.DtxTests.test_simple_prepare_rollback qpid_tests.broker_0_10.dtx.DtxTests.test_simple_rollback +qpid_tests.broker_0_10.new_api.GeneralTests.test_qpid_3481_acquired_to_alt_exchange_2_consumers ###### Java Broker defects ###### |