Sha256: 2eb4d8d3b78e4fae3afd5a256d535a41fe0304c807c30b108f45338e80c25f56
Contents?: true
Size: 1.68 KB
Versions: 5
Compression:
Stored size: 1.68 KB
Contents
package org.embulk.input.zendesk.utils; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import org.embulk.config.ConfigLoader; import org.embulk.config.ConfigSource; import org.embulk.config.ModelManager; import org.embulk.test.EmbulkTests; import org.junit.Assert; import java.io.IOException; import java.io.InputStream; import static junit.framework.TestCase.fail; public final class ZendeskTestHelper { private ZendeskTestHelper() {} private static ObjectMapper mapper; private static final ConfigLoader configLoader; static { mapper = new ObjectMapper(); mapper.registerModule(new Jdk8Module()); configLoader = new ConfigLoader(new ModelManager(null, mapper)); } public static JsonNode getJsonFromFile(String fileName) { try { return mapper.readTree(EmbulkTests.readResource(fileName)); } catch (IOException e) { fail("Fail to load file from " + fileName); } return null; } public static ConfigSource getConfigSource(String file) { ConfigSource configSource = null; InputStream is = null; try { is = ZendeskTestHelper.class.getResourceAsStream("/config/" + file); configSource = configLoader.fromYaml(is); } catch (IOException ex) { Assert.fail(ex.getMessage()); } finally { if (is != null) { try { is.close(); } catch (IOException ex) { } } } return configSource; } }
Version data entries
5 entries across 5 versions & 1 rubygems