[jira] [Commented] (CAMEL-8064) MockEndpointsAndSkip annotation does not resolve property placeholders

2014-11-24 Thread Gareth Western (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14222797#comment-14222797
 ] 

Gareth Western commented on CAMEL-8064:
---

Looks like a straightforward change (reviewed in Fisheye). Thanks for the rapid 
fix!

 MockEndpointsAndSkip annotation does not resolve property placeholders
 --

 Key: CAMEL-8064
 URL: https://issues.apache.org/jira/browse/CAMEL-8064
 Project: Camel
  Issue Type: Improvement
Affects Versions: 2.13.2
Reporter: Gareth Western
Assignee: Willem Jiang
Priority: Minor
 Fix For: 2.14.1, 2.15.0, 2.13.4


 We are using property placeholders in our route configuration in order to 
 switch components in our unit tests. For example:
 {code}
 from(MyRouteBuilder.ENTRY_ENDPOINT)
 .routeId(some.route)
 .process(doSomething())
 .to(MyRouteBuilder.EXIT_ENDPOINT);
 {code}
 Where ENTRY_ENDPOINT = {{entry.endpoint.uri}}
 and EXIT_ENDPOINT = {{exit.endpoint.uri}}
 Then, in production, the Camel context is initialized with a properties file 
 where the URIs use the jms component, while in our unit tests we initialise 
 the context with a 'test' properties file where the URIs use the direct 
 component. For example:
 {code}
 # test.properties
 entry.endpoint.uri = direct:myRouteBuilder.entry
 exit.endpoint.uri = direct:myRouteBuilder.exit
 {code}
 A typical RouteBuilder unit test looks something like this:
 {code}
 @RunWith(CamelSpringJUnit4ClassRunner.class)
 @ContextConfiguration(
 classes = { MyRouteBuilderTest.TestConfig.class },
 loader = CamelSpringDelegatingTestContextLoader.class
 )
 @MockEndpointsAndSkip(value =  direct:myRouteBuilder.exit)
 public class MyRouteBuilderTest {
 @Produce(uri = MyRouteBuilder.ENTRY_ENDPOINT)
 private ProducerTemplate myRouteBuilderProducer;
 @EndpointInject(uri = mock: + MyRouteBuilder.EXIT_ENDPOINT)
 private MockEndpoint mockOutputServiceEndpoint;
 @Autowired
 private CamelContext camelContext;
 @Test
 public void testSomething() {
 
 }
 @Configuration
 public static class TestConfig extends SingleRouteCamelConfiguration {
 @Override
 protected void setupCamelContext(CamelContext camelContext) throws 
 Exception {
 super.setupCamelContext(camelContext);
 PropertiesComponent prop = 
 camelContext.getComponent(properties, PropertiesComponent.class);
 prop.setLocation(myRouteBuilder.test.properties);
 }
 @Override
 public RouteBuilder route() {
 return new MyRouteBuilder();
 }
 }
 {code}
 The issue we're having is that the @MockEndpointsAndSkip annotation on the 
 test class does not resolve property placeholders, therefore we have to write 
 the resolved value instead of the property placeholder value (which is a 
 public static variable in the RouteBuilder implementation) I.e. we want to 
 use MyRouteBuilder.EXIT_ENDPOINT instead of direct:myRouteBuilder.exit.
 It would be nicer to avoid having duplicate extra hard-coded Strings if 
 possible, so that if the endpoint uri value is updated in the property file 
 then all the tests don't also have to be updated.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (CAMEL-8070) Supporting byte[] messages in camel-websocket

2014-11-24 Thread Akitoshi Yoshida (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-8070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Akitoshi Yoshida resolved CAMEL-8070.
-
   Resolution: Fixed
Fix Version/s: 2.15.0

 Supporting byte[] messages in camel-websocket
 -

 Key: CAMEL-8070
 URL: https://issues.apache.org/jira/browse/CAMEL-8070
 Project: Camel
  Issue Type: Improvement
  Components: camel-websocket
Affects Versions: 2.14.0
Reporter: Akitoshi Yoshida
Assignee: Akitoshi Yoshida
 Fix For: 2.14.1, 2.15.0


 camel-websocket currently does not handle byte[] messages. 
 http://camel.465427.n5.nabble.com/AHS-WS-problem-td5759334.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8066) Add swagger ui to the camel swagger rest example

2014-11-24 Thread Charles Moulliard (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14223202#comment-14223202
 ] 

Charles Moulliard commented on CAMEL-8066:
--

Project has been updated to avoid to include into the src/main/webapp all the 
swagger-ui resources.
3 plugins have been added to the project :
- Step 1. - Download Swagger UI project from GitHub
- Step 2. - Decompress content and move it to target/swagger-ui folder
- Step 3. - Copy Web Resources to target/classes but also to target/swagger-ui
- Step 4.  Add Swagger-ui Resources to the WAR

 Add swagger ui to the camel swagger rest example
 

 Key: CAMEL-8066
 URL: https://issues.apache.org/jira/browse/CAMEL-8066
 Project: Camel
  Issue Type: Improvement
  Components: examples
Affects Versions: 2.14.0
Reporter: Charles Moulliard
Assignee: Charles Moulliard
 Fix For: 2.15.0


 The example camel-example-servlet-rest-tomcat uses the camel swagger 
 component to register the swagger servlet able to discover and generates json 
 files for the REST service.
 The goal of this improvement is to add the swagger-ui resources (html, css, 
 js, ...) to allow the user to discover the operations of the REST services 
 and play with them.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8001) SmppUtils.isGsm0338Encodeable() called with arbitrary data

2014-11-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14223233#comment-14223233
 ] 

