コード例 #1
0
  @Test
  public void testGetTestdrives() throws Exception {
    SUSEStudioRequester<List<Testdrive>> requester =
        new SUSEStudioRequester<List<Testdrive>>() {
          public List<Testdrive> request(SUSEStudio suseStudio) throws SUSEStudioException {
            return suseStudio.getTestdrives();
          }
        };
    TestExampleResponder responder = new TestExampleResponder("testdrives.xml");
    List<Testdrive> result = new HttpServerMock().getResult(requester, responder);

    assertNotNull(result);
    Testdrive testdrive = result.get(0);
    assertEquals("4", testdrive.getId());
    assertEquals("running", testdrive.getState());
    assertEquals("22", testdrive.getBuildId());
  }
コード例 #2
0
  @Test
  public void testStartTestdrive() throws Exception {
    SUSEStudioRequester<Testdrive> requester =
        new SUSEStudioRequester<Testdrive>() {
          public Testdrive request(SUSEStudio suseStudio) throws SUSEStudioException {
            return suseStudio.startTestdrive(0);
          }
        };
    TestExampleResponder responder = new TestExampleResponder("testdrive.xml");
    Testdrive result = new HttpServerMock().getResult(requester, responder);

    assertNotNull(result);
    assertEquals("1234", result.getId());
    assertEquals("new", result.getState());
    assertEquals("12345", result.getBuildId());
    assertEquals(
        "http://node52.susestudio.com/testdrive/testdrive/start/11/22/abcdefgh1234567890",
        result.getUrl());

    VNCServer vncServer = result.getVNCServer();
    assertEquals("node52.susestudio.com", vncServer.getHost());
    assertEquals("5902", vncServer.getPort());
    assertEquals("1234567890", vncServer.getPassword());
  }