This file contains hidden or 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
public class UserRepository { | |
public User getById(long id) { | |
User user = users.get(id); | |
user.setWallets(() -> walletRepository.getByUserId(id)); | |
return user; | |
} | |
} |
This file contains hidden or 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
public class User { | |
private long id; | |
private String name; | |
private Supplier<List<Wallet>> wallets; | |
public void setWallets(Supplier<List<Wallet>> wallets) { | |
this.wallets = wallets; | |
} | |
public List<Wallet> getWallets() { |
This file contains hidden or 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
public class User { | |
private long id; | |
private String name; | |
private List<Wallet> wallets; | |
} |
This file contains hidden or 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
FROM ubuntu | |
CMD ["tail", "-f", "/dev/null"] |
This file contains hidden or 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
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: ubuntu-test | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: ubuntu-test |
This file contains hidden or 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
@Test | |
public void test_fruit_is_routed_to_the_fruits_processor_via_groceries_queue() throws InterruptedException { | |
//given | |
Fruit apple = new Fruit("apple", "England"); | |
ProducerTemplate producer = camelContext.createProducerTemplate(); | |
//when | |
producer.sendBody(GroceriesRouteBuilder.GROCERIES_QUEUE, apple); | |
//then |
This file contains hidden or 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
@RunWith(CamelSpringJUnit4ClassRunner.class) | |
@ContextConfiguration( | |
classes = {GroceriesRouteBuilderTest.ContextConfig.class}, | |
loader = CamelSpringDelegatingTestContextLoader.class) | |
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) | |
public class GroceriesRouteBuilderTest { | |
@Autowired | |
@Qualifier(GroceriesRouteBuilder.FRUIT_PROCESSOR) | |
MockEndpoint fruitProcessor; |
This file contains hidden or 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
public class GroceriesRouteBuilder extends RouteBuilder { | |
public static final String VEGETABLES_QUEUE = "seda:vegetables"; | |
public static final String FRUITS_QUEUE = "seda:fruits"; | |
public static final String GROCERIES_QUEUE = "seda:groceries"; | |
public static final String FRUIT_PROCESSOR = "fruitProcessor"; | |
public static final String VEGETABLE_PROCESSOR = "vegetableProcessor"; | |
public void configure() { | |
from(FRUITS_QUEUE) | |
.to(FRUIT_PROCESSOR); |
This file contains hidden or 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
#!/bin/bash | |
# We need the TAB character for SED (Mac OS X sed does not understand \t) | |
TAB="$(printf '\t')" | |
function abort { | |
echo "$(tput setaf 1)$1$(tput sgr0)" | |
exit 1 | |
} | |
function request_input { |
This file contains hidden or 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
$ php client.php | |
Connecting to KrunchyKreme server localhost:9090 | |
Time taken to connect: 0.003 | |
Time taken to fetch menu: 0.003 | |
The KrunchyKreme Menu: | |
Doughut id=1, name=The Caramel One | |
Doughut id=2, name=The Chocolate Custard One | |
Doughut id=3, name=The Cookie One | |
Doughut id=4, name=The Straberries Jam One | |
Successful order for 1 X doughnut id 1 |
NewerOlder