ASF GitHub Bot commented on CAMEL-8001:
---

GitHub user dpocock opened a pull request:

https://github.com/apache/camel/pull/339

Dpocock bug 8001

See https://issues.apache.org/jira/browse/CAMEL-8001

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dpocock/camel dpocock-bug-8001

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/camel/pull/339.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #339


commit c72c327cad45e79416ef5f524eba0bb4c95f07f2
Author: Daniel Pocock dan...@pocock.pro
Date:   2014-11-24T18:11:31Z

CAMEL-8001: Add javadoc comments about the expectation that the argument is 
ISO-8859-1 encoded

commit 1945bde0e522b50da626bf9d1650bedee074f1d9
Author: Daniel Pocock dan...@pocock.pro
Date:   2014-11-24T18:12:34Z

CAMEL-8001: only try to use SmppUtils.isGsm0338Encodeable for content that 
can already be ISO-8859-1 encoded




 SmppUtils.isGsm0338Encodeable() called with arbitrary data
 --

 Key: CAMEL-8001
 URL: https://issues.apache.org/jira/browse/CAMEL-8001
 Project: Camel
  Issue Type: Bug
  Components: camel-smpp
Affects Versions: 2.12.2
 Environment: n/a
Reporter: Daniel Pocock
  Labels: patch
 Attachments: determineAlphabet_fix.patch


 The method SmppUtils.isGsm0338Encodeable(byte[]) expects the input data to be 
 Latin1 encoded (or a subset of Latin1, such as ASCII)
 The method SmppSmCommand.determineAlphabet(Message) prepares an argument by 
 calling String.getBytes(charset) without checking the charset is Latin1 or 
 compatible.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8001) SmppUtils.isGsm0338Encodeable() called with arbitrary data

2014-11-24 Thread Daniel Pocock (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14223235#comment-14223235
 ] 

Daniel Pocock commented on CAMEL-8001:
--

I've submitted as a pull request

https://github.com/apache/camel/pull/339

 SmppUtils.isGsm0338Encodeable() called with arbitrary data
 --

 Key: CAMEL-8001
 URL: https://issues.apache.org/jira/browse/CAMEL-8001
 Project: Camel
  Issue Type: Bug
  Components: camel-smpp
Affects Versions: 2.12.2
 Environment: n/a
Reporter: Daniel Pocock
  Labels: patch
 Attachments: determineAlphabet_fix.patch


 The method SmppUtils.isGsm0338Encodeable(byte[]) expects the input data to be 
 Latin1 encoded (or a subset of Latin1, such as ASCII)
 The method SmppSmCommand.determineAlphabet(Message) prepares an argument by 
 calling String.getBytes(charset) without checking the charset is Latin1 or 
 compatible.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8077) NullPointerException in getRouteDefinition before context is started

2014-11-24 Thread Camel Guy (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14223256#comment-14223256
 ] 

Camel Guy commented on CAMEL-8077:
--

Yes, I am using 2.14.1-SNAPSHOT.

route.getId() returns null when the context has not started. There was a time 
when I could get one route by id successfully but not another, with no clear 
difference between the two.

