@Test public void testDeployProcess() throws PluginException { HashSet<RequestParameterType<?>> mandatoryProperties = new HashSet<>(); RequestParameterType<String> prop = new RequestParameterType<>("test", "test"); mandatoryProperties.add(prop); CanonicalProcessType cpf = new CanonicalProcessType(); AnnotationsType anf = new AnnotationsType(); expect(mockDeploymentPlugin.getNativeType()).andReturn("test"); expect(mockDeploymentPlugin.getName()).andReturn("test"); expect(mockDeploymentPlugin.getVersion()).andReturn("1.0"); PluginResultImpl result = new PluginResultImpl(); result.addPluginMessage("test"); expect( mockDeploymentPlugin.deployProcess( EasyMock.eq(cpf), EasyMock.eq(anf), EasyMock.anyObject(PluginRequest.class))) .andReturn(result); replay(mockDeploymentPlugin); List<PluginMessage> messages = myService.deployProcess("test", cpf, anf, mandatoryProperties); assertTrue(messages.size() == 1); verify(mockDeploymentPlugin); }
@Test public void testFindDeploymentPlugins() throws PluginNotFoundException { HashSet<ParameterType<?>> mandatoryProperties = new HashSet<>(); ParameterType<String> prop = new PluginParameterType<>("test", "test", String.class, "test", true); mandatoryProperties.add(prop); expect(mockDeploymentPlugin.getNativeType()).andReturn("test"); expect(mockDeploymentPlugin.getName()).andReturn("test"); expect(mockDeploymentPlugin.getVersion()).andReturn("1.0"); expect(mockDeploymentPlugin.getMandatoryParameters()).andReturn(mandatoryProperties); replay(mockDeploymentPlugin); Set<DeploymentPlugin> deploymentPlugin = myService.listDeploymentPlugin("test"); assertNotNull(deploymentPlugin); assertTrue(!deploymentPlugin.isEmpty()); assertEquals(mockDeploymentPlugin, deploymentPlugin.iterator().next()); assertTrue(deploymentPlugin.iterator().next().getMandatoryParameters().contains(prop)); verify(mockDeploymentPlugin); }