Search in sources :

Example 1 with Assets

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);
        }
    }
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Assets(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Assets) Asset(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset)

Example 2 with Assets

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));
}
Also used : Assets(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Assets) Test(org.junit.Test)

Aggregations

Assets (org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Assets)2 Test (org.junit.Test)1 WorkItemDefinition (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition)1 Asset (org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset)1