{noformat}
public synchronized RouteDefinition getRouteDefinition(String id) {
for (RouteDefinition route : routeDefinitions) {
if (route.getId().equals(id)) {
return route;
}
}
return null;
}
{noformat}

However, after adding import and routeContextRef, that failed too. The 
route I'm trying to grab is in the main context file, not in the imported one.

It appears that camel-context.xml is loaded in a background thread and has a 
race condition with my @Before methods. I have the same problem with @Test 
methods. I tried sleeping for, say, a minute in @Begin and @Test and that 
doesn't fix the problem. The only fix is to call context.start().

Here's my test.java

{noformat}
package my.test;

import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.junit.Before;
import org.junit.Test;

public final class OneJDBCErrorTest extends CamelSpringTestSupport {
protected AbstractXmlApplicationContext createApplicationContext() {
return new 
ClassPathXmlApplicationContext(META-INF/spring/camel-context.xml);
}

@EndpointInject(uri=direct:Start)
private ProducerTemplate start;

@EndpointInject(uri=mock:Test:JDBC:TotalExceptions)
private MockEndpoint mockTotalExceptions;

@EndpointInject(uri=mock:Test:JDBC:Failed)
private MockEndpoint mockJdbcFailed;

@Override
public boolean isUseAdviceWith() {
return true;
}

@Before
final public void jdbcError() throws Exception {
context.start(); // bug in 2.14 - this is needed

ModelCamelContext model = (ModelCamelContext) context;

RouteDefinition jdbc = model.getRouteDefinition(SQL:JDBC);

jdbc.adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {

weaveById(test:SQL:JDBC:NextError).before().to(mock:Test:JDBC:TotalExceptions);
}
}
);
}

@Test
final public void oneFailure() throws Exception {
mockTotalExceptions.expectedMessageCount(4);
mockJdbcFailed.expectedMessageCount(0);

context.start();
start.sendBody();

mockTotalExceptions.assertIsSatisfied();
mockJdbcFailed.assertIsSatisfied();

context.stop();
}
}
{noformat}


 NullPointerException in getRouteDefinition before context is started
 

 Key: CAMEL-8077
 URL: https://issues.apache.org/jira/browse/CAMEL-8077
 Project: Camel
  Issue Type: Bug
  Components: camel-core
Affects Versions: 2.14.1
Reporter: Camel Guy

 Not sure if this occurs in 2.14.0. Does not occur in 2.13.3.
 I am extending CamelSpringTestSupport with:
 @Override
 public boolean isUseAdviceWith() {
 return true;
 }
 In a @Before method I call context.getRouteDefintion(some.id)
 It throws a NullPointerException:
 org.apache.camel.impl.DefaultCamelContext.getRouteDefinition(DefaultCamelContext.java:1464)
 If I put context.start() at the top of the @Before method, it works.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (CAMEL-8077) NullPointerException in getRouteDefinition before context is started

2014-11-24 Thread Camel Guy (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14223256#comment-14223256
 ] 

Camel Guy edited comment on CAMEL-8077 at 11/24/14 6:34 PM:


Yes, I am using 2.14.1-SNAPSHOT.

route.getId() returns null when the context has not started.

{noformat}
public synchronized RouteDefinition getRouteDefinition(String id) {
for (RouteDefinition route : routeDefinitions) {
if (route.getId().equals(id)) {
return route;
}
}
return null;
}
{noformat}

There was a time when I could get one route via getRouteDefinition by id 
successfully but not another. getRouteDefinition(A) = successful but 
getRouteDefinition(B) = exception. The difference is that route B is declared 
in camel-context.xml after route A.

However, after adding import and routeContextRef, getRouteDefinition(A) 
failed too. The route I'm trying to grab is in the main context file, not in 
the imported one.

It appears that camel-context.xml is loaded in a background thread and has a 
race condition with my methods. I have the same problem with @Test methods. I 
tried sleeping for, say, a minute in @Begin and @Test and that doesn't fix the 
problem. The only fix is to call context.start().

Here's my test.java

{noformat}
package my.test;

import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.junit.Before;
import org.junit.Test;

