diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/ContractAgreementToContractAgreementDtoTransformerTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/ContractAgreementToContractAgreementDtoTransformerTest.java new file mode 100644 index 000000000..49904434c --- /dev/null +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/ContractAgreementToContractAgreementDtoTransformerTest.java @@ -0,0 +1,34 @@ +package de.sovity.edc.ext.wrapper.api.usecase.transformer; + +import de.sovity.edc.ext.wrapper.api.common.model.ContractAgreementDto; +import de.sovity.edc.ext.wrapper.api.common.model.PolicyDto; +import org.eclipse.edc.connector.contract.spi.types.agreement.ContractAgreement; +import org.eclipse.edc.policy.model.*; +import org.eclipse.edc.transform.spi.TransformerContext; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +public class ContractAgreementToContractAgreementDtoTransformerTest { + private final ContractAgreementToContractAgreementDtoTransformer transformer = new ContractAgreementToContractAgreementDtoTransformer(); + private final TransformerContext context = mock(TransformerContext.class); + + @Test + void types() { + assertThat(transformer.getInputType()).isEqualTo(ContractAgreement.class); + assertThat(transformer.getOutputType()).isEqualTo(ContractAgreementDto.class); + } + + @Test + void transform(){ + + + + + + + } +} diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/ContractNegotiationToContractNegotiationOutputDtoTransformerTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/ContractNegotiationToContractNegotiationOutputDtoTransformerTest.java new file mode 100644 index 000000000..391504b50 --- /dev/null +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/ContractNegotiationToContractNegotiationOutputDtoTransformerTest.java @@ -0,0 +1,27 @@ +package de.sovity.edc.ext.wrapper.api.usecase.transformer; + +import de.sovity.edc.ext.wrapper.api.common.model.ContractAgreementDto; +import de.sovity.edc.ext.wrapper.api.usecase.model.ContractNegotiationOutputDto; +import org.eclipse.edc.connector.contract.spi.types.agreement.ContractAgreement; +import org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiation; +import org.eclipse.edc.transform.spi.TransformerContext; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +public class ContractNegotiationToContractNegotiationOutputDtoTransformerTest { + private final ContractNegotiationToContractNegotiationOutputDtoTransformer transformer = new ContractNegotiationToContractNegotiationOutputDtoTransformer(); + private final TransformerContext context = mock(TransformerContext.class); + + @Test + void types() { + assertThat(transformer.getInputType()).isEqualTo(ContractNegotiation.class); + assertThat(transformer.getOutputType()).isEqualTo(ContractNegotiationOutputDto.class); + } + + @Test + void transform(){ + + } +} diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/DataReqeustToDataRequestDtoTransformerTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/DataReqeustToDataRequestDtoTransformerTest.java new file mode 100644 index 000000000..c0e3e2a20 --- /dev/null +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/DataReqeustToDataRequestDtoTransformerTest.java @@ -0,0 +1,33 @@ +package de.sovity.edc.ext.wrapper.api.usecase.transformer; + +import de.sovity.edc.ext.wrapper.api.usecase.model.ContractNegotiationOutputDto; +import de.sovity.edc.ext.wrapper.api.usecase.model.DataRequestDto; +import org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiation; +import org.eclipse.edc.connector.transfer.spi.types.DataRequest; +import org.eclipse.edc.transform.spi.TransformerContext; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +public class DataReqeustToDataRequestDtoTransformerTest { + + private final DataRequestToDataRequestDtoTransformer transformer = new DataRequestToDataRequestDtoTransformer(); + private final TransformerContext context = mock(TransformerContext.class); + + @Test + void types() { + assertThat(transformer.getInputType()).isEqualTo(DataRequest.class); + assertThat(transformer.getOutputType()).isEqualTo(DataRequestDto.class); + } + + @Test + void transform(){ + + + + + + + } +} diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/PermissionToPermissionDtoTransformerTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/PermissionToPermissionDtoTransformerTest.java new file mode 100644 index 000000000..661c417d3 --- /dev/null +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/PermissionToPermissionDtoTransformerTest.java @@ -0,0 +1,28 @@ +package de.sovity.edc.ext.wrapper.api.usecase.transformer; + +import de.sovity.edc.ext.wrapper.api.common.model.PermissionDto; +import de.sovity.edc.ext.wrapper.api.usecase.model.ContractNegotiationOutputDto; +import org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiation; +import org.eclipse.edc.policy.model.Permission; +import org.eclipse.edc.transform.spi.TransformerContext; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +public class PermissionToPermissionDtoTransformerTest { + + private final PermissionToPermissionDtoTransformer transformer = new PermissionToPermissionDtoTransformer(); + private final TransformerContext context = mock(TransformerContext.class); + + @Test + void types() { + assertThat(transformer.getInputType()).isEqualTo(Permission.class); + assertThat(transformer.getOutputType()).isEqualTo(PermissionDto.class); + } + + @Test + void transform(){ + + } +} diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/PolicyToPolicyDtoTransformerTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/PolicyToPolicyDtoTransformerTest.java new file mode 100644 index 000000000..98ba99fae --- /dev/null +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/PolicyToPolicyDtoTransformerTest.java @@ -0,0 +1,57 @@ +package de.sovity.edc.ext.wrapper.api.usecase.transformer; + +import de.sovity.edc.ext.wrapper.api.common.model.PolicyDto; +import org.eclipse.edc.policy.model.*; +import org.eclipse.edc.transform.spi.TransformerContext; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class PolicyToPolicyDtoTransformerTest { + + private final PolicyToPolicyDtoTransformer transformer = new PolicyToPolicyDtoTransformer(); + private final TransformerContext context = mock(TransformerContext.class); + + @Test + void types() { + assertThat(transformer.getInputType()).isEqualTo(Policy.class); + assertThat(transformer.getOutputType()).isEqualTo(PolicyDto.class); + } + + @Test + void transform(){ + + var target = "target-id"; + var permission = Permission.Builder.newInstance().action(Action.Builder.newInstance().type("USE").build()).build(); + var prohibition = Prohibition.Builder.newInstance().action(Action.Builder.newInstance().type("MODIFY").build()).build(); + var duty = Duty.Builder.newInstance().action(Action.Builder.newInstance().type("DELETE").build()).build(); + var policy = Policy.Builder.newInstance() + .permission(permission) + .prohibition(prohibition) + .duty(duty) + .assigner("assigner") + .assignee("assignee") + .inheritsFrom("inheritsFroms") + .type(PolicyType.SET) + .extensibleProperties(new HashMap<>()) + .build(); + + var result = transformer.transform(policy,context); + //var permissionDto = result.getPermission(); + + + + + assertThat(result).isNotNull(); + assertThat(result.getPermission()).isNotNull(); + assertThat(result.getPermission().getConstraints()).isNotNull(); + + + + + } +} diff --git a/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/TransferProcessToTransferProcessOutputDtoTransformerTest.java b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/TransferProcessToTransferProcessOutputDtoTransformerTest.java new file mode 100644 index 000000000..64fad4ead --- /dev/null +++ b/extensions/wrapper/wrapper/src/test/java/de/sovity/edc/ext/wrapper/api/usecase/transformer/TransferProcessToTransferProcessOutputDtoTransformerTest.java @@ -0,0 +1,29 @@ +package de.sovity.edc.ext.wrapper.api.usecase.transformer; + +import de.sovity.edc.ext.wrapper.api.common.model.PermissionDto; +import de.sovity.edc.ext.wrapper.api.usecase.model.TransferProcessOutputDto; +import org.eclipse.edc.connector.transfer.spi.types.TransferProcess; +import org.eclipse.edc.policy.model.Permission; +import org.eclipse.edc.transform.spi.TransformerContext; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +public class TransferProcessToTransferProcessOutputDtoTransformerTest { + + private final TransferProcessToTransferProcessOutputDtoTransformer transformer = new TransferProcessToTransferProcessOutputDtoTransformer(); + private final TransformerContext context = mock(TransformerContext.class); + + @Test + void types() { + assertThat(transformer.getInputType()).isEqualTo(TransferProcess.class); + assertThat(transformer.getOutputType()).isEqualTo(TransferProcessOutputDto.class); + } + + @Test + void transform(){ + + } + +}