Fixed test to used Vault in place of Encrypted

This commit is contained in:
Luca Frosini 2023-02-27 15:09:22 +01:00
parent 913e82e88c
commit 934f1eb942
1 changed files with 9 additions and 9 deletions

View File

@ -3,8 +3,8 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
import java.net.URI;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.model.impl.properties.VaultImpl;
import org.gcube.informationsystem.model.reference.properties.Vault;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
import org.gcube.informationsystem.types.TypeMapper;
@ -40,16 +40,16 @@ public class AccessPointFacetTest {
accessPointFacet.setAdditionalProperty("Test", "MyTest");
Encrypted encrypted = new EncryptedImpl();
encrypted.setEncryptedValue("Encrypted");
accessPointFacet.setAdditionalProperty("Enc", encrypted);
Vault vault = new VaultImpl();
vault.setValue("Encrypted");
accessPointFacet.setAdditionalProperty("Enc", vault);
String marshalled = ElementMapper.marshal(accessPointFacet);
logger.debug(marshalled);
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc");
logger.debug(ElementMapper.marshal(enc));
Vault vlt = (Vault) apf.getAdditionalProperty("Enc");
logger.debug(ElementMapper.marshal(vlt));
String reMarshalled = ElementMapper.marshal(apf);
logger.debug(reMarshalled);
@ -59,8 +59,8 @@ public class AccessPointFacetTest {
public void testEncryptedSpecilization() throws Exception {
String marshalled = "{\"@class\":\"AccessPointFacet\",\"header\":null,\"entryName\":\"port1\",\"endpoint\":\"https://localhost\",\"protocol\":null,\"description\":null,\"authorization\":{\"@class\":\"ValueSchema\",\"value\":\"pwd\",\"type\":\"https://www.gcube-system.org\"},\"Test\":\"MyTest\",\"Enc\":{\"@class\":\"MyEncrypted\",\"@superClasses\":[\"Encrypted\", \"Property\"],\"value\":\"Encrypted\"}}";
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc");
logger.debug(ElementMapper.marshal(enc));
Vault vlt = (Vault) apf.getAdditionalProperty("Enc");
logger.debug(ElementMapper.marshal(vlt));
String reMarshalled = ElementMapper.marshal(apf);
logger.debug(reMarshalled);
}