public final class OneJDBCErrorTest extends CamelSpringTestSupport {
protected AbstractXmlApplicationContext createApplicationContext() {
return new 
ClassPathXmlApplicationContext(META-INF/spring/camel-context.xml);
}

@EndpointInject(uri=direct:Start)
private ProducerTemplate start;

@EndpointInject(uri=mock:Test:JDBC:TotalExceptions)
private MockEndpoint mockTotalExceptions;

@EndpointInject(uri=mock:Test:JDBC:Failed)
private MockEndpoint mockJdbcFailed;

@Override
public boolean isUseAdviceWith() {
return true;
}

@Before
final public void jdbcError() throws Exception {
context.start(); // bug in 2.14 - this is needed

ModelCamelContext model = (ModelCamelContext) context;

RouteDefinition jdbc = model.getRouteDefinition(SQL:JDBC);

jdbc.adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {

weaveById(test:SQL:JDBC:NextError).before().to(mock:Test:JDBC:TotalExceptions);
}
}
);
}

@Test
final public void oneFailure() throws Exception {
mockTotalExceptions.expectedMessageCount(4);
mockJdbcFailed.expectedMessageCount(0);

context.start();
start.sendBody();

mockTotalExceptions.assertIsSatisfied();
mockJdbcFailed.assertIsSatisfied();

context.stop();
}
}
{noformat}



was (Author: camelguy):
Yes, I am using 2.14.1-SNAPSHOT.

route.getId() returns null when the context has not started. There was a time 
when I could get one route by id successfully but not another, with no clear 
difference between the two.

{noformat}
public synchronized RouteDefinition getRouteDefinition(String id) {
for (RouteDefinition route : routeDefinitions) {
if (route.getId().equals(id)) {
return route;
}
}
return null;
}
{noformat}

However, after adding import and routeContextRef, that failed too. The 
route I'm trying to grab is in the main context file, not in the imported one.

It appears that camel-context.xml is loaded in a background thread and has a 
race condition with my @Before methods. I have the same problem with @Test 
methods. I tried sleeping for, say, a minute in @Begin and @Test and that 
doesn't fix the problem. The only fix is to call context.start().

Here's my test.java

{noformat}
package my.test;

import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
import 

[jira] [Comment Edited] (CAMEL-8077) NullPointerException in getRouteDefinition before context is started

2014-11-24 Thread Camel Guy (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14223256#comment-14223256
 ] 

Camel Guy edited comment on CAMEL-8077 at 11/24/14 7:33 PM:


Yes, I am using 2.14.1-SNAPSHOT.

route.getId() returns null when the context has not started.

{noformat}
public synchronized RouteDefinition getRouteDefinition(String id) {
for (RouteDefinition route : routeDefinitions) {
if (route.getId().equals(id)) {
return route;
}
}
return null;
}
{noformat}

There was a time when I could get one route via getRouteDefinition by id 
successfully but not another. getRouteDefinition(A) = successful but 
getRouteDefinition(B) = exception. The difference is that route B is declared 
in camel-context.xml after route A.

However, after adding import and routeContextRef, getRouteDefinition(A) 
failed too. The route I'm trying to grab is in the main context file, not in 
the imported one.

It appears that camel-context.xml is loaded in a background thread and has a 
race condition with my methods. I have the same problem with @Test methods. I 
tried sleeping for, say, a minute in @Begin but that doesn't fix the problem. I 
also moved the @Begin code to the @Test method and put a sleep there. That 
doesn't work either. The only fix is to call context.start().

In camel-context.xml most routes do not specify an id attribute.

Here's my test.java

{noformat}
package my.test;

import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.junit.Before;
import org.junit.Test;

public final class OneJDBCErrorTest extends CamelSpringTestSupport {
protected AbstractXmlApplicationContext createApplicationContext() {
return new 
ClassPathXmlApplicationContext(META-INF/spring/camel-context.xml);
}

@EndpointInject(uri=direct:Start)
private ProducerTemplate start;

@EndpointInject(uri=mock:Test:JDBC:TotalExceptions)
private MockEndpoint mockTotalExceptions;

@EndpointInject(uri=mock:Test:JDBC:Failed)
private MockEndpoint mockJdbcFailed;

@Override
public boolean isUseAdviceWith() {
return true;
}

@Before
final public void jdbcError() throws Exception {
context.start(); // bug in 2.14 - this is needed

ModelCamelContext model = (ModelCamelContext) context;

RouteDefinition jdbc = model.getRouteDefinition(SQL:JDBC);

jdbc.adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {

weaveById(test:SQL:JDBC:NextError).before().to(mock:Test:JDBC:TotalExceptions);
}
}
);
}

