mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-2699] Fixed initialization issue
This commit is contained in:
parent
45b77513a6
commit
473f9b43b1
3 changed files with 11 additions and 24 deletions
|
|
@ -50,7 +50,7 @@ public class HeliumRestApiTest extends AbstractTestRestApi {
|
|||
@Before
|
||||
public void setUp() throws IOException {
|
||||
HeliumTestRegistry registry = new HeliumTestRegistry("r1", "r1");
|
||||
ZeppelinServer.helium.clearConf();
|
||||
ZeppelinServer.helium.clear();
|
||||
ZeppelinServer.helium.addRegistry(registry);
|
||||
|
||||
registry.add(new HeliumPackage(
|
||||
|
|
@ -76,8 +76,7 @@ public class HeliumRestApiTest extends AbstractTestRestApi {
|
|||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
ZeppelinServer.helium.clearRegistries();
|
||||
ZeppelinServer.helium.clearConf();
|
||||
ZeppelinServer.helium.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class Helium {
|
|||
private List<HeliumRegistry> registry = new LinkedList<>();
|
||||
|
||||
private HeliumConf heliumConf;
|
||||
private Map<String, List<HeliumPackageSearchResult>> allPackages = new HashMap<>();
|
||||
|
||||
private final String heliumConfPath;
|
||||
private final String registryPaths;
|
||||
private final File registryCacheDir;
|
||||
|
|
@ -46,8 +48,6 @@ public class Helium {
|
|||
private final HeliumBundleFactory bundleFactory;
|
||||
private final HeliumApplicationFactory applicationFactory;
|
||||
|
||||
Map<String, List<HeliumPackageSearchResult>> allPackages = new HashMap<>();
|
||||
|
||||
public Helium(
|
||||
String heliumConfPath,
|
||||
String registryPaths,
|
||||
|
|
@ -61,6 +61,7 @@ public class Helium {
|
|||
this.bundleFactory = bundleFactory;
|
||||
this.applicationFactory = applicationFactory;
|
||||
heliumConf = loadConf(heliumConfPath);
|
||||
allPackages = getAllPackageInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,22 +75,10 @@ public class Helium {
|
|||
}
|
||||
}
|
||||
|
||||
public void clearRegistries() {
|
||||
public void clear() {
|
||||
this.registry.clear();
|
||||
}
|
||||
|
||||
public void clearConf() {
|
||||
this.heliumConf = new HeliumConf();
|
||||
}
|
||||
|
||||
public List<HeliumRegistry> getAllRegistry() {
|
||||
synchronized (this.registry) {
|
||||
List list = new LinkedList<>();
|
||||
for (HeliumRegistry r : registry) {
|
||||
list.add(r);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
this.allPackages = new HashMap<>();
|
||||
}
|
||||
|
||||
public HeliumApplicationFactory getApplicationFactory() {
|
||||
|
|
@ -394,7 +383,8 @@ public class Helium {
|
|||
public List<HeliumPackage> getBundlePackagesToBundle() {
|
||||
List<String> visOrder = heliumConf.getBundleDisplayOrder();
|
||||
|
||||
List<HeliumPackage> orderedBundlePackages = new LinkedList<>();
|
||||
Set<HeliumPackage> orderedBundlePackages = new HashSet<>();
|
||||
List<HeliumPackage> output = new LinkedList<>();
|
||||
|
||||
// add enabled packages in visOrder
|
||||
for (String name : visOrder) {
|
||||
|
|
@ -405,7 +395,6 @@ public class Helium {
|
|||
for (HeliumPackageSearchResult pkgInfo : versions) {
|
||||
if (canBundle(pkgInfo)) {
|
||||
orderedBundlePackages.add(pkgInfo.getPkg());
|
||||
allPackages.remove(name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -420,8 +409,8 @@ public class Helium {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return orderedBundlePackages;
|
||||
new LinkedList<>().addAll(orderedBundlePackages);
|
||||
return output;
|
||||
}
|
||||
|
||||
private boolean canBundle(HeliumPackageSearchResult pkgInfo) {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ public class HeliumTest {
|
|||
""));
|
||||
|
||||
// then
|
||||
assertEquals(1, helium.allPackages.size());
|
||||
assertEquals(2, helium.getAllPackageInfo(true, null).size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue