Search in sources :

Example 11 with StorageEntity

use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.

the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_13.

/**
 * Storage attribute: null Attribute required: false Attribute required if exists: false Assert return null
 */
@Test
public void testGetStorageAttributeIntegerValueByName_13() {
    String attributeName = "test";
    String attributeValue = null;
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
    boolean attributeRequired = true;
    boolean attributeValueRequiredIfExists = false;
    assertEquals(attributeValue, storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists));
}
Also used : StorageEntity(org.finra.herd.model.jpa.StorageEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 12 with StorageEntity

use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.

the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_8.

/**
 * Storage attribute: non-existent Attribute required: false Attribute required if exists: true Assert return null
 */
@Test
public void testGetStorageAttributeIntegerValueByName_8() {
    String attributeName = "test";
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity();
    boolean attributeRequired = false;
    boolean attributeValueRequiredIfExists = true;
    Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
    assertEquals(null, value);
}
Also used : StorageEntity(org.finra.herd.model.jpa.StorageEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 13 with StorageEntity

use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.

the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_5.

/**
 * Storage attribute: abcd Default value: 2345 Assert throw
 */
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_5() {
    String attributeName = "test";
    String attributeValue = "abcd";
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
    Integer defaultValue = 2345;
    try {
        storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, defaultValue);
        fail();
    } catch (Exception e) {
        assertEquals(IllegalStateException.class, e.getClass());
        assertEquals("Storage attribute \"" + attributeName + "\" must be a valid integer. Actual value is \"" + attributeValue + "\"", e.getMessage());
    }
}
Also used : StorageEntity(org.finra.herd.model.jpa.StorageEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 14 with StorageEntity

use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.

the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_7.

/**
 * Storage attribute: blank Attribute required: false Attribute required if exists: false Assert throw
 */
@Test
public void testGetStorageAttributeIntegerValueByName_7() {
    String attributeName = "test";
    String attributeValue = BLANK_TEXT;
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
    boolean attributeRequired = false;
    boolean attributeValueRequiredIfExists = false;
    try {
        storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
        fail();
    } catch (Exception e) {
        assertEquals(IllegalStateException.class, e.getClass());
        assertEquals("Storage attribute \"" + attributeName + "\" must be a valid integer. Actual value is \"" + attributeValue + "\"", e.getMessage());
    }
}
Also used : StorageEntity(org.finra.herd.model.jpa.StorageEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 15 with StorageEntity

use of org.finra.herd.model.jpa.StorageEntity in project herd by FINRAOS.

the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_6.

/**
 * Storage attribute: abcd Default value: null Assert throw
 */
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_6() {
    String attributeName = "test";
    String attributeValue = "abcd";
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
    Integer defaultValue = null;
    try {
        storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, defaultValue);
        fail();
    } catch (Exception e) {
        assertEquals(IllegalStateException.class, e.getClass());
        assertEquals("Storage attribute \"" + attributeName + "\" must be a valid integer. Actual value is \"" + attributeValue + "\"", e.getMessage());
    }
}
Also used : StorageEntity(org.finra.herd.model.jpa.StorageEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Aggregations

StorageEntity (org.finra.herd.model.jpa.StorageEntity)141 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)67 Test (org.junit.Test)63 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)57 ArrayList (java.util.ArrayList)42 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)38 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)34 StorageUnitStatusEntity (org.finra.herd.model.jpa.StorageUnitStatusEntity)24 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)23 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)23 Predicate (javax.persistence.criteria.Predicate)18 Attribute (org.finra.herd.model.api.xml.Attribute)18 BusinessObjectDataStatusEntity (org.finra.herd.model.jpa.BusinessObjectDataStatusEntity)18 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)17 FileTypeEntity (org.finra.herd.model.jpa.FileTypeEntity)17 StorageFileEntity (org.finra.herd.model.jpa.StorageFileEntity)16 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)15 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)14 StoragePlatformEntity (org.finra.herd.model.jpa.StoragePlatformEntity)14 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)13