Add junit assume to prevent ivy bug/limitation breaking the build on Jenkins
@@ -24,8 +24,13 @@ import com.redhat.ipaas.model.connection.Action;
import com.redhat.ipaas.model.connection.Connection;
import com.redhat.ipaas.model.integration.Integration;
import com.redhat.ipaas.model.integration.Step;
+
+import org.junit.Assume;
import org.junit.Test;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -38,7 +43,7 @@ public class DefaultIntegrationToProjectConverterTest {
@Test
public void testConvert() throws Exception {
-
+ Assume.assumeFalse(isUrlEncoded(new File( "." ).getCanonicalPath()));
Step step1 = new Step.Builder().stepKind("endpoint").connection(new Connection.Builder().configuredProperties("{}").build()).configuredProperties("{\"period\": \"5000\"}").action(new Action.Builder().camelConnectorPrefix("periodic-timer").camelConnectorGAV("com.redhat.ipaas:timer-connector:0.2.1").build()).build();
Step step2 = new Step.Builder().stepKind("endpoint").connection(new Connection.Builder().configuredProperties("{}").build()).configuredProperties("{\"httpUri\": \"http://localhost:8080/hello\"}").action(new Action.Builder().camelConnectorPrefix("http-get").camelConnectorGAV("com.redhat.ipaas:http-get-connector:0.2.1").build()).build();
Step step3 = new Step.Builder().stepKind("log").configuredProperties("{\"message\": \"Hello World! ${body}\"}").build();
@@ -70,6 +75,8 @@ public class DefaultIntegrationToProjectConverterTest {
@Test
public void testConvertFromJson() throws Exception {
+ Assume.assumeFalse(isUrlEncoded(new File( "." ).getCanonicalPath()));
+
JsonNode json = new ObjectMapper().readTree(this.getClass().getResourceAsStream("test-integration.json"));
Map<String, byte[]> files = new DefaultIntegrationToProjectConverter(new ConnectorCatalog(new ConnectorCatalogProperties())).convert(
new ObjectMapper().registerModule(new Jdk8Module()).readValue(json.get("data").toString(), Integration.class)
@@ -81,4 +88,10 @@ public class DefaultIntegrationToProjectConverterTest {
assertFileContents(files.get("pom.xml"), "test-pull-push-pom.xml");
}
+
+ private static Boolean isUrlEncoded(String path) throws UnsupportedEncodingException {
+ String encoded = URLDecoder.decode(path, "UTF-8");
+ return !path.equals(encoded);
+
+ }
}
