Java Code Examples for org.apache.sqoop.model.MLink#setEnabled()
The following examples show how to use
org.apache.sqoop.model.MLink#setEnabled() .
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: TestJobManager.java From sqoop-on-spark with Apache License 2.0 | 6 votes |
@Test public void testDisabledLink() { MLink testConnection = new MLink(123l, null); testConnection.setPersistenceId(1234); testConnection.setEnabled(false); SqoopException exception = new SqoopException(DriverError.DRIVER_0010, "Connection id: " + testConnection.getPersistenceId()); MLink mConnectionSpy = org.mockito.Mockito.spy(testConnection); when(repositoryManagerMock.getRepository()).thenReturn(jdbcRepoMock); when(jdbcRepoMock.findLink(123l)).thenReturn(mConnectionSpy); try { jobManager.getLink(123l); } catch (SqoopException ex) { assertEquals(ex.getMessage(), exception.getMessage()); verify(repositoryManagerMock, times(1)).getRepository(); verify(jdbcRepoMock, times(1)).findLink(123l); } }
Example 2
Source File: LinkBean.java From sqoop-on-spark with Apache License 2.0 | 5 votes |
private MLink restoreLink(Object obj) { JSONObject object = (JSONObject) obj; long connectorId = (Long) object.get(CONNECTOR_ID); JSONArray connectorLinkConfig = (JSONArray) object.get(LINK_CONFIG_VALUES); List<MConfig> linkConfig = restoreConfigList(connectorLinkConfig); MLink link = new MLink(connectorId, new MLinkConfig(linkConfig)); link.setPersistenceId((Long) object.get(ID)); link.setName((String) object.get(NAME)); link.setEnabled((Boolean) object.get(ENABLED)); link.setCreationUser((String) object.get(CREATION_USER)); link.setCreationDate(new Date((Long) object.get(CREATION_DATE))); link.setLastUpdateUser((String) object.get(UPDATE_USER)); link.setLastUpdateDate(new Date((Long) object.get(UPDATE_DATE))); return link; }
Example 3
Source File: BeanTestUtil.java From sqoop-on-spark with Apache License 2.0 | 5 votes |
public static MLink createLink(String connectorName, String linkName, Long linkId, Date created, Date updated) { MLink link1 = getLink(connectorName); link1.setName(linkName); link1.setPersistenceId(linkId); link1.setCreationUser("admin"); link1.setCreationDate(created); link1.setLastUpdateUser("user"); link1.setLastUpdateDate(updated); link1.setEnabled(false); return link1; }
Example 4
Source File: TestJobManager.java From sqoop-on-spark with Apache License 2.0 | 5 votes |
@Test public void testGetLink() { MLink testLink = new MLink(123l, null); testLink.setEnabled(true); MLink mConnectionSpy = org.mockito.Mockito.spy(testLink); when(repositoryManagerMock.getRepository()).thenReturn(jdbcRepoMock); when(jdbcRepoMock.findLink(123l)).thenReturn(mConnectionSpy); assertEquals(jobManager.getLink(123l), mConnectionSpy); verify(repositoryManagerMock, times(1)).getRepository(); verify(jdbcRepoMock, times(1)).findLink(123l); }
Example 5
Source File: CommonRepositoryHandler.java From sqoop-on-spark with Apache License 2.0 | 4 votes |
private List<MLink> loadLinks(PreparedStatement stmt, Connection conn) throws SQLException { List<MLink> links = new ArrayList<MLink>(); ResultSet rsConnection = null; PreparedStatement connectorConfigFetchStatement = null; PreparedStatement connectorConfigInputStatement = null; try { rsConnection = stmt.executeQuery(); connectorConfigFetchStatement = conn.prepareStatement(crudQueries.getStmtSelectConfigForConfigurable()); connectorConfigInputStatement = conn.prepareStatement(crudQueries.getStmtFetchLinkInput()); while(rsConnection.next()) { long id = rsConnection.getLong(1); String name = rsConnection.getString(2); long connectorId = rsConnection.getLong(3); boolean enabled = rsConnection.getBoolean(4); String creationUser = rsConnection.getString(5); Date creationDate = rsConnection.getTimestamp(6); String updateUser = rsConnection.getString(7); Date lastUpdateDate = rsConnection.getTimestamp(8); connectorConfigFetchStatement.setLong(1, connectorId); connectorConfigInputStatement.setLong(1, id); connectorConfigInputStatement.setLong(3, id); List<MConfig> connectorLinkConfig = new ArrayList<MConfig>(); List<MConfig> fromConfig = new ArrayList<MConfig>(); List<MConfig> toConfig = new ArrayList<MConfig>(); loadConnectorConfigs(connectorLinkConfig, fromConfig, toConfig, connectorConfigFetchStatement, connectorConfigInputStatement, 2, conn); MLink link = new MLink(connectorId, new MLinkConfig(connectorLinkConfig)); link.setPersistenceId(id); link.setName(name); link.setCreationUser(creationUser); link.setCreationDate(creationDate); link.setLastUpdateUser(updateUser); link.setLastUpdateDate(lastUpdateDate); link.setEnabled(enabled); links.add(link); } } finally { closeResultSets(rsConnection); closeStatements(connectorConfigFetchStatement, connectorConfigInputStatement); } return links; }