Search in sources :

Example 1 with OAIPolicyOperationVisitor

use of io.gravitee.rest.api.service.impl.swagger.policy.impl.OAIPolicyOperationVisitor in project gravitee-management-rest-api by gravitee-io.

the class SwaggerService_CreateAPITest method setup.

@Before
public void setup() {
    PolicyOperationVisitor swaggerPolicyOperationVisitor = mock(PolicyOperationVisitor.class);
    when(swaggerPolicyOperationVisitor.getId()).thenReturn("mock");
    PolicyOperationVisitor oaiPolicyOperationVisitor = mock(PolicyOperationVisitor.class);
    when(oaiPolicyOperationVisitor.getId()).thenReturn("mock");
    io.gravitee.policy.api.swagger.v3.OAIOperationVisitor oaiPolicyOperationVisitorImpl = mock(io.gravitee.policy.api.swagger.v3.OAIOperationVisitor.class);
    when(policyOperationVisitorManager.getPolicyVisitors()).thenReturn(asList(swaggerPolicyOperationVisitor, oaiPolicyOperationVisitor));
    OAIOperationVisitor op = mock(OAIPolicyOperationVisitor.class);
    when(op.visit(any(), any())).thenReturn(Optional.of(new Policy()));
    when(policyOperationVisitorManager.getOAIOperationVisitor(anyString())).thenReturn(op);
    GroupEntity grp1 = new GroupEntity();
    grp1.setId("group1");
    GroupEntity grp2 = new GroupEntity();
    grp2.setId("group2");
    when(groupService.findByName("group1")).thenReturn(Arrays.asList(grp1));
    when(groupService.findByName("group2")).thenReturn(Arrays.asList(grp2));
    TagEntity tag1 = new TagEntity();
    tag1.setId("tagId1");
    tag1.setName("tag1");
    TagEntity tag2 = new TagEntity();
    tag2.setId("tagId2");
    tag2.setName("tag2");
    when(tagService.findByReference(any(), any())).thenReturn(Arrays.asList(tag1, tag2));
}
Also used : Policy(io.gravitee.policy.api.swagger.Policy) OAIPolicyOperationVisitor(io.gravitee.rest.api.service.impl.swagger.policy.impl.OAIPolicyOperationVisitor) PolicyOperationVisitor(io.gravitee.rest.api.service.impl.swagger.policy.PolicyOperationVisitor) OAIOperationVisitor(io.gravitee.rest.api.service.impl.swagger.visitor.v3.OAIOperationVisitor) Before(org.junit.Before)

Aggregations

Policy (io.gravitee.policy.api.swagger.Policy)1 PolicyOperationVisitor (io.gravitee.rest.api.service.impl.swagger.policy.PolicyOperationVisitor)1 OAIPolicyOperationVisitor (io.gravitee.rest.api.service.impl.swagger.policy.impl.OAIPolicyOperationVisitor)1 OAIOperationVisitor (io.gravitee.rest.api.service.impl.swagger.visitor.v3.OAIOperationVisitor)1 Before (org.junit.Before)1