Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 52765200C2C for ; Fri, 3 Mar 2017 10:08:48 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 511E5160B6D; Fri, 3 Mar 2017 09:08:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A6E9F160B57 for ; Fri, 3 Mar 2017 10:08:46 +0100 (CET) Received: (qmail 45453 invoked by uid 500); 3 Mar 2017 09:08:45 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 45442 invoked by uid 99); 3 Mar 2017 09:08:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2017 09:08:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BCFFCDFDE6; Fri, 3 Mar 2017 09:08:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Fri, 03 Mar 2017 09:08:45 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/6] camel git commit: CAMEL-10930: Move groovy dsl into camel-groovy-dsl archived-at: Fri, 03 Mar 2017 09:08:48 -0000 Repository: camel Updated Branches: refs/heads/master 8a7789899 -> 239f093a1 http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/main/resources/dsld/CamelGroovyMethods.dsld ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/main/resources/dsld/CamelGroovyMethods.dsld b/components/camel-groovy-dsl/src/main/resources/dsld/CamelGroovyMethods.dsld new file mode 100644 index 0000000..3bb225a --- /dev/null +++ b/components/camel-groovy-dsl/src/main/resources/dsld/CamelGroovyMethods.dsld @@ -0,0 +1,110 @@ +/******************************************************************************* +* 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. +*******************************************************************************/ + currentType(subType('org.apache.camel.model.ProcessorDefinition')).accept { + method name : 'process', type : 'org.apache.camel.model.ProcessorDefinition', params: [processorLogic : 'groovy.lang.Closure'] + method name : 'enrich', type : 'org.apache.camel.model.ProcessorDefinition', params: [resourceUri : 'java.lang.String', aggregationLogic : 'groovy.lang.Closure'] + method name : 'pollEnrich', type : 'org.apache.camel.model.ProcessorDefinition', params: [resourceUri : 'java.lang.String', aggregationLogic : 'groovy.lang.Closure'] + method name : 'pollEnrich', type : 'org.apache.camel.model.ProcessorDefinition', params: [resourceUri : 'java.lang.String', timeout : 'long', aggregationLogic : 'groovy.lang.Closure'] + method name : 'script', type : 'org.apache.camel.model.ProcessorDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'transform', type : 'org.apache.camel.model.ProcessorDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'setProperty', type : 'org.apache.camel.model.ProcessorDefinition', params: [name : 'java.lang.String', expression : 'groovy.lang.Closure'] + method name : 'setHeader', type : 'org.apache.camel.model.ProcessorDefinition', params: [name : 'java.lang.String', expression : 'groovy.lang.Closure'] + method name : 'setBody', type : 'org.apache.camel.model.ProcessorDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'setFaultBody', type : 'org.apache.camel.model.ProcessorDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'sort', type : 'org.apache.camel.model.ProcessorDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'idempotentConsumer', type : 'org.apache.camel.model.IdempotentConsumerDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'idempotentConsumer', type : 'org.apache.camel.model.IdempotentConsumerDefinition', params: [rep : 'org.apache.camel.spi.IdempotentRepository', expression : 'groovy.lang.Closure'] + method name : 'recipientList', type : 'org.apache.camel.model.RecipientListDefinition', params: [recipients : 'groovy.lang.Closure'] + method name : 'recipientList', type : 'org.apache.camel.model.RecipientListDefinition', params: [delimiter : 'java.lang.String', recipients : 'groovy.lang.Closure'] + method name : 'routingSlip', type : 'org.apache.camel.model.RoutingSlipDefinition', params: [recipients : 'groovy.lang.Closure'] + method name : 'routingSlip', type : 'org.apache.camel.model.RoutingSlipDefinition', params: [delimiter : 'java.lang.String', recipients : 'groovy.lang.Closure'] + method name : 'dynamicRouter', type : 'org.apache.camel.model.DynamicRouterDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'split', type : 'org.apache.camel.model.SplitDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'resequence', type : 'org.apache.camel.model.ResequenceDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'aggregate', type : 'org.apache.camel.model.AggregateDefinition', params: [correlationExpression : 'groovy.lang.Closure'] + method name : 'delay', type : 'org.apache.camel.model.DelayDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'throttle', type : 'org.apache.camel.model.ThrottleDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'loop', type : 'org.apache.camel.model.LoopDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'filter', type : 'org.apache.camel.model.FilterDefinition', params: [predicate : 'groovy.lang.Closure'] + method name : 'validate', type : 'org.apache.camel.model.ProcessorDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.groovy.extend.CamelGroovyMethods')).accept { + method name : 'newExchange', type : 'org.apache.camel.model.WireTapDefinition', params: [self : 'org.apache.camel.model.WireTapDefinition', processorLogic : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.OnExceptionDefinition')).accept { + method name : 'onRedelivery', type : 'org.apache.camel.model.OnExceptionDefinition', params: [processorLogic : 'groovy.lang.Closure'] + method name : 'onWhen', type : 'org.apache.camel.model.OnExceptionDefinition', params: [predicate : 'groovy.lang.Closure'] + method name : 'handled', type : 'org.apache.camel.model.OnExceptionDefinition', params: [predicate : 'groovy.lang.Closure'] + method name : 'continued', type : 'org.apache.camel.model.OnExceptionDefinition', params: [predicate : 'groovy.lang.Closure'] + method name : 'retryWhile', type : 'org.apache.camel.model.OnExceptionDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.MulticastDefinition')).accept { + method name : 'aggregationStrategy', type : 'org.apache.camel.model.MulticastDefinition', params: [aggregationLogic : 'groovy.lang.Closure'] + method name : 'onPrepare', type : 'org.apache.camel.model.MulticastDefinition', params: [processorLogic : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.RecipientListDefinition')).accept { + method name : 'aggregationStrategy', type : 'org.apache.camel.model.RecipientListDefinition', params: [aggregationLogic : 'groovy.lang.Closure'] + method name : 'onPrepare', type : 'org.apache.camel.model.RecipientListDefinition', params: [processorLogic : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.SplitDefinition')).accept { + method name : 'aggregationStrategy', type : 'org.apache.camel.model.SplitDefinition', params: [aggregationLogic : 'groovy.lang.Closure'] + method name : 'onPrepare', type : 'org.apache.camel.model.SplitDefinition', params: [processorLogic : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.AggregateDefinition')).accept { + method name : 'aggregationStrategy', type : 'org.apache.camel.model.AggregateDefinition', params: [aggregationLogic : 'groovy.lang.Closure'] + method name : 'completionSize', type : 'org.apache.camel.model.AggregateDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'completionTimeout', type : 'org.apache.camel.model.AggregateDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'completionPredicate', type : 'org.apache.camel.model.AggregateDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.WireTapDefinition')).accept { + method name : 'onPrepare', type : 'org.apache.camel.model.WireTapDefinition', params: [processorLogic : 'groovy.lang.Closure'] + method name : 'newExchangeBody', type : 'org.apache.camel.model.WireTapDefinition', params: [expression : 'groovy.lang.Closure'] + method name : 'newExchangeHeader', type : 'org.apache.camel.model.WireTapDefinition', params: [header : 'java.lang.String', expression : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.ChoiceDefinition')).accept { + method name : 'when', type : 'org.apache.camel.model.ChoiceDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.TryDefinition')).accept { + method name : 'onWhen', type : 'org.apache.camel.model.TryDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.OnCompletionDefinition')).accept { + method name : 'onWhen', type : 'org.apache.camel.model.OnCompletionDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.CatchDefinition')).accept { + method name : 'onWhen', type : 'org.apache.camel.model.CatchDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.InterceptDefinition')).accept { + method name : 'when', type : 'org.apache.camel.model.InterceptDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.model.InterceptSendToEndpointDefinition')).accept { + method name : 'when', type : 'org.apache.camel.model.InterceptSendToEndpointDefinition', params: [predicate : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.builder.RouteBuilder')).accept { + method name : 'aggregator', type : 'org.apache.camel.processor.aggregate.AggregationStrategy', params: [aggregationLogic : 'groovy.lang.Closure'] + method name : 'expression', type : 'org.apache.camel.Expression', params: [expression : 'groovy.lang.Closure'] + method name : 'predicate', type : 'org.apache.camel.Predicate', params: [predicate : 'groovy.lang.Closure'] + method name : 'processor', type : 'org.apache.camel.Processor', params: [processor : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.builder.ExpressionClause')).accept { + method name : 'expression', type : 'T', params: [expression : 'groovy.lang.Closure'] +} + currentType(subType('org.apache.camel.builder.DataFormatClause')).accept { + method name : 'gnode', type : 'org.apache.camel.model.ProcessorDefinition', params: [namespaceAware : 'boolean'] + method name : 'gnode', type : 'org.apache.camel.model.ProcessorDefinition' + method name : 'gpath', type : 'org.apache.camel.model.ProcessorDefinition', params: [namespaceAware : 'boolean'] + method name : 'gpath', type : 'org.apache.camel.model.ProcessorDefinition' +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/main/resources/gdsl/CamelGroovyMethods.gdsl ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/main/resources/gdsl/CamelGroovyMethods.gdsl b/components/camel-groovy-dsl/src/main/resources/gdsl/CamelGroovyMethods.gdsl new file mode 100644 index 0000000..eac8545 --- /dev/null +++ b/components/camel-groovy-dsl/src/main/resources/gdsl/CamelGroovyMethods.gdsl @@ -0,0 +1,110 @@ +/******************************************************************************* +* 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. +*******************************************************************************/ +contributor([context(ctype: 'org.apache.camel.model.ProcessorDefinition')]) { + method name: 'process', type: 'org.apache.camel.model.ProcessorDefinition', params: [processorLogic: 'groovy.lang.Closure'] + method name: 'enrich', type: 'org.apache.camel.model.ProcessorDefinition', params: [resourceUri: 'java.lang.String', aggregationLogic: 'groovy.lang.Closure'] + method name: 'pollEnrich', type: 'org.apache.camel.model.ProcessorDefinition', params: [resourceUri: 'java.lang.String', aggregationLogic: 'groovy.lang.Closure'] + method name: 'pollEnrich', type: 'org.apache.camel.model.ProcessorDefinition', params: [resourceUri: 'java.lang.String', timeout: 'long', aggregationLogic: 'groovy.lang.Closure'] + method name: 'script', type: 'org.apache.camel.model.ProcessorDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'transform', type: 'org.apache.camel.model.ProcessorDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'setProperty', type: 'org.apache.camel.model.ProcessorDefinition', params: [name: 'java.lang.String', expression: 'groovy.lang.Closure'] + method name: 'setHeader', type: 'org.apache.camel.model.ProcessorDefinition', params: [name: 'java.lang.String', expression: 'groovy.lang.Closure'] + method name: 'setBody', type: 'org.apache.camel.model.ProcessorDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'setFaultBody', type: 'org.apache.camel.model.ProcessorDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'sort', type: 'org.apache.camel.model.ProcessorDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'idempotentConsumer', type: 'org.apache.camel.model.IdempotentConsumerDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'idempotentConsumer', type: 'org.apache.camel.model.IdempotentConsumerDefinition', params: [rep: 'org.apache.camel.spi.IdempotentRepository', expression: 'groovy.lang.Closure'] + method name: 'recipientList', type: 'org.apache.camel.model.RecipientListDefinition', params: [recipients: 'groovy.lang.Closure'] + method name: 'recipientList', type: 'org.apache.camel.model.RecipientListDefinition', params: [delimiter: 'java.lang.String', recipients: 'groovy.lang.Closure'] + method name: 'routingSlip', type: 'org.apache.camel.model.RoutingSlipDefinition', params: [recipients: 'groovy.lang.Closure'] + method name: 'routingSlip', type: 'org.apache.camel.model.RoutingSlipDefinition', params: [delimiter: 'java.lang.String', recipients: 'groovy.lang.Closure'] + method name: 'dynamicRouter', type: 'org.apache.camel.model.DynamicRouterDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'split', type: 'org.apache.camel.model.SplitDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'resequence', type: 'org.apache.camel.model.ResequenceDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'aggregate', type: 'org.apache.camel.model.AggregateDefinition', params: [correlationExpression: 'groovy.lang.Closure'] + method name: 'delay', type: 'org.apache.camel.model.DelayDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'throttle', type: 'org.apache.camel.model.ThrottleDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'loop', type: 'org.apache.camel.model.LoopDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'filter', type: 'org.apache.camel.model.FilterDefinition', params: [predicate: 'groovy.lang.Closure'] + method name: 'validate', type: 'org.apache.camel.model.ProcessorDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.groovy.extend.CamelGroovyMethods')]) { + method name: 'newExchange', type: 'org.apache.camel.model.WireTapDefinition', params: [self: 'org.apache.camel.model.WireTapDefinition', processorLogic: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.OnExceptionDefinition')]) { + method name: 'onRedelivery', type: 'org.apache.camel.model.OnExceptionDefinition', params: [processorLogic: 'groovy.lang.Closure'] + method name: 'onWhen', type: 'org.apache.camel.model.OnExceptionDefinition', params: [predicate: 'groovy.lang.Closure'] + method name: 'handled', type: 'org.apache.camel.model.OnExceptionDefinition', params: [predicate: 'groovy.lang.Closure'] + method name: 'continued', type: 'org.apache.camel.model.OnExceptionDefinition', params: [predicate: 'groovy.lang.Closure'] + method name: 'retryWhile', type: 'org.apache.camel.model.OnExceptionDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.MulticastDefinition')]) { + method name: 'aggregationStrategy', type: 'org.apache.camel.model.MulticastDefinition', params: [aggregationLogic: 'groovy.lang.Closure'] + method name: 'onPrepare', type: 'org.apache.camel.model.MulticastDefinition', params: [processorLogic: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.RecipientListDefinition')]) { + method name: 'aggregationStrategy', type: 'org.apache.camel.model.RecipientListDefinition', params: [aggregationLogic: 'groovy.lang.Closure'] + method name: 'onPrepare', type: 'org.apache.camel.model.RecipientListDefinition', params: [processorLogic: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.SplitDefinition')]) { + method name: 'aggregationStrategy', type: 'org.apache.camel.model.SplitDefinition', params: [aggregationLogic: 'groovy.lang.Closure'] + method name: 'onPrepare', type: 'org.apache.camel.model.SplitDefinition', params: [processorLogic: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.AggregateDefinition')]) { + method name: 'aggregationStrategy', type: 'org.apache.camel.model.AggregateDefinition', params: [aggregationLogic: 'groovy.lang.Closure'] + method name: 'completionSize', type: 'org.apache.camel.model.AggregateDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'completionTimeout', type: 'org.apache.camel.model.AggregateDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'completionPredicate', type: 'org.apache.camel.model.AggregateDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.WireTapDefinition')]) { + method name: 'onPrepare', type: 'org.apache.camel.model.WireTapDefinition', params: [processorLogic: 'groovy.lang.Closure'] + method name: 'newExchangeBody', type: 'org.apache.camel.model.WireTapDefinition', params: [expression: 'groovy.lang.Closure'] + method name: 'newExchangeHeader', type: 'org.apache.camel.model.WireTapDefinition', params: [header: 'java.lang.String', expression: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.ChoiceDefinition')]) { + method name: 'when', type: 'org.apache.camel.model.ChoiceDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.TryDefinition')]) { + method name: 'onWhen', type: 'org.apache.camel.model.TryDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.OnCompletionDefinition')]) { + method name: 'onWhen', type: 'org.apache.camel.model.OnCompletionDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.CatchDefinition')]) { + method name: 'onWhen', type: 'org.apache.camel.model.CatchDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.InterceptDefinition')]) { + method name: 'when', type: 'org.apache.camel.model.InterceptDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.model.InterceptSendToEndpointDefinition')]) { + method name: 'when', type: 'org.apache.camel.model.InterceptSendToEndpointDefinition', params: [predicate: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.builder.RouteBuilder')]) { + method name: 'aggregator', type: 'org.apache.camel.processor.aggregate.AggregationStrategy', params: [aggregationLogic: 'groovy.lang.Closure'] + method name: 'expression', type: 'org.apache.camel.Expression', params: [expression: 'groovy.lang.Closure'] + method name: 'predicate', type: 'org.apache.camel.Predicate', params: [predicate: 'groovy.lang.Closure'] + method name: 'processor', type: 'org.apache.camel.Processor', params: [processor: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.builder.ExpressionClause')]) { + method name: 'expression', type: 'T', params: [expression: 'groovy.lang.Closure'] +} +contributor([context(ctype: 'org.apache.camel.builder.DataFormatClause')]) { + method name: 'gnode', type: 'org.apache.camel.model.ProcessorDefinition', params: [namespaceAware: 'boolean'] + method name: 'gnode', type: 'org.apache.camel.model.ProcessorDefinition' + method name: 'gpath', type: 'org.apache.camel.model.ProcessorDefinition', params: [namespaceAware: 'boolean'] + method name: 'gpath', type: 'org.apache.camel.model.ProcessorDefinition' +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/main/resources/org/apache/camel/language/groovy/ConfigureCamel.groovy ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/main/resources/org/apache/camel/language/groovy/ConfigureCamel.groovy b/components/camel-groovy-dsl/src/main/resources/org/apache/camel/language/groovy/ConfigureCamel.groovy new file mode 100644 index 0000000..9f135f8 --- /dev/null +++ b/components/camel-groovy-dsl/src/main/resources/org/apache/camel/language/groovy/ConfigureCamel.groovy @@ -0,0 +1,48 @@ +/** + * + * 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.language.groovy + +import org.apache.camel.model.ChoiceDefinition; +import org.apache.camel.model.ProcessorDefinition; + +/** + */ +class ConfigureCamel implements Runnable { + + static void main(String[] args) { + new ConfigureCamel().run(); + } + + void run() { + ExpandoMetaClass.enableGlobally(); + + ProcessorDefinition.metaClass.filter = { filter -> + if (filter instanceof Closure) { + filter = CamelGroovyMethods.toExpression(filter) + } + delegate.filter(filter); + } + + ChoiceDefinition.metaClass.when = { filter -> + if (filter instanceof Closure) { + filter = CamelGroovyMethods.toExpression(filter) + } + delegate.when(filter); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/CamelGroovyMethodsTest.groovy ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/CamelGroovyMethodsTest.groovy b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/CamelGroovyMethodsTest.groovy new file mode 100644 index 0000000..2766892 --- /dev/null +++ b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/CamelGroovyMethodsTest.groovy @@ -0,0 +1,244 @@ +/** + * 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.groovy.extend + +import org.apache.camel.EndpointInject +import org.apache.camel.Exchange +import org.apache.camel.builder.RouteBuilder +import org.apache.camel.component.mock.MockEndpoint +import org.apache.camel.test.junit4.CamelTestSupport +import org.junit.Test + +/** + * Test a few DSL extensions. + */ +class CamelGroovyMethodsTest extends CamelTestSupport { + + private static final String HELLO = 'Hello' + private static final String WORLD = 'World' + + @EndpointInject(uri = 'mock:test1') + private MockEndpoint resultEndpoint; + @EndpointInject(uri = 'mock:test2') + private MockEndpoint otherEndpoint; + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + + def aggregation = { Exchange original, Exchange resource -> + original.in.body += resource.in.body + original + } + + return new RouteBuilder() { + + @Override + public void configure() throws Exception { + + from('direct:test1') + .enrich('direct:enrich') { Exchange original, Exchange resource -> + original.in.body += resource.in.body + original + } + .to('mock:test1') + + from('direct:enrich') + .transform(constant(WORLD)) + + from('direct:test2') + .pollEnrich('seda:enrich', aggregation) + .to('mock:test1') + + from('direct:test3') + .process { Exchange e -> + e.in.with { + body = HELLO + headers[HELLO] = WORLD + } + } + .to('mock:test1') + + from('direct:test4') + .setHeader(HELLO) { Exchange e -> + e.in.body.reverse() + } + .to('mock:test1') + + from('direct:test5') + .setProperty(HELLO) { Exchange e -> + e.in.body.reverse() + } + .to('mock:test1') + + from('direct:test6') + .transform { Exchange e -> + e.in.body.reverse() + } + .to('mock:test1') + + from('direct:test7') + .setBody { Exchange e -> + e.in.body.reverse() + } + .to('mock:test1') + + from('direct:test8') + .unmarshal().gpath() + // XmlSlurper proceeds to first node + .transform { it.in.body.World.text() } + .to('mock:test1') + + from('direct:test9') + .unmarshal().gnode() + // XmlParser proceeds to first node + .transform { it.in.body.World.text() } + .to('mock:test1') + + from('direct:test10') + .marshal().gnode() + .convertBodyTo(String) + .to('mock:test1') + + from('direct:test11') + .choice() + .when { it.in.body == HELLO }.to('mock:test1') + .otherwise().to('mock:test2') + + from('direct:test12') + .setHeader(HELLO).expression { Exchange e -> + e.in.body.reverse() + } + .to('mock:test1') + + from('direct:toD') + .toD('mock:${header.foo}') + + } + + } + } + + @Test + void testClosureEnricherAggregation() { + resultEndpoint.expectedBodiesReceived(HELLO + WORLD) + template.sendBody('direct:test1', HELLO) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosurePollingEnricherAggregation() { + resultEndpoint.expectedBodiesReceived(HELLO + WORLD) + template.sendBody('seda:enrich', WORLD) + template.sendBody('direct:test2', HELLO) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureProcessor() { + resultEndpoint.expectedBodiesReceived(HELLO) + resultEndpoint.expectedHeaderReceived(HELLO, WORLD) + template.sendBody('direct:test3', '') + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureSetHeader() { + resultEndpoint.expectedHeaderReceived(HELLO, WORLD) + template.sendBody('direct:test4', WORLD.reverse()) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureSetHeaderWithExpressionClause() { + resultEndpoint.expectedHeaderReceived(HELLO, WORLD) + template.sendBody('direct:test4', WORLD.reverse()) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureSetProperty() { + resultEndpoint.expectedPropertyReceived(HELLO, WORLD) + template.sendBody('direct:test5', WORLD.reverse()) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureTransformer() { + resultEndpoint.expectedBodiesReceived(HELLO) + template.sendBody('direct:test6', HELLO.reverse()) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureSetBody() { + resultEndpoint.expectedBodiesReceived(HELLO) + template.sendBody('direct:test7', HELLO.reverse()) + resultEndpoint.assertIsSatisfied() + } + + @Test + void testClosureChoice1() { + resultEndpoint.expectedBodiesReceived(HELLO) + otherEndpoint.expectedMessageCount(0) + template.sendBody('direct:test11', HELLO) + resultEndpoint.assertIsSatisfied() + otherEndpoint.assertIsSatisfied() + } + + @Test + void testClosureChoice2() { + resultEndpoint.expectedMessageCount(0) + otherEndpoint.expectedBodiesReceived(WORLD) + template.sendBody('direct:test11', WORLD) + resultEndpoint.assertIsSatisfied() + otherEndpoint.assertIsSatisfied() + } + + @Test + void testXmlSlurper() { + String text = "How are you?" + resultEndpoint.expectedBodiesReceived(text) + template.sendBody('direct:test8', "${text}") + resultEndpoint.assertIsSatisfied() + } + + @Test + void testXmlParser() { + String text = "How are you?" + resultEndpoint.expectedBodiesReceived(text) + template.sendBody('direct:test9', "${text}") + resultEndpoint.assertIsSatisfied() + } + + @Test + void testXmlPrinter() { + String text = "How are you?" + Node parsed = new XmlParser().parseText(text) + resultEndpoint.expectedMessageCount(1) + template.sendBody('direct:test10', parsed) + // The created XML differs in terms of white spaces and line feeds. + assertEquals(text.replaceAll('\\s+', ''), resultEndpoint.exchanges[0].in.body.replaceAll('\\s+', '')) + } + + @Test + void testToD() { + resultEndpoint.expectedMessageCount(1) + template.sendBodyAndHeader('direct:toD', WORLD, "foo", "test1") + resultEndpoint.assertIsSatisfied() + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureAggregationStrategyTest.groovy ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureAggregationStrategyTest.groovy b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureAggregationStrategyTest.groovy new file mode 100644 index 0000000..71a9b73 --- /dev/null +++ b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureAggregationStrategyTest.groovy @@ -0,0 +1,55 @@ +/** + * 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.groovy.extend + +import static org.junit.Assert.* +import static org.apache.camel.groovy.extend.CamelGroovyMethods.toAggregationStrategy + +import org.apache.camel.CamelContext +import org.apache.camel.Exchange +import org.apache.camel.impl.DefaultCamelContext +import org.apache.camel.impl.DefaultExchange +import org.junit.Before +import org.junit.Test + + +class ClosureAggregationStrategyTest { + + private Exchange exchange1 + private Exchange exchange2 + private static final String HELLO = "Hello" + private static final String WORLD = "World" + + @Before + public void setUp() throws Exception { + CamelContext context = new DefaultCamelContext() + exchange1 = new DefaultExchange(context); + exchange2 = new DefaultExchange(context); + } + + @Test + public void testAggregationStrategy() { + exchange1.in.body = HELLO + exchange2.in.body = WORLD + ClosureAggregationStrategy cas = toAggregationStrategy { Exchange oldExchange, Exchange newExchange -> + newExchange.in.body = newExchange.in.body + ' ' + oldExchange.in.body + newExchange + } + assertEquals(HELLO + ' ' + WORLD, cas.aggregate(exchange2, exchange1).in.body) + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureExpressionTest.groovy ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureExpressionTest.groovy b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureExpressionTest.groovy new file mode 100644 index 0000000..ecd50a2 --- /dev/null +++ b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureExpressionTest.groovy @@ -0,0 +1,72 @@ +/** + * 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.groovy.extend + +import static org.junit.Assert.* +import static org.apache.camel.groovy.extend.CamelGroovyMethods.toExpression + +import org.apache.camel.Exchange +import org.apache.camel.impl.DefaultCamelContext +import org.apache.camel.impl.DefaultExchange +import org.junit.Before +import org.junit.Test + + +class ClosureExpressionTest { + + private Exchange exchange + private static final String HELLO = "Hello" + + @Before + public void setUp() throws Exception { + exchange = new DefaultExchange(new DefaultCamelContext()); + exchange.in.body = HELLO + } + + @Test + public void testAsExpression() { + ClosureExpression expression = toExpression { Exchange exchange -> + exchange.in.body + } + assertEquals(HELLO, expression.evaluate(exchange)) + } + + @Test + public void testAsPredicate() { + ClosureExpression expressionTrue = toExpression { Exchange exchange -> + exchange.in.body == HELLO + } + assertTrue(expressionTrue.evaluate(exchange)) + ClosureExpression expressionFalse = toExpression { Exchange exchange -> + exchange.in.body != HELLO + } + assertFalse(expressionFalse.evaluate(exchange)) + } + + @Test + public void testClosureException() { + String unknownProperty = 'Gablorg' + ClosureExpression expression = toExpression { Exchange exchange -> + exchange."${unknownProperty}" + } + try { + expression.evaluate(exchange) + } catch (MissingPropertyException e) { + assertTrue(e.message.contains(unknownProperty)) + } + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureProcessorTest.groovy ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureProcessorTest.groovy b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureProcessorTest.groovy new file mode 100644 index 0000000..3733551 --- /dev/null +++ b/components/camel-groovy-dsl/src/test/groovy/org/apache/camel/groovy/extend/ClosureProcessorTest.groovy @@ -0,0 +1,57 @@ +/** + * 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.groovy.extend + +import static org.junit.Assert.* +import static org.apache.camel.groovy.extend.CamelGroovyMethods.toProcessor + +import org.apache.camel.Exchange +import org.apache.camel.impl.DefaultCamelContext +import org.apache.camel.impl.DefaultExchange +import org.junit.Before +import org.junit.Test + + +class ClosureProcessorTest { + + private Exchange exchange + private static final String HELLO = "Hello" + + @Before + public void setUp() throws Exception { + exchange = new DefaultExchange(new DefaultCamelContext()); + } + + @Test + public void testProcessor() { + exchange.in.body = HELLO + ClosureProcessor processor = toProcessor { Exchange exchange -> + exchange.in.body = exchange.in.body.reverse() + } + processor.process(exchange) + assertEquals(HELLO.reverse(), exchange.in.body ) + } + + @Test(expected=NullPointerException) + public void testProcessorException() { + exchange.in.body = null + ClosureProcessor processor = toProcessor { Exchange exchange -> + exchange.in.body = exchange.in.body.reverse() + } + processor.process(exchange) + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/test/resources/log4j2.properties ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/test/resources/log4j2.properties b/components/camel-groovy-dsl/src/test/resources/log4j2.properties new file mode 100644 index 0000000..16b9193 --- /dev/null +++ b/components/camel-groovy-dsl/src/test/resources/log4j2.properties @@ -0,0 +1,30 @@ +## --------------------------------------------------------------------------- +## 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-groovy-dsl-test.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 +logger.springframework.name = org.springframework +logger.springframework.level = WARN +rootLogger.level = INFO +rootLogger.appenderRef.file.ref = file http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/camel-groovy-dsl/src/test/resources/mygroovy.groovy ---------------------------------------------------------------------- diff --git a/components/camel-groovy-dsl/src/test/resources/mygroovy.groovy b/components/camel-groovy-dsl/src/test/resources/mygroovy.groovy new file mode 100644 index 0000000..371a3da --- /dev/null +++ b/components/camel-groovy-dsl/src/test/resources/mygroovy.groovy @@ -0,0 +1,2 @@ +// this is code comments +return "The result is " + body * 2 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/components/pom.xml ---------------------------------------------------------------------- diff --git a/components/pom.xml b/components/pom.xml index d67c729..a40f233 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -46,6 +46,7 @@ camel-spring-dm camel-bam camel-groovy + camel-groovy-dsl camel-scala camel-http-common camel-http http://git-wip-us.apache.org/repos/asf/camel/blob/2a198c2f/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java index 9e70080..2b6fef8 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java @@ -81,13 +81,12 @@ import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNod */ public class SpringBootStarterMojo extends AbstractMojo { - private static final String[] IGNORE_MODULES = { /* OSGi -> */ "camel-blueprint", "camel-core-osgi", "camel-eventadmin", "camel-paxlogging", /* Java EE -> */ "camel-cdi", "camel-ejb", /* deprecated (and not working perfectly) -> */ "camel-swagger", "camel-mina", "camel-ibatis", "camel-quartz", /* currently incompatible */ "camel-jclouds", "camel-spark-rest", - /* others (not managed) -> */ "camel-zipkin"}; + /* others (not managed) -> */ "camel-groovy-dsl", "camel-zipkin"}; private static final boolean IGNORE_TEST_MODULES = true;