use of org.apache.nifi.registry.db.entity.BucketEntity in project nifi-registry by apache.
the class TestDatabaseMetadataService method testGetBucketItemsForBucket.
// ----------------- BucketItems ---------------------------------
@Test
public void testGetBucketItemsForBucket() {
final BucketEntity bucket = metadataService.getBucketById("1");
assertNotNull(bucket);
final List<BucketItemEntity> items = metadataService.getBucketItems(bucket.getId());
assertNotNull(items);
assertEquals(2, items.size());
items.stream().forEach(i -> assertNotNull(i.getBucketName()));
}
use of org.apache.nifi.registry.db.entity.BucketEntity in project nifi-registry by apache.
the class TestDatabaseMetadataService method testUpdateBucket.
@Test
public void testUpdateBucket() {
final BucketEntity bucket = metadataService.getBucketById("1");
assertNotNull(bucket);
final String updatedName = bucket.getName() + " UPDATED";
final String updatedDesc = bucket.getDescription() + "DESC";
bucket.setName(updatedName);
bucket.setDescription(updatedDesc);
metadataService.updateBucket(bucket);
final BucketEntity updatedBucket = metadataService.getBucketById(bucket.getId());
assertNotNull(updatedName);
assertEquals(updatedName, updatedBucket.getName());
assertEquals(updatedDesc, updatedBucket.getDescription());
}
use of org.apache.nifi.registry.db.entity.BucketEntity in project nifi-registry by apache.
the class TestDatabaseMetadataService method testDeleteBucketWithChildren.
@Test
public void testDeleteBucketWithChildren() {
final BucketEntity bucket = metadataService.getBucketById("1");
assertNotNull(bucket);
metadataService.deleteBucket(bucket);
final BucketEntity deletedBucket = metadataService.getBucketById("1");
assertNull(deletedBucket);
}
use of org.apache.nifi.registry.db.entity.BucketEntity in project nifi-registry by apache.
the class TestDatabaseMetadataService method testCreateAndGetBucket.
// ----------------- Buckets ---------------------------------
@Test
public void testCreateAndGetBucket() {
final BucketEntity b = new BucketEntity();
b.setId("testBucketId");
b.setName("testBucketName");
b.setDescription("testBucketDesc");
b.setCreated(new Date());
metadataService.createBucket(b);
final BucketEntity createdBucket = metadataService.getBucketById(b.getId());
assertNotNull(createdBucket);
assertEquals(b.getId(), createdBucket.getId());
assertEquals(b.getName(), createdBucket.getName());
assertEquals(b.getDescription(), createdBucket.getDescription());
assertEquals(b.getCreated(), createdBucket.getCreated());
}
use of org.apache.nifi.registry.db.entity.BucketEntity in project nifi-registry by apache.
the class BucketEntityRowMapper method mapRow.
@Nullable
@Override
public BucketEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
final BucketEntity b = new BucketEntity();
b.setId(rs.getString("ID"));
b.setName(rs.getString("NAME"));
b.setDescription(rs.getString("DESCRIPTION"));
b.setCreated(rs.getTimestamp("CREATED"));
return b;
}
Aggregations