use of org.apache.nifi.web.api.entity.FunnelEntity in project nifi by apache.
the class ITFunnelAccessControl method testWriteUserGetFunnel.
/**
* Ensures the WRITE user can get a funnel.
*
* @throws Exception ex
*/
@Test
public void testWriteUserGetFunnel() throws Exception {
final FunnelEntity entity = getRandomFunnel(helper.getWriteUser());
assertFalse(entity.getPermissions().getCanRead());
assertTrue(entity.getPermissions().getCanWrite());
assertNull(entity.getComponent());
}
use of org.apache.nifi.web.api.entity.FunnelEntity in project nifi by apache.
the class ITFunnelAccessControl method testReadUserGetFunnel.
/**
* Ensures the READ user can get a funnel.
*
* @throws Exception ex
*/
@Test
public void testReadUserGetFunnel() throws Exception {
final FunnelEntity entity = getRandomFunnel(helper.getReadUser());
assertTrue(entity.getPermissions().getCanRead());
assertFalse(entity.getPermissions().getCanWrite());
assertNotNull(entity.getComponent());
}
use of org.apache.nifi.web.api.entity.FunnelEntity in project nifi by apache.
the class ITFunnelAccessControl method createFunnel.
private FunnelEntity createFunnel() throws Exception {
String url = helper.getBaseUrl() + "/process-groups/root/funnels";
// create the funnel
FunnelDTO funnel = new FunnelDTO();
// create the revision
final RevisionDTO revision = new RevisionDTO();
revision.setClientId(READ_WRITE_CLIENT_ID);
revision.setVersion(0L);
// create the entity body
FunnelEntity entity = new FunnelEntity();
entity.setRevision(revision);
entity.setComponent(funnel);
// perform the request
Response response = helper.getReadWriteUser().testPost(url, entity);
// ensure the request is successful
assertEquals(201, response.getStatus());
// get the entity body
return response.readEntity(FunnelEntity.class);
}
use of org.apache.nifi.web.api.entity.FunnelEntity in project nifi by apache.
the class ITFunnelAccessControl method testReadWriteUserGetFunnel.
/**
* Ensures the READ WRITE user can get a funnel.
*
* @throws Exception ex
*/
@Test
public void testReadWriteUserGetFunnel() throws Exception {
final FunnelEntity entity = getRandomFunnel(helper.getReadWriteUser());
assertTrue(entity.getPermissions().getCanRead());
assertTrue(entity.getPermissions().getCanWrite());
assertNotNull(entity.getComponent());
}
use of org.apache.nifi.web.api.entity.FunnelEntity in project nifi by apache.
the class ITFunnelAccessControl method getRandomFunnel.
private FunnelEntity getRandomFunnel(final NiFiTestUser user) throws Exception {
final String url = helper.getBaseUrl() + "/flow/process-groups/root";
// get the flow
final Response response = user.testGet(url);
// ensure the response was successful
assertEquals(200, response.getStatus());
// unmarshal
final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class);
final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow();
final Set<FunnelEntity> funnels = flowDto.getFunnels();
// ensure the correct number of funnels
assertFalse(funnels.isEmpty());
// use the first funnel as the target
Iterator<FunnelEntity> funnelIter = funnels.iterator();
assertTrue(funnelIter.hasNext());
return funnelIter.next();
}
Aggregations