@Test public void testUpdate() throws MetaStoreException { NamedClusterImpl namedCluster = new NamedClusterImpl(); String testName = "testName"; namedCluster.setName( testName ); List namedClusters = new ArrayList<>( Arrays.asList( namedCluster ) ); when( metaStoreFactory.getElements( true ) ).thenReturn( namedClusters ).thenReturn( namedClusters ).thenThrow( new MetaStoreException() ); NamedClusterImpl updatedNamedCluster = new NamedClusterImpl(); updatedNamedCluster.setName( testName + "updated" ); namedClusterManager.update( updatedNamedCluster, metaStore ); }
@Override public void update( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException { MetaStoreFactory<NamedClusterImpl> factory = getMetaStoreFactory( metastore ); List<NamedCluster> namedClusters = list( metastore ); for ( NamedCluster nc : namedClusters ) { if ( namedCluster.getName().equals( nc.getName() ) ) { factory.deleteElement( nc.getName() ); factory.saveElement( new NamedClusterImpl( namedCluster ) ); } } }
NamedClusterManager implements NamedClusterService { @Override public void update( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException { MetaStoreFactory<NamedClusterImpl> factory = getMetaStoreFactory( metastore ); List<NamedCluster> namedClusters = list( metastore ); for ( NamedCluster nc : namedClusters ) { if ( namedCluster.getName().equals( nc.getName() ) ) { factory.deleteElement( nc.getName() ); factory.saveElement( new NamedClusterImpl( namedCluster ) ); } } } }
NamedClusterManager implements NamedClusterService { @Override public void update( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException { MetaStoreFactory<NamedClusterImpl> factory = getMetaStoreFactory( metastore ); List<NamedCluster> namedClusters = list( metastore ); for ( NamedCluster nc : namedClusters ) { if ( namedCluster.getName().equals( nc.getName() ) ) { factory.deleteElement( nc.getName() ); factory.saveElement( new NamedClusterImpl( namedCluster ) ); } } }  }
NamedClusterManager implements NamedClusterService { @Override public void update( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException { MetaStoreFactory<NamedClusterImpl> factory = getMetaStoreFactory( metastore ); List<NamedCluster> namedClusters = list( metastore ); for ( NamedCluster nc : namedClusters ) { if ( namedCluster.getName().equals( nc.getName() ) ) { factory.deleteElement( nc.getName() ); factory.saveElement( new NamedClusterImpl( namedCluster ) ); } } }  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 ); }
NamedClusterManager implements NamedClusterService { @Override public void update( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException { MetaStoreFactory<NamedClusterImpl> factory = getMetaStoreFactory( metastore ); List<NamedCluster> namedClusters = list( metastore ); for ( NamedCluster nc : namedClusters ) { if ( namedCluster.getName().equals( nc.getName() ) ) { factory.deleteElement( nc.getName() ); factory.saveElement( new NamedClusterImpl( namedCluster ) ); } } }  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; }