You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/12/22 13:22:45 UTC
[camel] branch main updated: camel-management - Remove deprecate JMX operations.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 49ad1cf camel-management - Remove deprecate JMX operations.
49ad1cf is described below
commit 49ad1cf254c7f4d27aa9fdaf0587382f6ddfc7b8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 22 14:21:50 2021 +0100
camel-management - Remove deprecate JMX operations.
---
.../management/mbean/ManagedCamelContextMBean.java | 49 -------
.../api/management/mbean/ManagedRouteMBean.java | 4 -
.../management/mbean/ManagedCamelContext.java | 54 -------
.../camel/management/mbean/ManagedRoute.java | 37 -----
.../ROOT/pages/camel-3x-upgrade-guide-3_15.adoc | 2 +
dsl/camel-xml-jaxb-dsl-test/management/pom.xml | 158 ---------------------
...ManagedCamelContextUpdateRoutesFromXmlTest.java | 89 ------------
...RoutesWithPropertyPlaceholdersFromXmlPTest.java | 149 -------------------
.../ManagedRouteUpdateRouteFromXmlTest.java | 151 --------------------
.../xml/jaxb/management/ManagementTestSupport.java | 96 -------------
.../src/test/resources/log4j2-test.properties | 31 ----
dsl/camel-xml-jaxb-dsl-test/pom.xml | 1 -
12 files changed, 2 insertions(+), 819 deletions(-)
diff --git a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
index 2213cfc..b2470b3 100644
--- a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
+++ b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
@@ -191,14 +191,6 @@ public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean
@ManagedOperation(description = "Dumps the routes as XML")
String dumpRoutesAsXml(boolean resolvePlaceholders, boolean resolveDelegateEndpoints) throws Exception;
- @Deprecated
- @ManagedOperation(description = "Adds or updates existing routes from XML")
- void addOrUpdateRoutesFromXml(String xml) throws Exception;
-
- @Deprecated
- @ManagedOperation(description = "Adds or updates existing routes from XML")
- void addOrUpdateRoutesFromXml(String xml, boolean urlDecode) throws Exception;
-
@ManagedOperation(description = "Dumps the CamelContext and routes stats as XML")
String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
@@ -236,47 +228,6 @@ public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean
int removeEndpoints(String pattern) throws Exception;
/**
- * Returns the JSON schema representation with information about the component and the endpoint parameters it
- * supports
- *
- * @param componentName the name of the component to lookup
- * @throws Exception is thrown if error occurred
- */
- @ManagedOperation(description = "Returns the JSON schema representation of the endpoint parameters for the given component name")
- @Deprecated
- String componentParameterJsonSchema(String componentName) throws Exception;
-
- /**
- * Returns the JSON schema representation with information about the data format and the parameters it supports
- *
- * @param dataFormatName the name of the data format to lookup
- * @throws Exception is thrown if error occurred
- */
- @ManagedOperation(description = "Returns the JSON schema representation of the data format parameters for the given data format name")
- @Deprecated
- String dataFormatParameterJsonSchema(String dataFormatName) throws Exception;
-
- /**
- * Returns the JSON schema representation with information about the language and the parameters it supports
- *
- * @param languageName the name of the language to lookup
- * @throws Exception is thrown if error occurred
- */
- @ManagedOperation(description = "Returns the JSON schema representation of the language parameters for the given language name")
- @Deprecated
- String languageParameterJsonSchema(String languageName) throws Exception;
-
- /**
- * Returns the JSON schema representation with information about the EIP and the parameters it supports
- *
- * @param eipName the name of the EIP to lookup
- * @throws Exception is thrown if error occurred
- */
- @ManagedOperation(description = "Returns the JSON schema representation of the EIP parameters for the given EIP name")
- @Deprecated
- String eipParameterJsonSchema(String eipName) throws Exception;
-
- /**
* Resets all the performance counters.
*
* @param includeRoutes whether to reset all routes as well.
diff --git a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
index c49ea7ae..dfd3667 100644
--- a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
+++ b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
@@ -113,10 +113,6 @@ public interface ManagedRouteMBean extends ManagedPerformanceCounterMBean {
@ManagedOperation(description = "Dumps the route as XML")
String dumpRouteAsXml(boolean resolvePlaceholders, boolean resolveDelegateEndpoints) throws Exception;
- @Deprecated
- @ManagedOperation(description = "Updates the route from XML")
- void updateRouteFromXml(String xml) throws Exception;
-
@ManagedOperation(description = "Dumps the route stats as XML")
String dumpRouteStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
diff --git a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
index 6132961..e3808f5 100644
--- a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
+++ b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
@@ -17,8 +17,6 @@
package org.apache.camel.management.mbean;
import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
@@ -33,7 +31,6 @@ import javax.management.ObjectName;
import org.w3c.dom.Document;
import org.apache.camel.CamelContext;
-import org.apache.camel.CatalogCamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.ManagementStatisticsLevel;
@@ -55,14 +52,10 @@ import org.apache.camel.model.RoutesDefinition;
import org.apache.camel.model.rest.RestDefinition;
import org.apache.camel.model.rest.RestsDefinition;
import org.apache.camel.spi.ManagementStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@ManagedResource(description = "Managed CamelContext")
public class ManagedCamelContext extends ManagedPerformanceCounter implements TimerListener, ManagedCamelContextMBean {
- private static final Logger LOG = LoggerFactory.getLogger(ManagedCamelContext.class);
-
private final CamelContext context;
private final LoadTriplet load = new LoadTriplet();
private final String jmxDomain;
@@ -461,33 +454,6 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements Ti
}
@Override
- public void addOrUpdateRoutesFromXml(String xml) throws Exception {
- // do not decode so we function as before
- addOrUpdateRoutesFromXml(xml, false);
- }
-
- @Override
- public void addOrUpdateRoutesFromXml(String xml, boolean urlDecode) throws Exception {
- // decode String as it may have been encoded, from its xml source
- if (urlDecode) {
- xml = URLDecoder.decode(xml, "UTF-8");
- }
-
- InputStream is = context.getTypeConverter().mandatoryConvertTo(InputStream.class, xml);
- try {
- // add will remove existing route first
- ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class);
- RoutesDefinition routes = (RoutesDefinition) ecc.getXMLRoutesDefinitionLoader().loadRoutesDefinition(ecc, is);
- context.getExtension(Model.class).addRouteDefinitions(routes.getRoutes());
- } catch (Exception e) {
- // log the error as warn as the management api may be invoked remotely over JMX which does not propagate such exception
- String msg = "Error updating routes from xml: " + xml + " due: " + e.getMessage();
- LOG.warn(msg, e);
- throw e;
- }
- }
-
- @Override
public String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<camelContextStat").append(String.format(" id=\"%s\" state=\"%s\"", getCamelId(), getState()));
@@ -747,26 +713,6 @@ public class ManagedCamelContext extends ManagedPerformanceCounter implements Ti
}
@Override
- public String componentParameterJsonSchema(String componentName) throws Exception {
- return context.adapt(CatalogCamelContext.class).getComponentParameterJsonSchema(componentName);
- }
-
- @Override
- public String dataFormatParameterJsonSchema(String dataFormatName) throws Exception {
- return context.adapt(CatalogCamelContext.class).getDataFormatParameterJsonSchema(dataFormatName);
- }
-
- @Override
- public String languageParameterJsonSchema(String languageName) throws Exception {
- return context.adapt(CatalogCamelContext.class).getLanguageParameterJsonSchema(languageName);
- }
-
- @Override
- public String eipParameterJsonSchema(String eipName) throws Exception {
- return context.adapt(CatalogCamelContext.class).getEipParameterJsonSchema(eipName);
- }
-
- @Override
public void reset(boolean includeRoutes) throws Exception {
reset();
diff --git a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
index b1dcf6f..7861aa8 100644
--- a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
+++ b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.management.mbean;
-import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -55,7 +54,6 @@ import org.apache.camel.api.management.mbean.RouteError;
import org.apache.camel.model.Model;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
-import org.apache.camel.model.RoutesDefinition;
import org.apache.camel.spi.InflightRepository;
import org.apache.camel.spi.ManagementStrategy;
import org.apache.camel.spi.RoutePolicy;
@@ -375,41 +373,6 @@ public class ManagedRoute extends ManagedPerformanceCounter implements TimerList
}
@Override
- public void updateRouteFromXml(String xml) throws Exception {
- // convert to model from xml
- ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class);
- InputStream is = context.getTypeConverter().convertTo(InputStream.class, xml);
- RoutesDefinition routes = (RoutesDefinition) ecc.getXMLRoutesDefinitionLoader().loadRoutesDefinition(context, is);
- if (routes == null || routes.getRoutes().isEmpty()) {
- return;
- }
- RouteDefinition def = routes.getRoutes().get(0);
-
- // if the xml does not contain the route-id then we fix this by adding the actual route id
- // this may be needed if the route-id was auto-generated, as the intend is to update this route
- // and not add a new route, adding a new route, use the MBean operation on ManagedCamelContext instead.
- if (ObjectHelper.isEmpty(def.getId())) {
- def.setId(getRouteId());
- } else if (!def.getId().equals(getRouteId())) {
- throw new IllegalArgumentException(
- "Cannot update route from XML as routeIds does not match. routeId: "
- + getRouteId() + ", routeId from XML: " + def.getId());
- }
-
- LOG.debug("Updating route: {} from xml: {}", def.getId(), xml);
-
- try {
- // add will remove existing route first
- context.getExtension(Model.class).addRouteDefinition(def);
- } catch (Exception e) {
- // log the error as warn as the management api may be invoked remotely over JMX which does not propagate such exception
- String msg = "Error updating route: " + def.getId() + " from xml: " + xml + " due: " + e.getMessage();
- LOG.warn(msg, e);
- throw e;
- }
- }
-
- @Override
public String dumpRouteStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception {
// in this logic we need to calculate the accumulated processing time for the processor in the route
// and hence why the logic is a bit more complicated to do this, as we need to calculate that from
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
index c54dc68..0062670 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
@@ -25,6 +25,8 @@ to `org.apache.camel.component.aws2.s3.stream.AWSS3NamingStrategyEnum` class nam
The route controller MBeans are moved from `routecontrollers` to the existing `services`
node in the JMX MBean tree.
+Removed deprecated operations on `CamelContextMBean` and `CamelRouteMBean`.
+
=== camel-yaml-dsl
Removed `steps` from `route` because steps should only be configured on `from` making
diff --git a/dsl/camel-xml-jaxb-dsl-test/management/pom.xml b/dsl/camel-xml-jaxb-dsl-test/management/pom.xml
deleted file mode 100644
index 3ec68e7..0000000
--- a/dsl/camel-xml-jaxb-dsl-test/management/pom.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-xml-jaxb-dsl-test</artifactId>
- <version>3.15.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>camel-xml-jaxb-dsl-test-management</artifactId>
- <packaging>jar</packaging>
- <name>Camel :: XML DSL Jaxb :: Test :: Management</name>
- <description>Camel XML DSL Tests with Jaxb and Management</description>
-
- <properties>
- <firstVersion>3.9.0</firstVersion>
- <camel.surefire.parallel>false</camel.surefire.parallel>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-xml-jaxb-dsl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-model</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-management</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-direct</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-rest</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-mock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-languages</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-bean</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-telegram</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-seda</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-junit5</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-jcl</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <!-- skip testing on java 8 -->
- <profiles>
- <profile>
- <id>jdk8</id>
- <activation>
- <jdk>[,8)</jdk>
- </activation>
- <properties>
- <maven.test.skip.exec>true</maven.test.skip.exec>
- </properties>
- </profile>
- </profiles>
-
-</project>
\ No newline at end of file
diff --git a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedCamelContextUpdateRoutesFromXmlTest.java b/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedCamelContextUpdateRoutesFromXmlTest.java
deleted file mode 100644
index 74f1824..0000000
--- a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedCamelContextUpdateRoutesFromXmlTest.java
+++ /dev/null
@@ -1,89 +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.camel.dsl.xml.jaxb.management;
-
-import java.util.Set;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.Test;
-
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_ROUTE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class ManagedCamelContextUpdateRoutesFromXmlTest extends ManagementTestSupport {
-
- @Test
- public void testDumpAsXml() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
- template.sendBody("direct:start", "Hello World");
- assertMockEndpointsSatisfied();
-
- MBeanServer mbeanServer = getMBeanServer();
-
- // there should be 1 routes to start with
- Set<ObjectName> set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(1, set.size(), set.toString());
-
- // update existing route, and add a 2nd
- String xml = "<routes id=\"myRoute\" xmlns=\"http://camel.apache.org/schema/spring\">"
- + "<route id=\"myRoute\">"
- + " <from uri=\"direct:start\"/>"
- + " <log message=\"This is a changed route saying ${body}\"/>"
- + " <to uri=\"mock:changed\"/>"
- + "</route>"
- + "<route id=\"myOtherRoute\">"
- + " <from uri=\"seda:bar\"/>"
- + " <to uri=\"mock:bar\"/>"
- + "</route>"
- + "</routes>";
-
- ObjectName on = getContextObjectName();
- mbeanServer.invoke(on, "addOrUpdateRoutesFromXml", new Object[] { xml }, new String[] { "java.lang.String" });
-
- // there should be 2 routes now
- set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(2, set.size(), set.toString());
-
- // test updated route
- getMockEndpoint("mock:changed").expectedMessageCount(1);
- template.sendBody("direct:start", "Bye World");
- assertMockEndpointsSatisfied();
-
- // test new route
- getMockEndpoint("mock:bar").expectedMessageCount(1);
- template.sendBody("seda:bar", "Hi Camel");
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("myRoute")
- .log("Got ${body}")
- .to("mock:result");
- }
- };
- }
-
-}
diff --git a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedCamelContextUpdateRoutesWithPropertyPlaceholdersFromXmlPTest.java b/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedCamelContextUpdateRoutesWithPropertyPlaceholdersFromXmlPTest.java
deleted file mode 100644
index a71cd12..0000000
--- a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedCamelContextUpdateRoutesWithPropertyPlaceholdersFromXmlPTest.java
+++ /dev/null
@@ -1,149 +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.camel.dsl.xml.jaxb.management;
-
-import java.util.Properties;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.Test;
-
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_ROUTE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class ManagedCamelContextUpdateRoutesWithPropertyPlaceholdersFromXmlPTest extends ManagementTestSupport {
-
- private Properties props;
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- props = new Properties();
- props.put("somewhere", "mock:changed");
- props.put("theBar", "mock:bar");
-
- CamelContext context = super.createCamelContext();
- context.getPropertiesComponent().setOverrideProperties(props);
- return context;
- }
-
- @Test
- public void testUpdate() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
- template.sendBody("direct:start", "Hello World");
- assertMockEndpointsSatisfied();
-
- MBeanServer mbeanServer = getMBeanServer();
-
- // there should be 1 routes to start with
- Set<ObjectName> set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(1, set.size(), set.toString());
-
- // update existing route, and add a 2nd
- String xml = "<routes id=\"myRoute\" xmlns=\"http://camel.apache.org/schema/spring\">"
- + "<route id=\"myRoute\">"
- + " <from uri=\"direct:start\"/>"
- + " <log message=\"This is a changed route saying ${body}\"/>"
- + " <to uri=\"{{somewhere}}\"/>"
- + "</route>"
- + "<route id=\"myOtherRoute\">"
- + " <from uri=\"seda:bar\"/>"
- + " <to uri=\"{{theBar}}\"/>"
- + "</route>"
- + "</routes>";
-
- ObjectName on = getContextObjectName();
- mbeanServer.invoke(on, "addOrUpdateRoutesFromXml", new Object[] { xml }, new String[] { "java.lang.String" });
-
- // there should be 2 routes now
- set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(2, set.size(), set.toString());
-
- // test updated route
- getMockEndpoint("mock:changed").expectedMessageCount(1);
- template.sendBody("direct:start", "Bye World");
- assertMockEndpointsSatisfied();
-
- // test new route
- getMockEndpoint("mock:bar").expectedMessageCount(1);
- template.sendBody("seda:bar", "Hi Camel");
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testUpdateEscaped() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
- template.sendBody("direct:start", "Hello World");
- assertMockEndpointsSatisfied();
-
- MBeanServer mbeanServer = getMBeanServer();
-
- // there should be 1 routes to start with
- Set<ObjectName> set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(1, set.size(), set.toString());
-
- // update existing route, and add a 2nd
- String xml = "<routes id=\"myRoute\" xmlns=\"http://camel.apache.org/schema/spring\">"
- + "<route id=\"myRoute\">"
- + " <from uri=\"direct:start\"/>"
- + " <log message=\"This is a changed route saying ${body}\"/>"
- + " <to uri=\"%7B%7Bsomewhere%7D%7D\"/>"
- + "</route>"
- + "<route id=\"myOtherRoute\">"
- + " <from uri=\"seda:bar\"/>"
- + " <to uri=\"%7B%7BtheBar%7D%7D\"/>"
- + "</route>"
- + "</routes>";
-
- ObjectName on = getContextObjectName();
- mbeanServer.invoke(on, "addOrUpdateRoutesFromXml", new Object[] { xml, true },
- new String[] { "java.lang.String", "boolean" });
-
- // there should be 2 routes now
- set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(2, set.size(), set.toString());
-
- // test updated route
- getMockEndpoint("mock:changed").expectedMessageCount(1);
- template.sendBody("direct:start", "Bye World");
- assertMockEndpointsSatisfied();
-
- // test new route
- getMockEndpoint("mock:bar").expectedMessageCount(1);
- template.sendBody("seda:bar", "Hi Camel");
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("myRoute")
- .log("Got ${body}")
- .to("mock:result");
- }
- };
- }
-
-}
diff --git a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedRouteUpdateRouteFromXmlTest.java b/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedRouteUpdateRouteFromXmlTest.java
deleted file mode 100644
index b854159..0000000
--- a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagedRouteUpdateRouteFromXmlTest.java
+++ /dev/null
@@ -1,151 +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.camel.dsl.xml.jaxb.management;
-
-import java.util.Set;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.Test;
-
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_ROUTE;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
-
-public class ManagedRouteUpdateRouteFromXmlTest extends ManagementTestSupport {
-
- @Test
- public void testUpdateRouteFromXml() throws Exception {
- MBeanServer mbeanServer = getMBeanServer();
- ObjectName on = getRouteObjectName(mbeanServer);
-
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
-
- // should be started
- String routeId = (String) mbeanServer.getAttribute(on, "RouteId");
- assertEquals("myRoute", routeId);
-
- String xml = "<route id=\"myRoute\" xmlns=\"http://camel.apache.org/schema/spring\">"
- + " <from uri=\"direct:start\"/>"
- + " <log message=\"This is a changed route saying ${body}\"/>"
- + " <to uri=\"mock:changed\"/>"
- + "</route>";
-
- mbeanServer.invoke(on, "updateRouteFromXml", new Object[] { xml }, new String[] { "java.lang.String" });
-
- assertEquals(1, context.getRoutes().size(), context.getRoutes().toString());
-
- getMockEndpoint("mock:changed").expectedMessageCount(1);
-
- template.sendBody("direct:start", "Bye World");
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testUpdateRouteFromXmlWithoutRouteId() throws Exception {
- MBeanServer mbeanServer = getMBeanServer();
- ObjectName on = getRouteObjectName(mbeanServer);
-
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
-
- // should be started
- String routeId = (String) mbeanServer.getAttribute(on, "RouteId");
- assertEquals("myRoute", routeId);
-
- String xml = "<route xmlns=\"http://camel.apache.org/schema/spring\">"
- + " <from uri=\"direct:start\"/>"
- + " <log message=\"This is a changed route saying ${body}\"/>"
- + " <to uri=\"mock:changed\"/>"
- + "</route>";
-
- mbeanServer.invoke(on, "updateRouteFromXml", new Object[] { xml }, new String[] { "java.lang.String" });
-
- assertEquals(1, context.getRoutes().size(), context.getRoutes().toString());
-
- getMockEndpoint("mock:changed").expectedMessageCount(1);
-
- template.sendBody("direct:start", "Bye World");
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testUpdateRouteFromXmlMismatchRouteId() throws Exception {
- MBeanServer mbeanServer = getMBeanServer();
- ObjectName on = getRouteObjectName(mbeanServer);
-
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
-
- // should be started
- String routeId = (String) mbeanServer.getAttribute(on, "RouteId");
- assertEquals("myRoute", routeId);
-
- String xml = "<route id=\"foo\" xmlns=\"http://camel.apache.org/schema/spring\">"
- + " <from uri=\"direct:start\"/>"
- + " <log message=\"This is a changed route saying ${body}\"/>"
- + " <to uri=\"mock:changed\"/>"
- + "</route>";
-
- try {
- mbeanServer.invoke(on, "updateRouteFromXml", new Object[] { xml }, new String[] { "java.lang.String" });
- fail("Should have thrown exception");
- } catch (Exception e) {
- assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
- assertEquals("Cannot update route from XML as routeIds does not match. routeId: myRoute, routeId from XML: foo",
- e.getCause().getMessage());
- }
- }
-
- ObjectName getRouteObjectName(MBeanServer mbeanServer) throws Exception {
- Set<ObjectName> set = mbeanServer.queryNames(getCamelObjectName(TYPE_ROUTE, "*"), null);
- assertEquals(1, set.size(), set.toString());
-
- return set.iterator().next();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("myRoute")
- .log("Got ${body}")
- .to("mock:result");
- }
- };
- }
-
-}
diff --git a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagementTestSupport.java b/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagementTestSupport.java
deleted file mode 100644
index 2284b83..0000000
--- a/dsl/camel-xml-jaxb-dsl-test/management/src/test/java/org/apache/camel/dsl/xml/jaxb/management/ManagementTestSupport.java
+++ /dev/null
@@ -1,96 +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.camel.dsl.xml.jaxb.management;
-
-import java.io.IOException;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-
-import org.apache.camel.ContextTestSupport;
-
-import static org.apache.camel.management.DefaultManagementAgent.DEFAULT_DOMAIN;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.KEY_CONTEXT;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.KEY_NAME;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.KEY_TYPE;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_COMPONENT;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_CONTEXT;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_ENDPOINT;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_PROCESSOR;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_ROUTE;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_STEP;
-import static org.apache.camel.management.DefaultManagementObjectNameStrategy.TYPE_THREAD_POOL;
-
-/**
- * Base class for JMX tests.
- */
-public abstract class ManagementTestSupport extends ContextTestSupport {
-
- @Override
- protected boolean useJmx() {
- return true;
- }
-
- protected MBeanServer getMBeanServer() {
- return context.getManagementStrategy().getManagementAgent().getMBeanServer();
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T invoke(MBeanServerConnection server, ObjectName name, String operationName)
- throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
- return (T) server.invoke(name, operationName, null, null);
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T invoke(
- MBeanServerConnection server, ObjectName name, String operationName, Object[] params, String[] signature)
- throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
- return (T) server.invoke(name, operationName, params, signature);
- }
-
- public ObjectName getContextObjectName() throws MalformedObjectNameException {
- return getCamelObjectName(TYPE_CONTEXT, context.getName());
- }
-
- public ObjectName getCamelObjectName(String type, String name) throws MalformedObjectNameException {
- String quote;
- switch (type) {
- case TYPE_CONTEXT:
- case TYPE_COMPONENT:
- case TYPE_ENDPOINT:
- case TYPE_PROCESSOR:
- case TYPE_ROUTE:
- case TYPE_THREAD_POOL:
- case TYPE_STEP:
- quote = "\"";
- break;
- default:
- quote = "";
- break;
- }
- String on = DEFAULT_DOMAIN + ":"
- + KEY_CONTEXT + "=" + context.getManagementName() + ","
- + KEY_TYPE + "=" + type + ","
- + KEY_NAME + "=" + quote + name + quote;
- return ObjectName.getInstance(on);
- }
-}
diff --git a/dsl/camel-xml-jaxb-dsl-test/management/src/test/resources/log4j2-test.properties b/dsl/camel-xml-jaxb-dsl-test/management/src/test/resources/log4j2-test.properties
deleted file mode 100644
index c7d86cb..0000000
--- a/dsl/camel-xml-jaxb-dsl-test/management/src/test/resources/log4j2-test.properties
+++ /dev/null
@@ -1,31 +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.
-## ---------------------------------------------------------------------------
-
-appender.file.type = File
-appender.file.name = file
-appender.file.fileName = target/camel-xml-jaxb-dsl-test-management.log
-appender.file.layout.type = PatternLayout
-appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-appender.out.type = Console
-appender.out.name = out
-appender.out.layout.type = PatternLayout
-appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
-
-rootLogger.level = INFO
-rootLogger.appenderRef.file.ref = file
-#rootLogger.appenderRef.out.ref = out
diff --git a/dsl/camel-xml-jaxb-dsl-test/pom.xml b/dsl/camel-xml-jaxb-dsl-test/pom.xml
index bf238c5..608dc8c 100644
--- a/dsl/camel-xml-jaxb-dsl-test/pom.xml
+++ b/dsl/camel-xml-jaxb-dsl-test/pom.xml
@@ -35,7 +35,6 @@
<modules>
<module>definition</module>
- <module>management</module>
<module>cdi</module>
<module>jbpm</module>
<module>spring</module>