use of org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Assets in project kie-wb-common by kiegroup.
the class WorkItemDefinitionRemoteDeployService method deploy.
void deploy(final Metadata metadata, final String url, final String names) {
if (null != url && url.trim().length() > 0) {
final Collection<WorkItemDefinition> items = remoteLookupService.execute(WorkItemDefinitionRemoteRequest.build(url, names));
final List<Asset> assets = items.stream().flatMap(this::toAssets).collect(Collectors.toList());
if (!assets.isEmpty()) {
// Deploy into file system.
backendFileSystemManager.deploy(resources.resolveResourcesPath(metadata), new Assets(assets), DEPLOY_MESSAGE + url);
// Install into current KIE runtime.
projectInstaller.install(items, metadata);
}
}
}
use of org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Assets in project kie-wb-common by kiegroup.
the class WorkItemDefinitionRemoteDeployServiceTest method testDeploy.
@Test
public void testDeploy() {
org.uberfire.java.nio.file.Path resourcePath = mock(org.uberfire.java.nio.file.Path.class);
when(resources.resolveResourcesPath(eq(metadata))).thenReturn(resourcePath);
tested.deploy(metadata, URL);
ArgumentCaptor<Assets> assetsArgumentCaptor = ArgumentCaptor.forClass(Assets.class);
verify(backendFileSystemManager, times(1)).deploy(eq(resourcePath), assetsArgumentCaptor.capture(), anyString());
Assets assets = assetsArgumentCaptor.getValue();
assertNotNull(assets);
assertEquals(2, assets.getAssets().size());
assertTrue(assets.getAssets().contains(widAsset));
assertTrue(assets.getAssets().contains(iconAsset));
}
Aggregations