@Test public void testGetConnectors() { MConnector connector; when(resourceRequests.readConnector(null)).thenReturn(connectorBean(connector(1), connector(2))); Collection<MConnector> connectors = client.getConnectors(); assertEquals(2, connectors.size()); client.getConnectorConfigBundle(1); connector = client.getConnector(1); assertEquals(1, connector.getPersistenceId()); connector = client.getConnector(2); client.getConnectorConfigBundle(2); assertEquals(2, connector.getPersistenceId()); connectors = client.getConnectors(); assertEquals(2, connectors.size()); connector = client.getConnector("A1"); assertEquals(1, connector.getPersistenceId()); assertEquals("A1", connector.getUniqueName()); connector = client.getConnector("A2"); assertEquals(2, connector.getPersistenceId()); assertEquals("A2", connector.getUniqueName()); connector = client.getConnector("A3"); assertNull(connector); verify(resourceRequests, times(1)).readConnector(null); verifyNoMoreInteractions(resourceRequests); }
public Collection<MConnector> getConnectors() { if(isAllConnectors) { return connectors.values(); } ConnectorBean bean = resourceRequests.readConnector(null); isAllConnectors = true; for(MConnector connector : bean.getConnectors()) { connectors.put(connector.getPersistenceId(), connector); } connectorConfigBundles = bean.getResourceBundles(); return connectors.values(); }
SqoopClient { public Collection<MConnector> getConnectors() { if(isAllConnectors) { return connectors.values(); } ConnectorBean bean = resourceRequests.readConnector(null); isAllConnectors = true; for(MConnector connector : bean.getConnectors()) { connectors.put(connector.getPersistenceId(), connector); } connectorConfigBundles = bean.getResourceBundles(); return connectors.values(); } }
SqoopClient { public Collection<MConnector> getConnectors() { if(isAllConnectors) { return connectors.values(); } ConnectorBean bean = resourceRequests.readConnector(null); isAllConnectors = true; for(MConnector connector : bean.getConnectors()) { connectors.put(connector.getPersistenceId(), connector); } connectorConfigBundles = bean.getResourceBundles(); return connectors.values(); } SqoopClient(String serverUrl); }
SqoopClient { public Collection<MConnector> getConnectors() { if(isAllConnectors) { return connectors.values(); } ConnectorBean bean = resourceRequests.readConnector(null); isAllConnectors = true; for(MConnector connector : bean.getConnectors()) { connectors.put(connector.getPersistenceId(), connector); } connectorConfigBundles = bean.getResourceBundles(); return connectors.values(); } SqoopClient(String serverUrl); void setServerUrl(String serverUrl); void setSqoopRequests(SqoopResourceRequests requests); void clearCache(); MConnector getConnector(long cid); MConnector getConnector(String connectorName); Collection<MConnector> getConnectors(); ResourceBundle getConnectorConfigBundle(long connectorId); MDriverConfig getDriverConfig(); MDriver getDriver(); ResourceBundle getDriverConfigBundle(); MLink createLink(long connectorId); MLink createLink(String connectorName); MLink getLink(long linkId); List<MLink> getLinks(); Status saveLink(MLink link); Status updateLink(MLink link); void enableLink(long linkId, boolean enabled); void deleteLink(long linkId); MJob createJob(long fromLinkId, long toLinkId); MJob getJob(long jobId); List<MJob> getJobs(); List<MJob> getJobsByConnector(long cId); Status saveJob(MJob job); Status updateJob(MJob job); void enableJob(long jid, boolean enabled); void deleteJob(long jobId); MSubmission startJob(long jobId); MSubmission startJob(long jobId, SubmissionCallback callback, long pollTime); MSubmission stopJob(long jid); MSubmission getJobStatus(long jid); List<MSubmission> getSubmissions(); List<MSubmission> getSubmissionsForJob(long jobId); List<MRole> getRoles(); void createRole(MRole role); void dropRole(MRole role); void grantRole(List<MRole> roles, List<MPrincipal> principals); void revokeRole(List<MRole> roles, List<MPrincipal> principals); List<MRole> getRolesByPrincipal(MPrincipal principal); List<MPrincipal> getPrincipalsByRole(MRole role); void grantPrivilege(List<MPrincipal> principals, List<MPrivilege> privileges); void revokePrivilege(List<MPrincipal> principals, List<MPrivilege> privileges); List<MPrivilege> getPrivilegesByPrincipal(MPrincipal principal, MResource resource); Token<?>[] addDelegationTokens(String renewer,
                                        Credentials credentials); }
SqoopClient { public Collection<MConnector> getConnectors() { if(isAllConnectors) { return connectors.values(); } ConnectorBean bean = resourceRequests.readConnector(null); isAllConnectors = true; for(MConnector connector : bean.getConnectors()) { connectors.put(connector.getPersistenceId(), connector); } connectorConfigBundles = bean.getResourceBundles(); return connectors.values(); } SqoopClient(String serverUrl); void setServerUrl(String serverUrl); void setSqoopRequests(SqoopResourceRequests requests); void clearCache(); MConnector getConnector(long cid); MConnector getConnector(String connectorName); Collection<MConnector> getConnectors(); ResourceBundle getConnectorConfigBundle(long connectorId); MDriverConfig getDriverConfig(); MDriver getDriver(); ResourceBundle getDriverConfigBundle(); MLink createLink(long connectorId); MLink createLink(String connectorName); MLink getLink(long linkId); List<MLink> getLinks(); Status saveLink(MLink link); Status updateLink(MLink link); void enableLink(long linkId, boolean enabled); void deleteLink(long linkId); MJob createJob(long fromLinkId, long toLinkId); MJob getJob(long jobId); List<MJob> getJobs(); List<MJob> getJobsByConnector(long cId); Status saveJob(MJob job); Status updateJob(MJob job); void enableJob(long jid, boolean enabled); void deleteJob(long jobId); MSubmission startJob(long jobId); MSubmission startJob(long jobId, SubmissionCallback callback, long pollTime); MSubmission stopJob(long jid); MSubmission getJobStatus(long jid); List<MSubmission> getSubmissions(); List<MSubmission> getSubmissionsForJob(long jobId); List<MRole> getRoles(); void createRole(MRole role); void dropRole(MRole role); void grantRole(List<MRole> roles, List<MPrincipal> principals); void revokeRole(List<MRole> roles, List<MPrincipal> principals); List<MRole> getRolesByPrincipal(MPrincipal principal); List<MPrincipal> getPrincipalsByRole(MRole role); void grantPrivilege(List<MPrincipal> principals, List<MPrivilege> privileges); void revokePrivilege(List<MPrincipal> principals, List<MPrivilege> privileges); List<MPrivilege> getPrivilegesByPrincipal(MPrincipal principal, MResource resource); Token<?>[] addDelegationTokens(String renewer,
                                        Credentials credentials);  }