Search in sources :

Example 6 with Toolkit

use of com.ibm.streamsx.rest.build.Toolkit in project streamsx.topology by IBMStreams.

the class ToolkitAPITest method testPostToolkit.

@Test
public void testPostToolkit() throws Exception {
    Toolkit bingo = connection.uploadToolkit(bingo0Path);
    assertNotNull(bingo);
    assertEquals(bingo.getName(), bingoToolkitName);
    assertEquals(bingo.getVersion(), bingo0Version);
    assertEquals(bingo.getRequiredProductVersion(), "4.2");
    assertEquals(bingo.getResourceType(), "toolkit");
    // We don't know what the values the following attributes will have,
    // but we verify that the expected attributes do at least have values
    assertNotNull(bingo.getPath());
    // Verify that the new toolkit is in the list of all toolkits
    List<Toolkit> toolkits = connection.getToolkits();
    waitForToolkit(bingoToolkitName);
    assertTrue(bingo.delete());
}
Also used : Toolkit(com.ibm.streamsx.rest.build.Toolkit) Test(org.junit.Test)

Example 7 with Toolkit

use of com.ibm.streamsx.rest.build.Toolkit in project streamsx.topology by IBMStreams.

the class ToolkitAPITest method deleteToolkits.

@After
public void deleteToolkits() throws Exception {
    Set<String> deleteNames = new HashSet();
    deleteNames.add(gamesToolkitName);
    deleteNames.add(cardsToolkitName);
    deleteNames.add(bingoToolkitName);
    List<Toolkit> deleteToolkits;
    do {
        List<Toolkit> toolkits = connection.getToolkits();
        deleteToolkits = toolkits.stream().filter(tk -> deleteNames.contains(tk.getName())).collect(Collectors.toList());
        for (Toolkit toolkit : deleteToolkits) {
            toolkit.delete();
        }
        Thread.sleep(5000);
    } while (!deleteToolkits.isEmpty());
}
Also used : Toolkit(com.ibm.streamsx.rest.build.Toolkit) HashSet(java.util.HashSet) After(org.junit.After)

Aggregations

Toolkit (com.ibm.streamsx.rest.build.Toolkit)7 Test (org.junit.Test)6 RESTException (com.ibm.streamsx.rest.RESTException)2 DirectoryZipInputStream (com.ibm.streamsx.rest.internal.DirectoryZipInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 After (org.junit.After)1 Document (org.w3c.dom.Document)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1