Restored code to be used later on

This commit is contained in:
Luca Frosini 2021-03-08 14:57:16 +01:00
parent f29d362d75
commit cdd6c121e1
1 changed files with 39 additions and 0 deletions

View File

@ -21,8 +21,47 @@ public class FacetManagementTest extends ContextTest {
// private static Logger logger = LoggerFactory.getLogger(ERManagementTest.class); // private static Logger logger = LoggerFactory.getLogger(ERManagementTest.class);
public static final String GROUP = "InformationSystem";
public static final String NAME = "resource-registry";
public static final String VERSION = "1.0.0";
public static final String NEW_VERSION = "2.0.0";
public static SoftwareFacet getSoftwareFacet() {
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
softwareFacet.setGroup(GROUP);
softwareFacet.setName(NAME);
softwareFacet.setVersion(VERSION);
return softwareFacet;
}
public static void checkSoftwareFacetAssertion(SoftwareFacet softwareFacet, String version) {
Assert.assertTrue(softwareFacet.getGroup().compareTo(GROUP) == 0);
Assert.assertTrue(softwareFacet.getName().compareTo(NAME) == 0);
Assert.assertTrue(softwareFacet.getVersion().compareTo(version) == 0);
}
public static void checkHeader(IdentifiableElement er, UUID uuid, boolean create) {
Assert.assertTrue(er.getHeader() != null);
Assert.assertTrue(er.getHeader().getUUID() != null);
if(uuid != null) {
Assert.assertTrue(er.getHeader().getUUID().compareTo(uuid) == 0);
}
String user = HeaderUtility.getUser();
Assert.assertTrue(er.getHeader().getLastUpdateBy().compareTo(user) == 0);
if(create) {
Assert.assertTrue(er.getHeader().getCreatedBy().compareTo(user) == 0);
Assert.assertTrue(er.getHeader().getCreationTime().compareTo(er.getHeader().getLastUpdateTime()) == 0);
} else {
Assert.assertTrue(er.getHeader().getCreationTime().before(er.getHeader().getLastUpdateTime()));
}
}
public static void checkAssertion(Facet facet, UUID uuid, boolean create) {
checkHeader(facet, uuid, create);
}
// //
// protected <F extends Facet> F create(F facet) throws Exception { // protected <F extends Facet> F create(F facet) throws Exception {
// FacetManagement facetManagement = new FacetManagement(); // FacetManagement facetManagement = new FacetManagement();