Fixed test to used Vault in place of Encrypted
This commit is contained in:
parent
913e82e88c
commit
934f1eb942
|
@ -3,8 +3,8 @@ package org.gcube.resourcemanagement.model.reference.entities.facets;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.gcube.informationsystem.base.reference.Element;
|
import org.gcube.informationsystem.base.reference.Element;
|
||||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
import org.gcube.informationsystem.model.impl.properties.VaultImpl;
|
||||||
import org.gcube.informationsystem.model.reference.properties.Encrypted;
|
import org.gcube.informationsystem.model.reference.properties.Vault;
|
||||||
import org.gcube.informationsystem.serialization.ElementMapper;
|
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||||
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
|
import org.gcube.informationsystem.types.PropertyTypeName.BaseType;
|
||||||
import org.gcube.informationsystem.types.TypeMapper;
|
import org.gcube.informationsystem.types.TypeMapper;
|
||||||
|
@ -40,16 +40,16 @@ public class AccessPointFacetTest {
|
||||||
|
|
||||||
accessPointFacet.setAdditionalProperty("Test", "MyTest");
|
accessPointFacet.setAdditionalProperty("Test", "MyTest");
|
||||||
|
|
||||||
Encrypted encrypted = new EncryptedImpl();
|
Vault vault = new VaultImpl();
|
||||||
encrypted.setEncryptedValue("Encrypted");
|
vault.setValue("Encrypted");
|
||||||
accessPointFacet.setAdditionalProperty("Enc", encrypted);
|
accessPointFacet.setAdditionalProperty("Enc", vault);
|
||||||
|
|
||||||
String marshalled = ElementMapper.marshal(accessPointFacet);
|
String marshalled = ElementMapper.marshal(accessPointFacet);
|
||||||
logger.debug(marshalled);
|
logger.debug(marshalled);
|
||||||
|
|
||||||
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
|
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
|
||||||
Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc");
|
Vault vlt = (Vault) apf.getAdditionalProperty("Enc");
|
||||||
logger.debug(ElementMapper.marshal(enc));
|
logger.debug(ElementMapper.marshal(vlt));
|
||||||
String reMarshalled = ElementMapper.marshal(apf);
|
String reMarshalled = ElementMapper.marshal(apf);
|
||||||
logger.debug(reMarshalled);
|
logger.debug(reMarshalled);
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ public class AccessPointFacetTest {
|
||||||
public void testEncryptedSpecilization() throws Exception {
|
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\"}}";
|
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);
|
AccessPointFacet apf = ElementMapper.unmarshal(AccessPointFacet.class, marshalled);
|
||||||
Encrypted enc = (Encrypted) apf.getAdditionalProperty("Enc");
|
Vault vlt = (Vault) apf.getAdditionalProperty("Enc");
|
||||||
logger.debug(ElementMapper.marshal(enc));
|
logger.debug(ElementMapper.marshal(vlt));
|
||||||
String reMarshalled = ElementMapper.marshal(apf);
|
String reMarshalled = ElementMapper.marshal(apf);
|
||||||
logger.debug(reMarshalled);
|
logger.debug(reMarshalled);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue