Search in sources :

Example 6 with StorageEntity

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

the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_8.

/**
 * Storage attribute: blank Default value: null Assert throw
 */
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_8() {
    String attributeName = "test";
    String attributeValue = BLANK_TEXT;
    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)

Example 7 with StorageEntity

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

the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_10.

/**
 * Storage attribute: non-existent Attribute required: false Attribute required if exists: false Assert return null
 */
@Test
public void testGetStorageAttributeIntegerValueByName_10() {
    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 8 with StorageEntity

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

the class StorageHelperTest method testGetStorageAttributeIntegerValueByNameWithDefault_1.

/**
 * Storage attribute: non-existent Default value: 2345 Assert return default value
 */
@Test
public void testGetStorageAttributeIntegerValueByNameWithDefault_1() {
    String attributeName = "test";
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity();
    Integer defaultValue = 2345;
    Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, defaultValue);
    assertEquals(defaultValue, value);
}
Also used : StorageEntity(org.finra.herd.model.jpa.StorageEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 9 with StorageEntity

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

the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_1.

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

Example 10 with StorageEntity

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

the class StorageHelperTest method testGetStorageAttributeIntegerValueByName_3.

/**
 * Storage attribute: 1234 Attribute required: false Attribute required if exists: false Assert result = 1234
 */
@Test
public void testGetStorageAttributeIntegerValueByName_3() {
    String attributeName = "test";
    String attributeValue = "1234";
    StorageEntity storageEntity = storageDaoTestHelper.createStorageEntityWithAttributes(attributeName, attributeValue);
    boolean attributeRequired = false;
    boolean attributeValueRequiredIfExists = false;
    Integer value = storageHelper.getStorageAttributeIntegerValueByName(attributeName, storageEntity, attributeRequired, attributeValueRequiredIfExists);
    assertEquals(new Integer(attributeValue), value);
}
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