@Test
final public void oneFailure() throws Exception {
mockTotalExceptions.expectedMessageCount(4);
mockJdbcFailed.expectedMessageCount(0);

context.start();
start.sendBody();

mockTotalExceptions.assertIsSatisfied();
mockJdbcFailed.assertIsSatisfied();

context.stop();
}
}
{noformat}



was (Author: camelguy):
Yes, I am using 2.14.1-SNAPSHOT.

route.getId() returns null when the context has not started.

{noformat}
public synchronized RouteDefinition getRouteDefinition(String id) {
for (RouteDefinition route : routeDefinitions) {
if (route.getId().equals(id)) {
return route;
}
}
return null;
}
{noformat}

There was a time when I could get one route via getRouteDefinition by id 
successfully but not another. getRouteDefinition(A) = successful but 
getRouteDefinition(B) = exception. The difference is that route B is declared 
in camel-context.xml after route A.

However, after adding import and routeContextRef, getRouteDefinition(A) 
failed too. The route I'm trying to grab is in the main context file, not in 
the imported one.

It appears that camel-context.xml is loaded in a background thread and has a 
race condition with my methods. I have the same problem with @Test methods. I 
tried sleeping for, say, a minute in @Begin but that doesn't fix the problem. 
The only fix is to call context.start().

In camel-context.xml most routes do not specify an id attribute.

Here's my test.java


[jira] [Reopened] (CAMEL-7949) JmsMessageHelper to support automatic conversion from ByteBuffer to BytesMessage

