Skip to content

Commit

Permalink
added deprecated features processor
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecastro05 committed Sep 16, 2021
1 parent 2e5fc79 commit 0e3b1e4
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
Binary file removed dist/camel-xml2dsl-0.0.14.tar.gz
Binary file not shown.
Binary file added dist/camel-xml2dsl-0.0.15.tar.gz
Binary file not shown.
Binary file removed dist/camel_xml2dsl-0.0.14-py3-none-any.whl
Binary file not shown.
Binary file added dist/camel_xml2dsl-0.0.15-py3-none-any.whl
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = camel-xml2dsl
version = 0.0.14
version = 0.0.15
author = Jorge Castro
author_email = jorgecastro05@hotmail.com
description = xml definition to dsl definition routes
Expand Down
2 changes: 1 addition & 1 deletion src/camel_xml2dsl.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: camel-xml2dsl
Version: 0.0.14
Version: 0.0.15
Summary: xml definition to dsl definition routes
Home-page: https://github.com/jorgecastro05/script-aro.git
Author: Jorge Castro
Expand Down
10 changes: 6 additions & 4 deletions src/xml2dsl/xml2dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rich import console
from rich.console import Console
import importlib.metadata
import re

__version__ = importlib.metadata.version('camel-xml2dsl')
ns = {"camel": "http://camel.apache.org/schema/spring"}
Expand Down Expand Up @@ -154,9 +155,9 @@ def from_def(self, node):

def log_def(self, node):
if 'loggingLevel' in node.attrib:
return '\n.log(LoggingLevel.' + node.attrib['loggingLevel'] + ', "' + node.attrib['message'] + '")'
return '\n.log(LoggingLevel.' + node.attrib['loggingLevel'] + ', "' + self.deprecatedProcessor(node.attrib['message']) + '")'
else:
return '\n.log("' + node.attrib['message'] + '")'
return '\n.log("' + self.deprecatedProcessor(node.attrib['message']) + '")'

def choice_def(self, node):
choice_def = '\n.choice() //' + str(node.sourceline)
Expand All @@ -177,7 +178,7 @@ def otherwise_def(self, node):
def simple_def(self, node):
simple_def = ""
if node.text is not None:
simple_def = 'simple("' + node.text + '")'
simple_def = 'simple("' + self.deprecatedProcessor(node.text) + '")'
else:
simple_def = 'simple("")'
if "resultType" in node.attrib:
Expand Down Expand Up @@ -336,7 +337,8 @@ def threadPoolProfile_def(self, node):

# Text deprecated processor for camel deprecated endpoints and features
# TODO: code
def deprecatedProcessor(text):
def deprecatedProcessor(self, text):
text = re.sub('\${property\.(\w+\.?\w+)}', r'${exchangeProperty.\1}', text) #exhange property in simple expressions
return text

if __name__ == "__main__":
Expand Down

0 comments on commit 0e3b1e4

Please sign in to comment.