mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
test: Fix APIs
This commit is contained in:
parent
743aba4de9
commit
a99f981d3b
3 changed files with 12 additions and 25 deletions
|
|
@ -264,7 +264,7 @@ export default function heliumService($http, $sce, baseUrlSrv) {
|
|||
// console.error(response);
|
||||
// return
|
||||
// }
|
||||
|
||||
|
||||
// evaluate bundles
|
||||
availableBundles.map(b => {
|
||||
eval(b)
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ public class HeliumBundleFactory {
|
|||
return new ProxyConfig(proxy);
|
||||
}
|
||||
|
||||
public File buildAllPackages(List<HeliumPackage> pkgs) throws IOException {
|
||||
return buildAllPackages(pkgs, false);
|
||||
public void buildAllPackages(List<HeliumPackage> pkgs) throws IOException {
|
||||
buildAllPackages(pkgs, false);
|
||||
}
|
||||
|
||||
public File getHeliumPackageDirectory(String pkgName) {
|
||||
|
|
@ -388,16 +388,11 @@ public class HeliumBundleFactory {
|
|||
return bundleCache;
|
||||
}
|
||||
|
||||
public synchronized File buildAllPackages(List<HeliumPackage> pkgs, boolean forceRefresh)
|
||||
public synchronized void buildAllPackages(List<HeliumPackage> pkgs, boolean rebuild)
|
||||
throws IOException {
|
||||
|
||||
if (pkgs == null || pkgs.size() == 0) {
|
||||
// when no package is selected, simply return an empty file instead of try bundle package
|
||||
currentCacheBundle.getParentFile().mkdirs();
|
||||
currentCacheBundle.delete();
|
||||
currentCacheBundle.createNewFile();
|
||||
bundleCacheKey = "";
|
||||
return currentCacheBundle;
|
||||
return;
|
||||
}
|
||||
|
||||
installNodeAndNpm();
|
||||
|
|
@ -406,10 +401,8 @@ public class HeliumBundleFactory {
|
|||
copyFrameworkModuleToInstallPath();
|
||||
|
||||
for (HeliumPackage pkg : pkgs) {
|
||||
buildPackage(pkg, forceRefresh);
|
||||
buildPackage(pkg, rebuild);
|
||||
}
|
||||
|
||||
return currentCacheBundle;
|
||||
}
|
||||
|
||||
private void copyFrameworkModuleToInstallPath()
|
||||
|
|
|
|||
|
|
@ -107,14 +107,12 @@ public class HeliumBundleFactoryTest {
|
|||
"license",
|
||||
"icon"
|
||||
);
|
||||
List<HeliumPackage> pkgs = new LinkedList<>();
|
||||
pkgs.add(pkg);
|
||||
File bundle = hbf.buildAllPackages(pkgs);
|
||||
File bundle = hbf.buildPackage(pkg, true);
|
||||
assertTrue(bundle.isFile());
|
||||
long lastModified = bundle.lastModified();
|
||||
|
||||
// buildBundle again and check if it served from cache
|
||||
bundle = hbf.buildAllPackages(pkgs);
|
||||
bundle = hbf.buildPackage(pkg, false);
|
||||
assertEquals(lastModified, bundle.lastModified());
|
||||
}
|
||||
|
||||
|
|
@ -135,9 +133,7 @@ public class HeliumBundleFactoryTest {
|
|||
"license",
|
||||
"fa fa-coffee"
|
||||
);
|
||||
List<HeliumPackage> pkgs = new LinkedList<>();
|
||||
pkgs.add(pkg);
|
||||
File bundle = hbf.buildAllPackages(pkgs);
|
||||
File bundle = hbf.buildPackage(pkg, true);
|
||||
assertTrue(bundle.isFile());
|
||||
}
|
||||
|
||||
|
|
@ -157,11 +153,9 @@ public class HeliumBundleFactoryTest {
|
|||
"license",
|
||||
"fa fa-coffee"
|
||||
);
|
||||
List<HeliumPackage> pkgs = new LinkedList<>();
|
||||
pkgs.add(pkg);
|
||||
File bundle = null;
|
||||
try {
|
||||
bundle = hbf.buildAllPackages(pkgs);
|
||||
bundle = hbf.buildPackage(pkg, true);
|
||||
// should throw exception
|
||||
assertTrue(false);
|
||||
} catch (IOException e) {
|
||||
|
|
@ -202,8 +196,8 @@ public class HeliumBundleFactoryTest {
|
|||
List<HeliumPackage> pkgsV2 = new LinkedList<>();
|
||||
pkgsV2.add(pkgV2);
|
||||
|
||||
File bundle1 = hbf.buildAllPackages(pkgsV1);
|
||||
File bundle2 = hbf.buildAllPackages(pkgsV2);
|
||||
File bundle1 = hbf.buildPackage(pkgV1, true);
|
||||
File bundle2 = hbf.buildPackage(pkgV2, true);
|
||||
|
||||
assertNotSame(bundle1.lastModified(), bundle2.lastModified());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue