Skip to content
Browse files

redeploy

  • Loading branch information...
1 parent bd3626e commit 8ee849068020d263703a1e2b4f56198f03d9dc2a @purplefox purplefox committed Jul 27, 2012
View
7 vertx-examples/src/main/javascript/redeploy/mods/test-mod1/app.js
@@ -0,0 +1,7 @@
+load("vertx.js")
+
+console.log("in test-mod1");
+
+vertx.createHttpServer().requestHandler(function(req) {
+ req.response.end("<html><body><h1>Hello from vert.x!</h1></body></html>");
+}).listen(8080, 'localhost');
View
4 vertx-examples/src/main/javascript/redeploy/mods/test-mod1/mod.json
@@ -0,0 +1,4 @@
+{
+ "main": "app.js",
+ "auto-redeploy": true
+}
View
3 ...ng/vertx-lang-java/src/main/java/org/vertx/java/deploy/impl/java/JavaVerticleFactory.java
@@ -60,6 +60,9 @@ private boolean isJavaSource(String main) {
}
public Verticle createVerticle(String main, ClassLoader loader) throws Exception {
+
+ System.out.println("creating verticle " + main);
+
ClassLoader cl = loader;
String className = main;
if (isJavaSource(main)) {
View
4 vertx-platform/src/main/java/org/vertx/java/deploy/Container.java
@@ -89,7 +89,7 @@ public void deployWorkerVerticle(String main, JsonObject config, int instances)
public void deployWorkerVerticle(String main, JsonObject config, int instances, Handler<String> doneHandler) {
URL[] currURLs = mgr.getDeploymentURLs();
File modDir = mgr.getDeploymentModDir();
- mgr.deploy(true, main, config, currURLs, instances, modDir, doneHandler);
+ mgr.deployVerticle(true, main, config, currURLs, instances, modDir, doneHandler);
}
/**
@@ -186,7 +186,7 @@ public void deployVerticle(String main, JsonObject config, int instances) {
public void deployVerticle(String main, JsonObject config, int instances, Handler<String> doneHandler) {
URL[] currURLs = mgr.getDeploymentURLs();
File modDir = mgr.getDeploymentModDir();
- mgr.deploy(false, main, config, currURLs, instances, modDir, doneHandler);
+ mgr.deployVerticle(false, main, config, currURLs, instances, modDir, doneHandler);
}
/**
View
5 vertx-platform/src/main/java/org/vertx/java/deploy/impl/Deployment.java
@@ -38,9 +38,11 @@
public final List<VerticleHolder> verticles = new ArrayList<>();
public final List<String> childDeployments = new ArrayList<>();
public final String parentDeploymentName;
+ public final boolean autoRedeploy;
public Deployment(String name, String modName, int instances, VerticleFactory factory, JsonObject config,
- URL[] urls, File modDir, String parentDeploymentName) {
+ URL[] urls, File modDir, String parentDeploymentName,
+ boolean autoRedeploy) {
this.name = name;
this.modName = modName;
this.instances = instances;
@@ -49,5 +51,6 @@ public Deployment(String name, String modName, int instances, VerticleFactory fa
this.urls = urls;
this.modDir = modDir;
this.parentDeploymentName = parentDeploymentName;
+ this.autoRedeploy = autoRedeploy;
}
}
View
79 vertx-platform/src/main/java/org/vertx/java/deploy/impl/Redeployer.java
@@ -56,7 +56,6 @@
private final File modRoot;
private final ModuleReloader reloader;
- private final Map<String, Deployment> deployments = new HashMap<>();
private final Map<Path, Set<Deployment>> watchedDeployments = new HashMap<>();
private final Map<WatchKey, Path> watchKeys = new HashMap<>();
private final Map<Path, Path> moduleDirs = new HashMap<>();
@@ -68,24 +67,6 @@
private final Queue<Deployment> toUndeploy = new ConcurrentLinkedQueue<>();
private Context ctx;
- private void dumpSizes() {
- log.info("watchkeys: " + watchKeys.size());
- log.info("moduleDirs: " + moduleDirs.size());
- log.info("changing: " + changing.size());
- int size = 0;
- for (Set<Deployment> s: this.watchedDeployments.values()) {
- size += s.size();
- }
- log.info("watcheddeployments:" + size);
- }
-
- private void checkContext() {
- //Sanity check
- if (Context.getContext() != ctx) {
- throw new IllegalStateException("Got context: " + Context.getContext() + " expected " + ctx);
- }
- }
-
public Redeployer(Vertx vertx, File modRoot, ModuleReloader reloader) {
this.modRoot = modRoot;
this.reloader = reloader;
@@ -118,12 +99,10 @@ public void close() {
}
public void moduleDeployed(Deployment deployment) {
- log.info("module deployed " + deployment.name);
toDeploy.add(deployment);
}
public void moduleUndeployed(Deployment deployment) {
- log.info("module undeployed " + deployment.name);
toUndeploy.add(deployment);
}
@@ -134,7 +113,6 @@ public void moduleUndeployed(Deployment deployment) {
private void processDeployments() {
Deployment dep;
while ((dep = toDeploy.poll()) != null) {
- deployments.put(dep.name, dep);
File fmodDir = new File(modRoot, dep.modName);
Path modDir = fmodDir.toPath();
Set<Deployment> deps = watchedDeployments.get(modDir);
@@ -156,14 +134,11 @@ private void processDeployments() {
private void processUndeployments() {
Deployment dep;
while ((dep = toUndeploy.poll()) != null) {
- log.info("processing undeployment");
- deployments.remove(dep.name);
File modDir = new File(modRoot, dep.modName);
Path pModDir = modDir.toPath();
Set<Deployment> deps = watchedDeployments.get(pModDir);
deps.remove(dep);
if (deps.isEmpty()) {
- log.info("unwatching module " + dep.modName);
watchedDeployments.remove(pModDir);
Set<Path> modPaths = new HashSet<>();
for (Map.Entry<Path, Path> entry: moduleDirs.entrySet()) {
@@ -186,7 +161,6 @@ private void processUndeployments() {
watchKeys.remove(key);
}
}
- this.dumpSizes();
}
}
@@ -210,35 +184,20 @@ void checkEvents() {
if (now - entry.getValue() > GRACE_PERIOD) {
// Module has changed but no changes for GRACE_PERIOD ms
// we can assume the redeploy has finished
- log.info("module hasn't changed for 1000 ms so redeploy it");
toRedeploy.add(entry.getKey());
}
}
if (!toRedeploy.isEmpty()) {
- Set<Deployment> parents = new HashSet<>();
+ Set<Deployment> deployments = new HashSet<>();
for (Path moduleDir: toRedeploy) {
+ log.info("Module has changed - redeploying module from directory " + moduleDir.toString());
changing.remove(moduleDir);
- computeParents(moduleDir, parents);
+ deployments.addAll(watchedDeployments.get(moduleDir));
}
- reloader.reloadModules(parents);
+ reloader.reloadModules(deployments);
}
}
- // Some of the modules that need to be redeployed might have been programmatically
- // deployed so we don't redeploy them directly. Instead we need to compute the
- // set of parent modules which are the ones we need to redeploy
- private void computeParents(Path modulePath, Set<Deployment> parents) {
- Set<Deployment> deps = watchedDeployments.get(modulePath);
- for (Deployment d: deps) {
- if (d.parentDeploymentName != null) {
- Deployment parent = deployments.get(d.parentDeploymentName);
- File f = new File(modRoot, parent.modName);
- computeParents(f.toPath(), parents);
- } else {
- parents.add(d);
- }
- }
- }
private void handleEvent(WatchKey key, Set<Path> changed) {
Path dir = watchKeys.get(key);
@@ -254,21 +213,15 @@ private void handleEvent(WatchKey key, Set<Path> changed) {
continue;
}
- log.info("got event in directory " + dir);
-
Path moduleDir = moduleDirs.get(dir);
- log.info("module dir is " + moduleDir);
@SuppressWarnings("unchecked")
WatchEvent<Path> ev = (WatchEvent<Path>) event;
Path name = ev.context();
Path child = dir.resolve(name);
- if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {
- log.info("entry modified: " + child);
- } else if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
- log.info("entry created: " + child);
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
if (Files.isDirectory(child, LinkOption.NOFOLLOW_LINKS)) {
try {
registerAll(moduleDir, child);
@@ -278,7 +231,6 @@ private void handleEvent(WatchKey key, Set<Path> changed) {
}
}
} else if (kind == StandardWatchEventKinds.ENTRY_DELETE) {
- log.info("entry deleted: " + child);
moduleDirs.remove(child);
}
changed.add(moduleDir);
@@ -291,15 +243,13 @@ private void handleEvent(WatchKey key, Set<Path> changed) {
}
private void register(Path modDir, Path dir) throws IOException {
- log.info("registering " + dir);
WatchKey key = dir.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE);
watchKeys.put(key, dir);
moduleDirs.put(dir, modDir);
}
private void registerAll(final Path modDir, final Path dir) throws IOException {
- log.info("registering all " + modDir);
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
@@ -308,4 +258,23 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) th
}
});
}
+
+// private void dumpSizes() {
+// log.info("watchkeys: " + watchKeys.size());
+// log.info("moduleDirs: " + moduleDirs.size());
+// log.info("changing: " + changing.size());
+// int size = 0;
+// for (Set<Deployment> s: this.watchedDeployments.values()) {
+// size += s.size();
+// }
+// log.info("watcheddeployments:" + size);
+// }
+
+ private void checkContext() {
+ //Sanity check
+ if (Context.getContext() != ctx) {
+ throw new IllegalStateException("Got context: " + Context.getContext() + " expected " + ctx);
+ }
+ }
+
}
View
240 vertx-platform/src/main/java/org/vertx/java/deploy/impl/VerticleManager.java
@@ -155,12 +155,12 @@ public Logger getLogger() {
return holder == null ? null : holder.logger;
}
- public void deploy(boolean worker, final String main,
- final JsonObject config, final URL[] urls,
- int instances, File currentModDir,
- final Handler<String> doneHandler) {
+ public void deployVerticle(boolean worker, final String main,
+ final JsonObject config, final URL[] urls,
+ int instances, File currentModDir,
+ final Handler<String> doneHandler) {
Context ctx = vertx.getOrAssignContext();
- doDeploy(worker, main, null, config, urls, instances, currentModDir, ctx, doneHandler);
+ doDeploy(null, false, worker, main, null, config, urls, instances, currentModDir, ctx, doneHandler);
}
public synchronized void undeployAll(final Handler<Void> doneHandler) {
@@ -182,33 +182,124 @@ public void handle() {
count.setHandler(doneHandler);
}
+ public synchronized Map<String, Integer> listInstances() {
+ Map<String, Integer> map = new HashMap<>();
+ for (Map.Entry<String, Deployment> entry: deployments.entrySet()) {
+ map.put(entry.getKey(), entry.getValue().verticles.size());
+ }
+ return map;
+ }
+
+ public void deployMod(final String modName, final JsonObject config,
+ final int instances, final File currentModDir, final Handler<String> doneHandler) {
+ doDeployMod(false, null, modName, config, instances, currentModDir, doneHandler);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.vertx.java.deploy.impl.VTest#installMod(java.lang.String, org.vertx.java.core.Handler)
+ */
+ public void installMod(final String moduleName, final Handler<Boolean> doneHandler) {
+ HttpClient client = vertx.createHttpClient();
+ client.setHost(defaultRepo);
+ client.exceptionHandler(new Handler<Exception>() {
+ public void handle(Exception e) {
+ log.error("Unable to connect to repository");
+ doneHandler.handle(false);
+ }
+ });
+ String uri = REPO_URI_ROOT + moduleName + "/mod.zip";
+ log.info("Attempting to install module " + moduleName + " from http://" + defaultRepo + uri);
+ HttpClientRequest req = client.get(uri, new Handler<HttpClientResponse>() {
+ public void handle(HttpClientResponse resp) {
+ if (resp.statusCode == 200) {
+ log.info("Downloading module...");
+ resp.bodyHandler(new Handler<Buffer>() {
+ public void handle(Buffer buffer) {
+ unzipModule(moduleName, buffer, doneHandler);
+ }
+ });
+ } else if (resp.statusCode == 404) {
+ log.error("Can't find module " + moduleName + " in repository");
+ doneHandler.handle(false);
+ } else {
+ log.error("Failed to download module: " + resp.statusCode);
+ doneHandler.handle(false);
+ }
+ }
+ });
+ req.putHeader("host", "vert-x.github.com");
+ req.putHeader("user-agent", "Vert.x Module Installer");
+ req.end();
+ }
+
+ public void reloadModules(final Set<Deployment> deps) {
+ for (final Deployment deployment: deps) {
+ if (deployments.containsKey(deployment.name)) {
+ doUndeploy(deployment.name, new SimpleHandler() {
+ public void handle() {
+ redeploy(deployment, deps);
+ }
+ });
+ } else {
+ // This will be the case if the previous deployment failed, e.g.
+ // a code error in a user verticle
+ redeploy(deployment, deps);
+ }
+ }
+ }
+
public synchronized void undeploy(String name, final Handler<Void> doneHandler) {
final Deployment dep = deployments.get(name);
if (dep == null) {
throw new IllegalArgumentException("There is no deployment with name " + name);
}
Handler<Void> wrappedHandler = new SimpleHandler() {
public void handle() {
- log.info("in handle of undeploy of dep " + dep.name + " dep.modName " + dep.modName + " pdn: " + dep.parentDeploymentName);
- if (dep.modName != null) {
+ if (dep.modName != null && dep.autoRedeploy) {
redeployer.moduleUndeployed(dep);
- doneHandler.handle(null);
}
+ doneHandler.handle(null);
}
};
doUndeploy(name, wrappedHandler);
}
- public synchronized Map<String, Integer> listInstances() {
- Map<String, Integer> map = new HashMap<>();
- for (Map.Entry<String, Deployment> entry: deployments.entrySet()) {
- map.put(entry.getKey(), entry.getValue().verticles.size());
+ /* (non-Javadoc)
+ * @see org.vertx.java.deploy.impl.VTest#uninstallMod(java.lang.String)
+ */
+ public void uninstallMod(String moduleName) {
+ log.info("Removing module " + moduleName + " from directory " + modRoot);
+ File modDir = new File(modRoot, moduleName);
+ if (!modDir.exists()) {
+ log.error("Cannot find module to uninstall");
+ } else {
+ try {
+ vertx.fileSystem().deleteSync(modDir.getAbsolutePath(), true);
+ log.info("Module " + moduleName + " successfully uninstalled");
+ } catch (Exception e) {
+ log.error("Failed to delete directory: " + e.getMessage());
+ }
}
- return map;
}
- public void deployMod(final String modName, final JsonObject config,
- final int instances, final File currentModDir, final Handler<String> doneHandler) {
+ private void doUndeploy(String name, final Handler<Void> doneHandler) {
+ CountingCompletionHandler count = new CountingCompletionHandler(vertx.getOrAssignContext());
+ doUndeploy(name, count);
+ if (doneHandler != null) {
+ count.setHandler(doneHandler);
+ }
+ }
+
+
+ private void redeploy(final Deployment deployment, final Set<Deployment> deployments) {
+ doDeployMod(true, deployment.name, deployment.modName, deployment.config, deployment.instances,
+ null, null);
+ }
+
+ private void doDeployMod(final boolean redeploy, final String depName, final String modName, final JsonObject config,
+ final int instances, final File currentModDir, final Handler<String> doneHandler) {
final Context ctx = vertx.getOrAssignContext();
AsyncResultHandler<Boolean> handler = new AsyncResultHandler<Boolean>() {
@@ -220,7 +311,7 @@ public void handle(AsyncResult<Boolean> res) {
public void handle(Boolean res) {
if (res) {
// Now deploy it
- deployMod(modName, config, instances, currentModDir, doneHandler);
+ doDeployMod(redeploy, depName, modName, config, instances, currentModDir, doneHandler);
} else {
executeHandlerOnContext(ctx, doneHandler, null);
}
@@ -262,16 +353,19 @@ public Boolean action() throws Exception {
if (urls == null) {
return false;
}
+
+ Boolean ar = conf.getBoolean("auto-redeploy");
+ final boolean autoRedeploy = ar == null ? false : ar;
+
Handler<String> handler = new Handler<String>() {
public void handle(String res) {
- log.info("calling handler with res " + res);
- if (res != null) {
+ if (res != null && !redeploy && autoRedeploy) {
redeployer.moduleDeployed(deployments.get(res));
}
executeHandlerOnContext(context, doneHandler, res);
}
};
- doDeploy(worker, main, modName, config,
+ doDeploy(depName, autoRedeploy, worker, main, modName, config,
urls.toArray(new URL[urls.size()]), instances, modDir, ctx, handler);
return true;
} else {
@@ -399,79 +493,6 @@ public void handle(Boolean b) {
return urls;
}
- /* (non-Javadoc)
- * @see org.vertx.java.deploy.impl.VTest#installMod(java.lang.String, org.vertx.java.core.Handler)
- */
- public void installMod(final String moduleName, final Handler<Boolean> doneHandler) {
- HttpClient client = vertx.createHttpClient();
- client.setHost(defaultRepo);
- client.exceptionHandler(new Handler<Exception>() {
- public void handle(Exception e) {
- log.error("Unable to connect to repository");
- doneHandler.handle(false);
- }
- });
- String uri = REPO_URI_ROOT + moduleName + "/mod.zip";
- log.info("Attempting to install module " + moduleName + " from http://" + defaultRepo + uri);
- HttpClientRequest req = client.get(uri, new Handler<HttpClientResponse>() {
- public void handle(HttpClientResponse resp) {
- if (resp.statusCode == 200) {
- log.info("Downloading module...");
- resp.bodyHandler(new Handler<Buffer>() {
- public void handle(Buffer buffer) {
- unzipModule(moduleName, buffer, doneHandler);
- }
- });
- } else if (resp.statusCode == 404) {
- log.error("Can't find module " + moduleName + " in repository");
- doneHandler.handle(false);
- } else {
- log.error("Failed to download module: " + resp.statusCode);
- doneHandler.handle(false);
- }
- }
- });
- req.putHeader("host", "vert-x.github.com");
- req.putHeader("user-agent", "Vert.x Module Installer");
- req.end();
- }
-
- public void reloadModules(final Set<Deployment> parents) {
- for (final Deployment deployment: parents) {
- log.info("undeploying " + deployment.name);
- if (deployments.containsKey(deployment.name)) {
- undeploy(deployment.name, new SimpleHandler() {
- public void handle() {
- log.info("undeployed");
- redeploy(deployment, parents);
- }
- });
- } else {
- // This will be the case if the previous deployment failed, e.g.
- // a code error in a user verticle
- redeploy(deployment, parents);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.vertx.java.deploy.impl.VTest#uninstallMod(java.lang.String)
- */
- public void uninstallMod(String moduleName) {
- log.info("Removing module " + moduleName + " from directory " + modRoot);
- File modDir = new File(modRoot, moduleName);
- if (!modDir.exists()) {
- log.error("Cannot find module to uninstall");
- } else {
- try {
- vertx.fileSystem().deleteSync(modDir.getAbsolutePath(), true);
- log.info("Module " + moduleName + " successfully uninstalled");
- } catch (Exception e) {
- log.error("Failed to delete directory: " + e.getMessage());
- }
- }
- }
-
private void unzipModule(final String modName, final Buffer data, final Handler<Boolean> doneHandler) {
AsyncResultHandler<Boolean> arHandler = new AsyncResultHandler<Boolean>() {
@@ -569,7 +590,9 @@ public void run() {
}
}
- private synchronized void doDeploy(boolean worker, final String main,
+ private synchronized void doDeploy(String depName,
+ boolean autoRedeploy,
+ boolean worker, final String main,
final String modName,
final JsonObject config, final URL[] urls,
int instances,
@@ -586,7 +609,8 @@ private synchronized void doDeploy(boolean worker, final String main,
}
}
- final String deploymentName = "deployment-" + UUID.randomUUID().toString();
+ final String deploymentName =
+ depName != null ? depName : "deployment-" + UUID.randomUUID().toString();
log.debug("Deploying name : " + deploymentName + " main: " + main +
" instances: " + instances);
@@ -618,7 +642,8 @@ void done(boolean res) {
String parentDeploymentName = getDeploymentName();
final Deployment deployment = new Deployment(deploymentName, modName, instances, verticleFactory,
- config == null ? new JsonObject() : config.copy(), urls, modDir, parentDeploymentName);
+ config == null ? new JsonObject() : config.copy(), urls, modDir, parentDeploymentName,
+ autoRedeploy);
addDeployment(deploymentName, deployment);
if (parentDeploymentName != null) {
Deployment parent = deployments.get(parentDeploymentName);
@@ -688,11 +713,6 @@ private void addDeployment(String deploymentName, Deployment deployment) {
deployments.put(deploymentName, deployment);
}
- private Deployment removeDeployment(String name) {
- return deployments.remove(name);
- }
-
-
// Must be synchronized since called directly from different thread
private synchronized void addVerticle(Deployment deployment, Verticle verticle) {
String loggerName = deployment.name + "-" + deployment.verticles.size();
@@ -714,26 +734,6 @@ private VerticleHolder getVerticleHolder() {
}
}
- private void doUndeploy(String name, final Handler<Void> doneHandler) {
- CountingCompletionHandler count = new CountingCompletionHandler(vertx.getOrAssignContext());
- doUndeploy(name, count);
- if (doneHandler != null) {
- count.setHandler(doneHandler);
- }
- }
-
-
- private void redeploy(final Deployment deployment, final Set<Deployment> deployments) {
- deployMod(deployment.modName, deployment.config, deployment.instances,
- null, new Handler<String>() {
- public void handle(String res) {
- if (res != null) {
- deployments.remove(deployment);
- log.info("removing deployment: " + deployment.name);
- }
- }
- });
- }
private void doUndeploy(String name, final CountingCompletionHandler count) {
View
2 vertx-platform/src/main/java/org/vertx/java/deploy/impl/cli/Starter.java
@@ -217,7 +217,7 @@ public void handle(String id) {
if (module) {
mgr.deployMod(main, conf, instances, null, doneHandler);
} else {
- mgr.deploy(worker, main, conf, urls, instances, null, doneHandler);
+ mgr.deployVerticle(worker, main, conf, urls, instances, null, doneHandler);
}
addShutdownHook();
View
8 vertx-testframework/src/main/java/org/vertx/java/framework/TestBase.java
@@ -175,9 +175,9 @@ protected String startApp(boolean worker, String main, int instances) throws Exc
}
protected String startApp(boolean worker, String main, JsonObject config, int instances, boolean await) throws Exception {
- if(Runtime.getRuntime().availableProcessors() < 2) {
- log.error("*** The test framework requires at least 2 processors ***");
- fail("The test framework requires at least 2 processors");
+ if (Runtime.getRuntime().availableProcessors() < 2) {
+ log.error("*** The test framework requires at least 2 processors ***");
+ fail("The test framework requires at least 2 processors");
}
URL url;
if (main.endsWith(".js") || main.endsWith(".rb") || main.endsWith(".groovy") || main.endsWith(".py")) {
@@ -205,7 +205,7 @@ public void handle(String deploymentName) {
}
};
- verticleManager.deploy(worker, main, config, new URL[] {url}, instances, null, doneHandler);
+ verticleManager.deployVerticle(worker, main, config, new URL[]{url}, instances, null, doneHandler);
if (!doneLatch.await(30, TimeUnit.SECONDS)) {
throw new IllegalStateException("Timedout waiting for apps to start");
View
18 vertx-testsuite/src/test/java/org/vertx/java/tests/core/redeploy/RedeployerTest.java
@@ -162,7 +162,7 @@ public void testDeleteSubDir() throws Exception {
public void testReloadMultipleDeps() throws Exception {
String modName = "my-mod";
File modDir = createModDir(modName);
- File modDir2 = createModDir("other-mod");
+ createModDir("other-mod");
createFile(modDir, "foo.js", TestUtils.randomAlphaString(1000));
Deployment dep1 = createDeployment("dep1", "my-mod", null);
red.moduleDeployed(dep1);
@@ -175,20 +175,6 @@ public void testReloadMultipleDeps() throws Exception {
waitReload(dep1, dep2);
}
- @Test
- public void testCheckReloadParent() throws Exception {
- String modName = "my-mod";
- File modDir = createModDir(modName);
- createFile(modDir, "foo.js", TestUtils.randomAlphaString(1000));
- Deployment parent = createDeployment("parent", "parent-mod", null);
- Deployment dep = createDeployment("dep1", "my-mod", "parent");
- red.moduleDeployed(parent);
- red.moduleDeployed(dep);
- Thread.sleep(500);
- createFile(modDir, "blah.txt", TestUtils.randomAlphaString(1000));
- waitReload(parent);
- }
-
private File createModDir(String modName) {
File modDir = new File(modRoot, modName);
modDir.mkdir();
@@ -263,7 +249,7 @@ private void checkDeps(Set<Deployment> deps) {
}
private Deployment createDeployment(String name, String modName, String parentName) {
- return new Deployment(name, modName, 1, null, null, null, null, parentName);
+ return new Deployment(name, modName, 1, null, null, null, null, parentName, true);
}

0 comments on commit 8ee8490

Please sign in to comment.
Something went wrong with that request. Please try again.