@Test public void testUndeploy() { AssetManager mgr = new AssetManager("", ResourceResolver.NULL_RESOLVER); AssetDeployment fooDepl = mgr.createDeployment(); fooDepl.addAsset("foo", "script", AssetLocation.APPLICATION, "foo.js", null, null, null, DUMMY_URL, "bar"); fooDepl.deploy(); AssetDeployment barDepl = mgr.createDeployment(); barDepl.addAsset("bar", "script", AssetLocation.APPLICATION, "bar.js", null, null, null, DUMMY_URL); barDepl.deploy(); List<Asset> asset = Tools.list(mgr.resolveAssets(Collections.singletonList("foo"))); assertEquals(2, asset.size()); assertEquals("bar", asset.get(0).getId()); assertEquals("foo", asset.get(1).getId()); barDepl.undeploy(); try { mgr.resolveAssets(Collections.singletonList("foo")); fail(); } catch (IllegalArgumentException expected) { } } }
@Test public void testUndeploy() { AssetManager mgr = new AssetManager("", ResourceResolver.NULL_RESOLVER); AssetDeployment fooDepl = mgr.createDeployment(); fooDepl.addAsset("foo", "script", AssetLocation.APPLICATION, "foo.js", null, null, null, DUMMY_URL, "bar"); fooDepl.deploy(); AssetDeployment barDepl = mgr.createDeployment(); barDepl.addAsset("bar", "script", AssetLocation.APPLICATION, "bar.js", null, null, null, DUMMY_URL); barDepl.deploy(); List<Asset> asset = Tools.list(mgr.resolveAssets(Collections.singletonList("foo"))); assertEquals(2, asset.size()); assertEquals("bar", asset.get(0).getId()); assertEquals("foo", asset.get(1).getId()); barDepl.undeploy(); try { mgr.resolveAssets(Collections.singletonList("foo")); fail(); } catch (IllegalArgumentException expected) { } } }