Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WINDUPRULE-483,492,498,499,500,509,484,606,429 (#449)
* WINDUPRULE-482 -add removed class groovy rule * WINDUPRULE-428: Add rule for auth token change in camel-telegram * WINDUPRULE-428: Add rule for auth token change in camel-telegram * WINDUPRULE-499 Add rule for mandatory passphrase in shiro component * WINDUPRULE-492 add rules for removed out messages from simple and mock * WINDUPRULE-509 languages changes * WINDUPRULE-498 - Add optional migration rule for crypto dataformat * WINDUPRULE-500 add rules for XML security changes * WINDUPRULE-483 Add rule for removed ,consumer prefix * WINDUPRULE-484: Add rule for changes in tracing * WINDUPRULE-606: add information rules about crypto and xmlsecurity components * WINDUPRULE-429 - Add rule for xslt-saxon * fix issues related to #449 Co-authored-by: Matej Melko <mmelko@pop-os.localdomain>
- Loading branch information
Showing
11 changed files
with
853 additions
and
14 deletions.
There are no files selected for viewing
281 changes: 272 additions & 9 deletions
281
rules-reviewed/camel3/camel2/component-changes.windup.groovy
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
rules-reviewed/camel3/camel2/tests/data/component-changes/MessageEncryptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package camelinaction; | ||
|
||
import java.security.Key; | ||
import java.security.KeyStore; | ||
|
||
import org.apache.camel.Exchange; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.converter.crypto.CryptoDataFormat; | ||
import org.apache.camel.impl.JndiRegistry; | ||
import org.apache.camel.test.junit4.CamelTestSupport; | ||
import org.apache.camel.util.jsse.KeyStoreParameters; | ||
import org.junit.Test; | ||
|
||
public class MessageEncryptionTest extends CamelTestSupport { | ||
|
||
private Key secretKey; | ||
|
||
@Override | ||
protected JndiRegistry createRegistry() throws Exception { | ||
JndiRegistry registry = super.createRegistry(); | ||
|
||
KeyStoreParameters keystore = new KeyStoreParameters(); | ||
keystore.setPassword("supersecret"); | ||
keystore.setResource("./cia_secrets.jceks"); | ||
keystore.setType("JCEKS"); | ||
|
||
KeyStore store = keystore.createKeyStore(); | ||
secretKey = store.getKey("ciasecrets", "secret".toCharArray()); | ||
registry.bind("secretKey", secretKey); | ||
return registry; | ||
} | ||
|
||
|
||
@Test | ||
public void testEncryptAndDecryptMessage() throws Exception { | ||
getMockEndpoint("mock:unencrypted").expectedBodiesReceived("Hello World"); | ||
|
||
template.sendBody("direct:start", "Hello World"); | ||
|
||
assertMockEndpointsSatisfied(); | ||
|
||
Exchange exchange = getMockEndpoint("mock:encrypted").getReceivedExchanges().get(0); | ||
assertNotEquals("Hello World", exchange.getIn().getBody()); | ||
} | ||
|
||
@Override | ||
protected RouteBuilder createRouteBuilder() throws Exception { | ||
return new RouteBuilder() { | ||
@Override | ||
public void configure() throws Exception { | ||
CryptoDataFormat crypto = new CryptoDataFormat("DES", secretKey); | ||
|
||
from("direct:start") | ||
.marshal(crypto) | ||
.to("mock:encrypted") | ||
.unmarshal(crypto) | ||
.to("mock:unencrypted"); | ||
} | ||
}; | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
rules-reviewed/camel3/camel2/tests/data/component-changes/MultiplePoliciesOnRouteTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package org.apache.camel.routepolicy.quartz2; | ||
|
||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
import org.apache.camel.ServiceStatus; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.component.mock.MockEndpoint; | ||
import org.apache.camel.component.quartz2.QuartzComponent; | ||
import org.apache.camel.impl.JndiRegistry; | ||
import org.apache.camel.OutHeaders; | ||
import org.apache.camel.impl.ThrottlingInflightRoutePolicy; | ||
import org.apache.camel.spi.RoutePolicy; | ||
import org.apache.camel.test.junit4.CamelTestSupport; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @version | ||
*/ | ||
public class MultiplePoliciesOnRouteTest extends CamelTestSupport { | ||
private String url = "seda:foo?concurrentConsumers=20"; | ||
private int size = 100; | ||
|
||
@Override | ||
protected JndiRegistry createRegistry() throws Exception { | ||
JndiRegistry registry = new JndiRegistry(createJndiContext()); | ||
registry.bind("startPolicy", createRouteStartPolicy()); | ||
registry.bind("throttlePolicy", createThrottlePolicy()); | ||
return registry; | ||
} | ||
|
||
private RoutePolicy createThrottlePolicy() { | ||
ThrottlingInflightRoutePolicy policy = new ThrottlingInflightRoutePolicy(); | ||
policy.setMaxInflightExchanges(10); | ||
return policy; | ||
} | ||
|
||
public String outHeaders(String name, int amount, String customer, @OutHeaders Map<String, Object> outHeaders) { | ||
outHeaders.put("partName", name); | ||
outHeaders.put("quantity", amount); | ||
outHeaders.put("customer", customer); | ||
return "dummy"; | ||
} | ||
|
||
@Test | ||
public void testMultiplePoliciesOnRoute() throws Exception { | ||
MockEndpoint success = context.getEndpoint("mock:success", MockEndpoint.class); | ||
success.expectedMinimumMessageCount(size - 10); | ||
success.message(0).outBody().contains("foo"); | ||
success.message(0).outBody(String.class).contains("foo"); | ||
success.message(0).outHeaders().contains("foo"); | ||
context.getComponent("quartz2", QuartzComponent.class).setPropertiesFile("org/apache/camel/routepolicy/quartz2/myquartz.properties"); | ||
context.addRoutes(new RouteBuilder() { | ||
public void configure() { | ||
from(url) | ||
.routeId("test") | ||
.routePolicyRef("startPolicy, throttlePolicy") | ||
.to("log:foo?groupSize=10") | ||
.to("mock:success"); | ||
} | ||
}); | ||
context.start(); | ||
|
||
assertTrue(context.getRouteStatus("test") == ServiceStatus.Started); | ||
for (int i = 0; i < size; i++) { | ||
template.sendBody(url, "Message " + i); | ||
Thread.sleep(3); | ||
} | ||
|
||
context.getComponent("quartz2", QuartzComponent.class).stop(); | ||
success.assertIsSatisfied(); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.