Java Code Examples for org.apache.sqoop.model.MLink#getConnectorLinkConfig()
The following examples show how to use
org.apache.sqoop.model.MLink#getConnectorLinkConfig() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestLinkHandling.java From sqoop-on-spark with Apache License 2.0 | 6 votes |
@Test public void testUpdateLinkConfig() throws Exception { loadLinksForLatestVersion(); assertCountForTable("SQOOP.SQ_LINK", 2); assertCountForTable("SQOOP.SQ_LINK_INPUT", 8); MLink link = handler.findLink(1, getDerbyDatabaseConnection()); List<MConfig> configs = link.getConnectorLinkConfig().getConfigs(); MConfig config = configs.get(0).clone(false); MConfig newConfig = new MConfig(config.getName(), config.getInputs()); ((MStringInput) newConfig.getInputs().get(0)).setValue("LinkConfigUpdated"); handler.updateLinkConfig(link.getPersistenceId(), newConfig, MConfigUpdateEntityType.USER, getDerbyDatabaseConnection()); MLink updatedLink = handler.findLink(1, getDerbyDatabaseConnection()); MLinkConfig newConfigs = updatedLink.getConnectorLinkConfig(); assertEquals(2, newConfigs.getConfigs().size()); MConfig updatedLinkConfig = newConfigs.getConfigs().get(0); assertEquals("LinkConfigUpdated", updatedLinkConfig.getInputs().get(0).getValue()); }
Example 2
Source File: ConnectorTestCase.java From sqoop-on-spark with Apache License 2.0 | 5 votes |
/** * Fill link config based on currently active provider. * * @param link MLink object to fill */ protected void fillRdbmsLinkConfig(MLink link) { MConfigList configs = link.getConnectorLinkConfig(); configs.getStringInput("linkConfig.jdbcDriver").setValue(provider.getJdbcDriver()); configs.getStringInput("linkConfig.connectionString").setValue(provider.getConnectionUrl()); configs.getStringInput("linkConfig.username").setValue(provider.getConnectionUsername()); configs.getStringInput("linkConfig.password").setValue(provider.getConnectionPassword()); }
Example 3
Source File: TomcatSqoopRunner.java From incubator-sentry with Apache License 2.0 | 5 votes |
/** * Fill link config based on currently active provider. * * @param link MLink object to fill */ public void fillRdbmsLinkConfig(MLink link) { MConfigList configs = link.getConnectorLinkConfig(); configs.getStringInput("linkConfig.jdbcDriver").setValue(provider.getJdbcDriver()); configs.getStringInput("linkConfig.connectionString").setValue(provider.getConnectionUrl()); configs.getStringInput("linkConfig.username").setValue(provider.getConnectionUsername()); configs.getStringInput("linkConfig.password").setValue(provider.getConnectionPassword()); }
Example 4
Source File: TestInputTypes.java From sqoop-on-spark with Apache License 2.0 | 4 votes |
/** * Test that serializing actual data is not an issue. */ @Test public void testEntityDataSerialization() throws Exception { MConnector connector = getConnector(); MDriver driver = getDriver(); // Register objects for everything and our new connector handler.registerConnector(connector, getDerbyDatabaseConnection()); handler.registerDriver(driver, getDerbyDatabaseConnection()); // Inserted values Map<String, String> map = new HashMap<String, String>(); map.put("A", "B"); // Connection object with all various values MLink link = new MLink(connector.getPersistenceId(), connector.getLinkConfig()); MLinkConfig linkConfig = link.getConnectorLinkConfig(); assertEquals(linkConfig.getStringInput("l1.I1").getEditable(), InputEditable.ANY); assertEquals(linkConfig.getStringInput("l1.I1").getOverrides(), "l1.I2"); assertEquals(linkConfig.getMapInput("l1.I2").getEditable(), InputEditable.CONNECTOR_ONLY); assertEquals(linkConfig.getMapInput("l1.I2").getOverrides(), "l1.I5"); assertEquals(linkConfig.getIntegerInput("l1.I3").getEditable(), InputEditable.ANY); assertEquals(linkConfig.getIntegerInput("l1.I3").getOverrides(), "l1.I1"); assertEquals(linkConfig.getBooleanInput("l1.I4").getEditable(), InputEditable.USER_ONLY); assertEquals(linkConfig.getBooleanInput("l1.I4").getOverrides(), ""); assertEquals(linkConfig.getEnumInput("l1.I5").getEditable(), InputEditable.ANY); assertEquals(linkConfig.getEnumInput("l1.I5").getOverrides(), "l1.I4,l1.I3"); linkConfig.getStringInput("l1.I1").setValue("A"); linkConfig.getMapInput("l1.I2").setValue(map); linkConfig.getIntegerInput("l1.I3").setValue(1); linkConfig.getBooleanInput("l1.I4").setValue(true); linkConfig.getEnumInput("l1.I5").setValue("YES"); // Create the link in repository handler.createLink(link, getDerbyDatabaseConnection()); assertNotSame(link.getPersistenceId(), MPersistableEntity.PERSISTANCE_ID_DEFAULT); // Retrieve created link MLink retrieved = handler.findLink(link.getPersistenceId(), getDerbyDatabaseConnection()); linkConfig = retrieved.getConnectorLinkConfig(); assertEquals("A", linkConfig.getStringInput("l1.I1").getValue()); assertEquals(map, linkConfig.getMapInput("l1.I2").getValue()); assertEquals(1, (int) linkConfig.getIntegerInput("l1.I3").getValue()); assertEquals(true, (boolean) linkConfig.getBooleanInput("l1.I4").getValue()); assertEquals("YES", linkConfig.getEnumInput("l1.I5").getValue()); assertEquals(linkConfig.getEnumInput("l1.I5").getEditable(), InputEditable.ANY); assertEquals(linkConfig.getEnumInput("l1.I5").getOverrides(), "l1.I4,l1.I3"); }
Example 5
Source File: KafkaConnectorTestCase.java From sqoop-on-spark with Apache License 2.0 | 4 votes |
protected void fillKafkaLinkConfig(MLink link) { MConfigList configs = link.getConnectorLinkConfig(); configs.getStringInput("linkConfig.brokerList").setValue(testUtil.getKafkaServerUrl()); configs.getStringInput("linkConfig.zookeeperConnect").setValue(testUtil.getZkUrl()); }
Example 6
Source File: ConnectorTestCase.java From sqoop-on-spark with Apache License 2.0 | 4 votes |
protected void fillHdfsLink(MLink link) { MConfigList configs = link.getConnectorLinkConfig(); configs.getStringInput("linkConfig.confDir").setValue(getCluster().getConfigurationPath()); }
Example 7
Source File: TomcatSqoopRunner.java From incubator-sentry with Apache License 2.0 | 2 votes |
/** * fill link. * * With asserts to make sure that it was filled correctly. * * @param link */ public void fillHdfsLink(MLink link) { MConfigList configs = link.getConnectorLinkConfig(); configs.getStringInput("linkConfig.confDir").setValue(server.getConfigurationPath()); }