コード例 #1
0
  private void setupMockJira() throws Exception {

    final int port = Integer.parseInt(TestProperties.getString("jira-server-port"));

    final File mockDb = getTestFile("jira-mock.db");

    StubJira mock = new StubJira();
    mock.setDatabase(Files.toString(mockDb, Charset.forName("utf-8")));

    // we have to give a real version (set in DB and here), because either nexus freaks out
    // otherwise
    MockAttachmentHandler handler = new MockAttachmentHandler();
    handler.setSupportedVersion("4.3");

    handler.setMock(mock);
    List<AttachmentHandler> handlers = Arrays.<AttachmentHandler>asList(handler);
    server = new JettyServerProvider();
    server.setPort(port);
    server.addServlet(new JiraXmlRpcTestServlet(mock, server.getUrl(), handlers));
    server.start();
  }
コード例 #2
0
 @After
 public void shutdownJiraMock() throws Exception {
   if (server != null) {
     server.stop();
   }
 }