NamedClusterManager implements NamedClusterService { @Override public NamedCluster getClusterTemplate() { if ( clusterTemplate == null ) { clusterTemplate = new NamedClusterImpl(); clusterTemplate.setName( "" ); clusterTemplate.setHdfsHost( LOCALHOST ); clusterTemplate.setHdfsPort( "8020" ); clusterTemplate.setHdfsUsername( "user" ); clusterTemplate.setHdfsPassword( clusterTemplate.encodePassword( "password" ) ); clusterTemplate.setJobTrackerHost( LOCALHOST ); clusterTemplate.setJobTrackerPort( "8032" ); clusterTemplate.setZooKeeperHost( LOCALHOST ); clusterTemplate.setZooKeeperPort( "2181" ); clusterTemplate.setOozieUrl( "http: } return clusterTemplate.clone(); }  BundleContext getBundleContext(); void setBundleContext( BundleContext bundleContext ); @Override void close( IMetaStore metastore ); @Override NamedCluster getClusterTemplate(); @Override void setClusterTemplate( NamedCluster clusterTemplate ); @Override void create( NamedCluster namedCluster, IMetaStore metastore ); @Override NamedCluster read( String clusterName, IMetaStore metastore ); @Override void update( NamedCluster namedCluster, IMetaStore metastore ); @Override void delete( String clusterName, IMetaStore metastore ); @Override List<NamedCluster> list( IMetaStore metastore ); @Override List<NamedCluster> list( IMetaStore metastore, List<MetaStoreException> exceptionList ); @Override List<String> listNames( IMetaStore metastore ); @Override boolean contains( String clusterName, IMetaStore metastore ); @Override NamedCluster getNamedClusterByName( String namedClusterName, IMetaStore metastore ); Map<String, Object> getProperties(); @Override NamedCluster getNamedClusterByHost( String hostName, IMetaStore metastore ); @Override void updateNamedClusterTemplate( String hostName, int port, boolean isMapr ); static final String BIG_DATA_SLAVE_METASTORE_DIR; }
@Test public void testGetClusterTemplate() { NamedCluster clusterTemplate = namedClusterManager.getClusterTemplate(); assertFalse( clusterTemplate == namedClusterManager.getClusterTemplate() ); assertTrue( clusterTemplate.equals( namedClusterManager.getClusterTemplate() ) ); NamedCluster template = mock( NamedCluster.class ); NamedCluster clone = mock( NamedCluster.class ); when( template.clone() ).thenReturn( clone ); namedClusterManager.setClusterTemplate( template ); assertEquals( clone, namedClusterManager.getClusterTemplate() ); }