Github user alaninmcr commented on a diff in the pull request:

    
https://github.com/apache/incubator-taverna-common-activities/pull/14#discussion_r70790253
  
    --- Diff: 
taverna-docker-activity/src/test/java/org/apache/taverna/activities/docker/test/DockerActivityTest.java
 ---
    @@ -85,4 +95,57 @@ public void testInspectImage() throws Exception {
             System.out.println(outputs.get(DockerActivity.RESPONSE_BODY_KEY));
             
Assert.assertNotNull(outputs.get(DockerActivity.RESPONSE_BODY_KEY));
        }
    +
    +    /**
    +     * Tests a simple script (String output = input + "_returned") to 
ensure the script is invoked correctly.
    +     * @throws Exception
    +     */
    +    @Test
    +    public void testCreateContainer() throws Exception {
    +        RemoteClient remoteClient = new 
RemoteClient(containerConfiguration);
    +        Container container = 
getContainerFromName(remoteClient.listContainers(), CONTAINER_NAME);
    +        if( container != null){
    +            System.out.println("#### Container already exists #### \n" + 
container.toString());
    +            Assert.assertNotNull(container);
    +            return;
    +        }
    +
    +        
containerConfiguration.getInternalPropertyMap().put(DockerContainerConfigurationImpl.IMAGE,IMAGE_NAME);
    +        
containerConfiguration.getInternalPropertyMap().put(DockerContainerConfigurationImpl.NAME,
 CONTAINER_NAME);
    +        DockerActivity activity = new 
DockerActivity(containerConfiguration);
    +        activity.configure(activityConfiguration);
    +
    +        Map<String,Object> inputs = new HashMap<String,Object>();
    +        inputs.put(DockerActivity.ACTION, DockerActivity.CREATE_CONTAINER);
    +
    +        Map<String, Class<?>> expectedOutputs = new HashMap<String, 
Class<?>>();
    +        expectedOutputs.put(DockerActivity.RESPONSE_BODY_KEY, 
String.class);
    +
    +        Map<String,Object> outputs = 
ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
    +        System.out.println(outputs.get(DockerActivity.RESPONSE_BODY_KEY));
    +        
Assert.assertNotNull(outputs.get(DockerActivity.RESPONSE_BODY_KEY));
    +        String id = new 
ObjectMapper().readTree((String)outputs.get(DockerActivity.RESPONSE_BODY_KEY)).get("container-id").textValue();
    --- End diff --
    
    Better split into several statements? Difficult to see what it is doing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to