-
Notifications
You must be signed in to change notification settings - Fork 0
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
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/domain/versioning/Version.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,32 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.domain.versioning; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
import java.io.Serializable; | ||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* Represents version information of any versioned entity in the system. | ||
*/ | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString | ||
@EqualsAndHashCode | ||
public class Version implements Serializable { | ||
|
||
private String id; | ||
|
||
private String creator; | ||
|
||
private LocalDateTime date; | ||
|
||
private static final long serialVersionUID = 3429591830989243421L; | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...n/java/edu/internet2/tier/shibboleth/admin/ui/service/EntityDescriptorVersionService.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,17 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.service; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor; | ||
import edu.internet2.tier.shibboleth.admin.ui.domain.frontend.EntityDescriptorRepresentation; | ||
import edu.internet2.tier.shibboleth.admin.ui.domain.versioning.Version; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* API containing operations pertaining to {@link EntityDescriptor} versioning. | ||
*/ | ||
public interface EntityDescriptorVersionService { | ||
|
||
List<Version> findVersionsForEntityDescriptor(String resourceId); | ||
|
||
EntityDescriptorRepresentation findSpecificVersionOfEntityDescriptor(String resourceId, String versionToken); | ||
} |
37 changes: 37 additions & 0 deletions
37
...net2/tier/shibboleth/admin/ui/domain/versioning/VersionJsonSerializationBasicTests.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,37 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.domain.versioning | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule | ||
import spock.lang.Specification | ||
|
||
import java.time.LocalDateTime | ||
import java.time.Month | ||
|
||
class VersionJsonSerializationBasicTests extends Specification { | ||
|
||
ObjectMapper mapper | ||
|
||
def setup() { | ||
mapper = new ObjectMapper() | ||
mapper.registerModule(new JavaTimeModule()) | ||
} | ||
|
||
def "Verify basic Version JSON serialization"() { | ||
given: | ||
def staticDate = LocalDateTime.of(2019, Month.MAY,20,15,0,0) | ||
def version = new Version('2', 'kramer', staticDate) | ||
def expectedJson = """ | ||
{ | ||
"id": "2", | ||
"creator": "kramer", | ||
"date": "${staticDate.toString()}" | ||
} | ||
""" | ||
|
||
when: | ||
def deSerialized = mapper.readValue(expectedJson, Version) | ||
|
||
then: | ||
deSerialized == version | ||
} | ||
} |