@Test
  public void repositoryCreatedFromScannedDataDirRules() throws Exception {
    final URL u =
        Thread.currentThread()
            .getContextClassLoader()
            .getResource("data/autoprox/simple-factory.groovy");
    final File f = new File(u.getPath());

    final File scriptFile = new File(autoproxDataDir, f.getName());
    FileUtils.copyFile(f, scriptFile);

    System.out.println("Parsing rules for: " + name.getMethodName());
    catalog.parseRules();

    final String testUrl = http.formatUrl("target", "test");

    logger.info("\n\nSETTING UP / VERIFYING REMOTE SERVER EXPECTATIONS");
    http.get(testUrl, 404);
    http.expect(testUrl, 200);
    //        targetResponder.approveTargets( "test" );
    http.get(testUrl, 200);
    logger.info("DONE: SETTING UP / VERIFYING REMOTE SERVER EXPECTATIONS\n\n");

    catalog.setEnabled(false);
    assertThat(proxyManager.getRemoteRepository("test"), nullValue());
    catalog.setEnabled(true);

    final RemoteRepository repo = proxyManager.getRemoteRepository("test");

    assertThat(repo, notNullValue());
    assertThat(repo.getName(), equalTo("test"));
    assertThat(repo.getUrl(), equalTo(testUrl));
  }
  @Test
  public void repositoryAutoCreated() throws Exception {
    simpleCatalog();

    final String testUrl = http.formatUrl("target", "test");
    http.get(testUrl, 404);
    http.expect(testUrl, 200);
    http.expect(testUrl, 200);
    //        targetResponder.approveTargets( "test" );
    http.get(testUrl, 200);

    catalog.setEnabled(false);
    assertThat(proxyManager.getRemoteRepository("test"), nullValue());
    catalog.setEnabled(true);

    final RemoteRepository repo = proxyManager.getRemoteRepository("test");

    assertThat(repo, notNullValue());
    assertThat(repo.getName(), equalTo("test"));
    assertThat(repo.getUrl(), equalTo(testUrl));
  }