-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added wrapper:api:usecase:transformer test sekeltons
- Loading branch information
Showing
6 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...apper/api/usecase/transformer/ContractAgreementToContractAgreementDtoTransformerTest.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,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(){ | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...usecase/transformer/ContractNegotiationToContractNegotiationOutputDtoTransformerTest.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,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(){ | ||
|
||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...y/edc/ext/wrapper/api/usecase/transformer/DataReqeustToDataRequestDtoTransformerTest.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,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(){ | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ity/edc/ext/wrapper/api/usecase/transformer/PermissionToPermissionDtoTransformerTest.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,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(){ | ||
|
||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...a/de/sovity/edc/ext/wrapper/api/usecase/transformer/PolicyToPolicyDtoTransformerTest.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,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(); | ||
|
||
|
||
|
||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...per/api/usecase/transformer/TransferProcessToTransferProcessOutputDtoTransformerTest.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,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(){ | ||
|
||
} | ||
|
||
} |