Search in sources :

Example 36 with BucketEntity

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()));
}
Also used : BucketEntity(org.apache.nifi.registry.db.entity.BucketEntity) BucketItemEntity(org.apache.nifi.registry.db.entity.BucketItemEntity) Test(org.junit.Test)

Example 37 with BucketEntity

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());
}
Also used : BucketEntity(org.apache.nifi.registry.db.entity.BucketEntity) Test(org.junit.Test)

Example 38 with BucketEntity

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);
}
Also used : BucketEntity(org.apache.nifi.registry.db.entity.BucketEntity) Test(org.junit.Test)

Example 39 with BucketEntity

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());
}
Also used : BucketEntity(org.apache.nifi.registry.db.entity.BucketEntity) Date(java.util.Date) Test(org.junit.Test)

Example 40 with BucketEntity

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;
}
Also used : BucketEntity(org.apache.nifi.registry.db.entity.BucketEntity) Nullable(org.springframework.lang.Nullable)

Aggregations

BucketEntity (org.apache.nifi.registry.db.entity.BucketEntity)49 Test (org.junit.Test)32 FlowEntity (org.apache.nifi.registry.db.entity.FlowEntity)31 Date (java.util.Date)26 FlowSnapshotEntity (org.apache.nifi.registry.db.entity.FlowSnapshotEntity)16 ResourceNotFoundException (org.apache.nifi.registry.exception.ResourceNotFoundException)14 VersionedFlow (org.apache.nifi.registry.flow.VersionedFlow)11 Bucket (org.apache.nifi.registry.bucket.Bucket)10 VersionedFlowSnapshotMetadata (org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata)9 VersionedFlowSnapshot (org.apache.nifi.registry.flow.VersionedFlowSnapshot)8 ArrayList (java.util.ArrayList)5 InputStream (java.io.InputStream)3 TreeSet (java.util.TreeSet)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 BucketItem (org.apache.nifi.registry.bucket.BucketItem)2 BucketItemEntity (org.apache.nifi.registry.db.entity.BucketItemEntity)2 FlowSnapshotContext (org.apache.nifi.registry.flow.FlowSnapshotContext)2 VersionedProcessGroup (org.apache.nifi.registry.flow.VersionedProcessGroup)2 StandardFlowSnapshotContext (org.apache.nifi.registry.provider.flow.StandardFlowSnapshotContext)2