WIP
This commit is contained in:
16
pom.xml
16
pom.xml
@@ -23,6 +23,22 @@
|
||||
<module>spring-cloud-release-tools-spring</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-bom.version>Edgware.BUILD-SNAPSHOT</spring-cloud-bom.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud-bom.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
@@ -97,6 +101,25 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sagan</groupId>
|
||||
<artifactId>sagan-site</artifactId>
|
||||
<classifier>stubs</classifier>
|
||||
<version>1.0.0.BUILD-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -43,6 +43,8 @@ public class ReleaserProperties {
|
||||
|
||||
private Gradle gradle = new Gradle();
|
||||
|
||||
private Sagan sagan = new Sagan();
|
||||
|
||||
private Map<String, String> fixedVersions = new HashMap<>();
|
||||
|
||||
public static class Git {
|
||||
@@ -257,11 +259,11 @@ public class ReleaserProperties {
|
||||
* Defaults to test projects and samples.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<String> ignoredGradleRegex = Arrays.asList(new String[] {
|
||||
private List<String> ignoredGradleRegex = Arrays.asList(
|
||||
"^.*spring-cloud-contract-maven-plugin/src/test/projects/.*$",
|
||||
"^.*spring-cloud-contract-maven-plugin/target/.*$",
|
||||
"^.*samples/standalone/[a-z]+/.*$"
|
||||
});
|
||||
);
|
||||
|
||||
public Map<String, String> getGradlePropsSubstitution() {
|
||||
return this.gradlePropsSubstitution;
|
||||
@@ -280,6 +282,22 @@ public class ReleaserProperties {
|
||||
this.ignoredGradleRegex = ignoredGradleRegex;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Sagan {
|
||||
/**
|
||||
* URL to the Sagan API
|
||||
*/
|
||||
private String baseUrl;
|
||||
|
||||
public String getBaseUrl() {
|
||||
return this.baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public String getWorkingDir() {
|
||||
return StringUtils.hasText(this.workingDir) ?
|
||||
this.workingDir : System.getProperty("user.dir");
|
||||
@@ -328,4 +346,12 @@ public class ReleaserProperties {
|
||||
public void setFixedVersions(Map<String, String> fixedVersions) {
|
||||
this.fixedVersions = fixedVersions;
|
||||
}
|
||||
|
||||
public Sagan getSagan() {
|
||||
return this.sagan;
|
||||
}
|
||||
|
||||
public void setSagan(Sagan sagan) {
|
||||
this.sagan = sagan;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class ProjectMetadata {
|
||||
private String id = "";
|
||||
private String name = "";
|
||||
private String repoUrl = "";
|
||||
private String siteUrl = "";
|
||||
private String category = "";
|
||||
private String stackOverflowTags;
|
||||
private boolean aggregator;
|
||||
private List<String> stackOverflowTagList;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class ReleaseMetadata {
|
||||
private String releaseStatus;
|
||||
private String refDocUrl;
|
||||
private String apiDocUrl;
|
||||
private String groupId;
|
||||
private String artifactId;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class RepositoryMetadata {
|
||||
private String id;
|
||||
private String name;
|
||||
private String url;
|
||||
private boolean snapshotsEnabled;
|
||||
|
||||
public RepositoryMetadata() {
|
||||
}
|
||||
|
||||
public RepositoryMetadata(String id, String name, String url,
|
||||
boolean snapshotsEnabled) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.snapshotsEnabled = snapshotsEnabled;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public boolean isSnapshotsEnabled() {
|
||||
return this.snapshotsEnabled;
|
||||
}
|
||||
|
||||
public void setSnapshotsEnabled(boolean snapshotsEnabled) {
|
||||
this.snapshotsEnabled = snapshotsEnabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class SaganClient {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
private final String baseUrl;
|
||||
|
||||
SaganClient(RestTemplate restTemplate, ReleaserProperties properties) {
|
||||
this.restTemplate = restTemplate;
|
||||
this.baseUrl = properties.getSagan().getBaseUrl();
|
||||
}
|
||||
|
||||
void getProject(String projectName) {
|
||||
this.restTemplate.getForObject(this.baseUrl + "/project_metadata/{projectName}", Object.class, projectName);
|
||||
}
|
||||
|
||||
void getRelease(String projectName, String releaseVersion) {
|
||||
|
||||
}
|
||||
|
||||
// POST
|
||||
void createOrUpdateRelease(String projectName, Object release) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@AutoConfigureStubRunner(ids = "sagan:sagan-site")
|
||||
public class SaganClientTests {
|
||||
|
||||
@Value("${stubrunner.runningstubs.sagan-site.port}") Integer saganPort;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user