-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
212 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
judge-d-server/src/main/java/dev/hltech/dredd/domain/environment/SpaceServiceVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package dev.hltech.dredd.domain.environment; | ||
|
||
import dev.hltech.dredd.domain.ServiceVersion; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.Access; | ||
import javax.persistence.AccessType; | ||
import javax.persistence.Embeddable; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
import static lombok.AccessLevel.PROTECTED; | ||
|
||
@Embeddable | ||
@Getter | ||
@EqualsAndHashCode(callSuper = true) | ||
@NoArgsConstructor(access = PROTECTED) | ||
@Access(AccessType.FIELD) | ||
public class SpaceServiceVersion extends ServiceVersion { | ||
|
||
private String space; | ||
|
||
public SpaceServiceVersion(String space, String name, String version) { | ||
super(name, version); | ||
this.space = checkNotNull(space, "space name cannot be null"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
judge-d-server/src/main/java/dev/hltech/dredd/interfaces/rest/environment/ServiceForm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
judge-d-server/src/main/resources/db/changelog/db.changelog-0.4.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext | ||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd | ||
http://www.liquibase.org/xml/ns/dbchangelog | ||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"> | ||
|
||
<changeSet id="add spaces" author="Tomasz Krzyzak"> | ||
<addColumn tableName="service_versions"> | ||
<column name="space" type="character varying" /> | ||
</addColumn> | ||
<update tableName="service_versions"> | ||
<column name="space" value="default" /> | ||
</update> | ||
<dropPrimaryKey tableName="service_versions" /> | ||
<addNotNullConstraint tableName="service_versions" columnName="space" columnDataType="character varying" /> | ||
<addPrimaryKey tableName="service_versions" columnNames="environment_name, name, version, space" /> | ||
</changeSet> | ||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...-server/src/test/groovy/dev/hltech/dredd/domain/environment/EnvironmentAggregateUT.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dev.hltech.dredd.domain.environment | ||
|
||
import com.google.common.collect.ImmutableMultimap | ||
import dev.hltech.dredd.domain.ServiceVersion | ||
import spock.lang.Specification | ||
|
||
import static dev.hltech.dredd.domain.environment.EnvironmentAggregate.DEFAULT_NAMESPACE | ||
|
||
class EnvironmentAggregateUT extends Specification { | ||
|
||
def 'should return services by space'() { | ||
given: | ||
def aggregate = new EnvironmentAggregate( | ||
'env', | ||
ImmutableMultimap.<String, ServiceVersion> builder() | ||
.put(DEFAULT_NAMESPACE, new ServiceVersion("s1", "s1")) | ||
.put("space1", new ServiceVersion("s2", "s2")) | ||
.build() | ||
) | ||
when: | ||
def defaultSpaceServiceVersions = aggregate.getServices(DEFAULT_NAMESPACE); | ||
def space1ServiceVersions = aggregate.getServices("space1"); | ||
then: | ||
defaultSpaceServiceVersions == [new ServiceVersion("s1", "s1")] as Set | ||
space1ServiceVersions == [new ServiceVersion("s2", "s2")] as Set | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters