Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic/fix tests #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions code/01_file-split-and-transform-sb/features/pom.xml

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions code/01_file-split-and-transform-sb/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.13.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -63,28 +58,6 @@
</pluginManagement>
</build>

<dependencies>
<!-- Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>



<repositories>
<repository>
Expand Down
4 changes: 0 additions & 4 deletions code/01_file-split-and-transform-sb/routing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
<artifactId>camel-test-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-javaconfig</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.camel.model.dataformat.JsonLibrary;
import org.apache.camel.model.language.ExpressionDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.globex.Account;
import org.globex.Company;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,74 +1,23 @@
package org.fuse.usecase;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.acme.Application;
import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader;
import org.apache.camel.test.spring.CamelSpringJUnit4ClassRunner;
import org.apache.camel.test.spring.CamelSpringRunner;
import org.junit.Test;
import org.acme.routes.CustomerRoute;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Logger;

@RunWith(CamelSpringJUnit4ClassRunner.class)
//@ContextConfiguration(classes = {ValidateTransformationTest.ContextConfig.class}, loader = CamelSpringDelegatingTestContextLoader.class)
@RunWith(CamelSpringRunner.class)
@SpringBootTest(classes = Application.class)
public class ValidateTransformationTest extends AbstractJUnit4SpringContextTests {
public class ValidateTransformationTest {

@Autowired
private CamelContext camelContext;

@EndpointInject(uri = "mock:csv2json-test-output") private MockEndpoint resultEndpoint;

@Produce(uri = "direct:csv2json-test-input") private ProducerTemplate startEndpoint;

// private RouteBuilder createRouteBuilder() throws Exception {
// return new CustomerRoute();
// }
@EndpointInject(uri = "mock:csv2json-test-output")
private MockEndpoint resultEndpoint;

@Test
public void testMessageOutputCount() throws Exception {
resultEndpoint.expectedMessageCount(1);
resultEndpoint.assertIsSatisfied();
}

// @Test
// public void test() {
// resultEndpoint.
// }

// private String readFile(String filePath) throws Exception {
// String content;
// FileInputStream fis = new FileInputStream(filePath);
// try {
// content = new CamelContext().getTypeConverter().convertTo(String.class, fis);
// } finally {
// fis.close();
// }
// return content;
// }

private String jsonUnprettyPrint(String jsonString) throws JsonProcessingException, IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);
JsonNode node = mapper.readTree(jsonString);
return node.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org:
acme:
customer:
input: file://src/test/data/inbox?fileName=customers.csv&noop=true
input: file://src/test/data/inbox?fileName=customer.csv&noop=true
output: mock:csv2json-test-output
Loading