2014-11-24 Thread Aaron Whiteside (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-7949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aaron Whiteside reopened CAMEL-7949:


Attached new patch that completely resolves this issue and a few others..

 JmsMessageHelper to support automatic conversion from ByteBuffer to 
 BytesMessage
 

 Key: CAMEL-7949
 URL: https://issues.apache.org/jira/browse/CAMEL-7949
 Project: Camel
  Issue Type: Improvement
  Components: camel-sjms
Affects Versions: 2.14.0
Reporter: Aaron Whiteside
Assignee: Claus Ibsen
Priority: Minor
 Fix For: 2.15.0


 JmsMessageHelper to support automatic conversion from ByteBuffer to 
 BytesMessage.
 Looking at the code, byte[] and InputStream conversion to BytesMessage could 
 utilize camel's built in type conversion functionality and not reimplement it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CAMEL-7949) JmsMessageHelper to support automatic conversion from ByteBuffer to BytesMessage

2014-11-24 Thread Aaron Whiteside (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-7949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aaron Whiteside updated CAMEL-7949:
---
Attachment: CAMEL-7949.patch

Breakdown of changes for review:

{code}
AbstractMessageHandler
- Removed commitStrategy field and corresponding getter, not used anywhere.
- Updated to use JmsMessageHelper instead of SjmsExchangeMessageHelper.

InOutMessageHandler
- Updated to use JmsMessageHelper instead of SjmsExchangeMessageHelper.
- Updated to use JmsConstants.
- Fixed typo in inner class name MessageHandlerAsyncCallback
- close() cleaned up, no point wrapping an exception if you're not going to 
throw it.

InOnlyMessageHandler
- Minor cleanup to handleMessage()

JmsConstants
- None of the existing constants were used by anything, so removed those.
- Made the class into an interface.
- Moved all the JMS constants from JmsMessageHelper into here.
- Added two more to do with JMS delivery mode.

InOutProducer
- TreeMap replaced with ConcurrentHashMap, because..
  - Non-static lock was guarding a static field.. so not really useful.
  - MessageConsumerResourcesFactory.makeObject() anonymous 
MessageListener.onMessage() was accessing exchangeMap without using the lock. I 
seriously doubt we need the TreeMap and lock, a ConcurrentHashMap will surely 
be good enough, I suspect the tester got better performance because they were 
not actually aquiring the read lock... and/or had separate write locks per 
instance of InOutProducer.
- Constructor, removed pointless call to Endpoint.getConsumerCount().
- MessageConsumerResourcesFactory.makeObject() anonymous 
MessageListener.onMessage() swallows Exceptions by wrapping them and never 
throwing them.
- sendMessage(), now uses JmsMessageHelper instead of SjmsExchangeMessageHelper
- sendMessage(), now uses JmsConstants instead of hardcoded strings.
- sendMessage(), removed usage of lock.

InOnlyProducer
- sendMessage(), updated to use the simpler version of the 
JmsMessageHelper.createMessage() method.


JmsMessageHeaderType
- Duplicated constants in JmsMessageHelper.
- Replaced by JmsConstants.
- Class no longer needed.

JmsMessageHelper
- now implements JmsConstants, constants moved into JmsConstants.
- createMessage()
 - use entrySet() instead of keySet() for Map conversion, more efficient.
 - StreamMessage is not a InputStream message... updated to work off a 
Collection instead, much closer to what a StreamMessage is.
 - Only use toString() value of key for Map messages.
- setProperty(), now allows null values as per the JMS spec.
- discoverMessageTypeFromPayload()
 - Corrected Byte[] to byte[], as no one uses Byte[]'s.
 - Collection is no longer mapped to Map, collection is mapped to Stream.
 - Map is mapped to Map.
 - Added CharBuffer to Text conversion.
 - Fixed Reader to Text conversion, as Readers deal with chars not bytes.

SjmsExchangeMessageHelper
- Duplicated code with JmsMessageHelper, so moved non duplicated methods to 
JmsMessageHelper and deleted class.
- Moved methods:
  - hasIllegalHeaderKey
  - getJMSReplyTo
  - setJMSReplyTo
  - getJMSType
  - setJmsMessageHeaders
  - createMessage
  - populateExchange
  - createExchange


JMSMessageHelperTypeConversionTest
- Renamed JmsMessageHelperTypeConversionTest to match JmsMessageHelper class 
name.
- Added test for Map conversion.
- Added test for byte[] conversion.
- Added test for CharBuffer conversion.
- Fixed Reader conversion test.
- Fixed StringReader conversion test.

{code}

 JmsMessageHelper to support automatic conversion from ByteBuffer to 
 BytesMessage
 

 Key: CAMEL-7949
 URL: https://issues.apache.org/jira/browse/CAMEL-7949
 Project: Camel
  Issue Type: Improvement
  Components: camel-sjms
Affects Versions: 2.14.0
Reporter: Aaron Whiteside
Assignee: Claus Ibsen
Priority: Minor
 Fix For: 2.15.0

 Attachments: CAMEL-7949.patch


 JmsMessageHelper to support automatic conversion from ByteBuffer to 
 BytesMessage.
 Looking at the code, byte[] and InputStream conversion to BytesMessage could 
 utilize camel's built in type conversion functionality and not reimplement it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CAMEL-8078) camel-restlet should support to decode the response entity which is represent resource

2014-11-24 Thread Willem Jiang (JIRA)
Willem Jiang created CAMEL-8078:
---

 Summary: camel-restlet should support to decode the response 
entity which is represent resource
 Key: CAMEL-8078
 URL: https://issues.apache.org/jira/browse/CAMEL-8078
 Project: Camel
  Issue Type: Improvement
  Components: camel-restlet
Reporter: Willem Jiang
Assignee: Willem Jiang
 Fix For: 2.14.1, 2.15.0, 2.13.4


Current camel-restlet producer doesn't support to decode the GZIP response out 
of box.
You can find more information from [this 
thread|http://camel.465427.n5.nabble.com/Camel-Restlet-2-14-0-DecodeRepresentation-td5759382.html]
 of camel user mailing list



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Assigned] (CAMEL-8001) SmppUtils.isGsm0338Encodeable() called with arbitrary data

2014-11-24 Thread Willem Jiang (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-8001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Willem Jiang reassigned CAMEL-8001:
---

Assignee: Willem Jiang

 SmppUtils.isGsm0338Encodeable() called with arbitrary data
 --

 Key: CAMEL-8001
 URL: https://issues.apache.org/jira/browse/CAMEL-8001
 Project: Camel
  Issue Type: Bug
  Components: camel-smpp
Affects Versions: 2.12.2
 Environment: n/a
Reporter: Daniel Pocock
Assignee: Willem Jiang
  Labels: patch
 Attachments: determineAlphabet_fix.patch


 The method SmppUtils.isGsm0338Encodeable(byte[]) expects the input data to be 
 Latin1 encoded (or a subset of Latin1, such as ASCII)
 The method SmppSmCommand.determineAlphabet(Message) prepares an argument by 
 calling String.getBytes(charset) without checking the charset is Latin1 or 
 compatible.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)