private Settings settingsWithJettyRepository() { Settings settings = new Settings(); Profile defaultProfile = new Profile(); defaultProfile.setId("default"); Repository repo1 = new Repository(); repo1.setId("repo1"); repo1.setUrl("http://localhost:" + port + "/repository"); defaultProfile.addRepository(repo1); settings.addProfile(defaultProfile); settings.addActiveProfile("default"); return settings; }
private Settings settingsForRepository(String id, String url) { Settings settings = new Settings(); Profile profile = new Profile(); profile.setId("test"); Repository repo = new Repository(); repo.setId(id); repo.setUrl(url); profile.addRepository(repo); settings.addProfile(profile); settings.addActiveProfile("test"); return settings; }
private Settings settingsWithUnresponsiveRepository() { Settings settings = new Settings(); Profile defaultProfile = new Profile(); defaultProfile.setId("default"); Repository repo1 = new Repository(); repo1.setId("repo1"); // see: // - https://tools.ietf.org/html/rfc5737 // - https://en.wikipedia.org/wiki/Reserved_IP_addresses repo1.setUrl("http://192.0.2.0/repository"); defaultProfile.addRepository(repo1); settings.addProfile(defaultProfile); settings.addActiveProfile("default"); return settings; }
@Test public void autoDiscoverWithOneCompleteLocationFromSettingsProfileRepoWithConfirmation() throws NexusDiscoveryException { Settings settings = new Settings(); String url = "http://nexus.somewhere.com/"; String id = "some-mirror"; String user = "******"; String password = "******"; testClientManager.testUrl = url; testClientManager.testUser = user; testClientManager.testPassword = password; Server server = new Server(); server.setId(id); server.setUsername(user); server.setPassword(password); settings.addServer(server); org.apache.maven.settings.Repository repo = new org.apache.maven.settings.Repository(); repo.setId(id); repo.setUrl(url); repo.setName("Profile Repository"); org.apache.maven.settings.Profile profile = new org.apache.maven.settings.Profile(); profile.addRepository(repo); settings.addProfile(profile); Model model = new Model(); model.setModelVersion("4.0.0"); model.setGroupId("group.id"); model.setArtifactId("artifact-id"); model.setVersion("1"); MavenProject project = new MavenProject(model); prompter.addExpectation("Use this connection?", "y"); discovery.discover(settings, project, "blah", false); }