/** * Creates and persists database entities required for business object data availability collection testing. */ public void createDatabaseEntitiesForBusinessObjectDataAvailabilityCollectionTesting() { // Create a storage unit entity. storageUnitDaoTestHelper.createStorageUnitEntity(AbstractServiceTest.STORAGE_NAME, AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, AbstractServiceTest.FORMAT_FILE_TYPE_CODE, AbstractServiceTest.FORMAT_VERSION, AbstractServiceTest.PARTITION_VALUE, AbstractServiceTest.SUBPARTITION_VALUES, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, AbstractServiceTest.NO_STORAGE_DIRECTORY_PATH); }
/** * Creates and persists a new storage unit entity. * * @param storageName the storage name * @param businessObjectDataKey the business object data key * @param storageUnitStatus the storage unit status * * @return the newly created storage unit entity */ public StorageUnitEntity createStorageUnitEntity(String storageName, BusinessObjectDataKey businessObjectDataKey, String storageUnitStatus) { return createStorageUnitEntity(storageName, StoragePlatformEntity.S3, businessObjectDataKey, AbstractDaoTest.LATEST_VERSION_FLAG_SET, AbstractDaoTest.BDATA_STATUS, storageUnitStatus, AbstractDaoTest.NO_STORAGE_DIRECTORY_PATH); }
/** * Creates and persists a new storage unit entity. * * @param storageName the storage name * @param businessObjectDataKey the business object data key * @param businessObjectDataLatestVersion specifies if the business object data is flagged as latest version or not * @param businessObjectDataStatusCode the business object data status * @param storageUnitStatus the storage unit status * @param storageDirectoryPath the storage directory path * * @return the newly created storage unit entity */ public StorageUnitEntity createStorageUnitEntity(String storageName, BusinessObjectDataKey businessObjectDataKey, Boolean businessObjectDataLatestVersion, String businessObjectDataStatusCode, String storageUnitStatus, String storageDirectoryPath) { return createStorageUnitEntity(storageName, StoragePlatformEntity.S3, businessObjectDataKey, businessObjectDataLatestVersion, businessObjectDataStatusCode, storageUnitStatus, storageDirectoryPath); }
private void createDatabaseEntitiesForStorageFilesTesting() { // Create relative database entities. StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(StorageEntity.MANAGED_STORAGE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, true, BDATA_STATUS, STORAGE_UNIT_STATUS, NO_STORAGE_DIRECTORY_PATH); for (String file : LOCAL_FILES) { storageFileDaoTestHelper.createStorageFileEntity(storageUnitEntity, file, FILE_SIZE_1_KB, ROW_COUNT_1000); } } }
/** * Creates and persists a new storage unit entity. * * @param storageEntity the storage entity * @param businessObjectDataEntity the business object data entity * @param storageUnitStatus the storage unit status * @param directoryPath the storage directory path * * @return the newly created storage unit entity. */ public StorageUnitEntity createStorageUnitEntity(StorageEntity storageEntity, BusinessObjectDataEntity businessObjectDataEntity, String storageUnitStatus, String directoryPath) { // Create a storage unit status entity, if not exists. StorageUnitStatusEntity storageUnitStatusEntity = storageUnitStatusDao.getStorageUnitStatusByCode(storageUnitStatus); if (storageUnitStatusEntity == null) { storageUnitStatusEntity = storageUnitStatusDaoTestHelper.createStorageUnitStatusEntity(storageUnitStatus); } return createStorageUnitEntity(storageEntity, businessObjectDataEntity, storageUnitStatusEntity, directoryPath); }
private void createTestDatabaseEntities(BusinessObjectDataKey businessObjectDataKey, String businessObjectDataStatus, StorageEntity storageEntity, String storageFilePath, int createdOnTimestampMinutesOffset) throws Exception { // Create a business object data entity. BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, true, businessObjectDataStatus); // Apply the offset in minutes to createdOn value. businessObjectDataEntity.setCreatedOn(new Timestamp(businessObjectDataEntity.getCreatedOn().getTime() - createdOnTimestampMinutesOffset * 60 * 1000)); StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(storageEntity, businessObjectDataEntity, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); storageFileDaoTestHelper.createStorageFileEntity(storageUnitEntity, storageFilePath, FILE_SIZE_1_KB, ROW_COUNT_1000); herdDao.saveAndRefresh(businessObjectDataEntity); }
@Ignore @Test(expected = PersistenceException.class) public void testDeleteStorageConstraintViolation() throws Exception { // Create a storage unit entity that refers to a newly created storage. final StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, STORAGE_UNIT_STATUS, NO_STORAGE_DIRECTORY_PATH); executeWithoutLogging(SqlExceptionHelper.class, new Command() { @Override public void execute() { // Delete the storage which is invalid because there still exists a storage unit entity that references it. StorageKey alternateKey = new StorageKey(storageUnitEntity.getStorage().getName()); storageService.deleteStorage(alternateKey); } }); }
@Test public void testGetRelationalTableRegistrationsForSchemaUpdate() { // Create a storage unit entity for a relational table registration. StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper.createStorageUnitEntity(STORAGE_NAME, StoragePlatformEntity.RELATIONAL, new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FileTypeEntity.RELATIONAL_TABLE_FILE_TYPE, INITIAL_FORMAT_VERSION, BusinessObjectDataServiceImpl.NO_PARTITIONING_PARTITION_VALUE, NO_SUBPARTITION_VALUES, INITIAL_DATA_VERSION), AbstractDaoTest.LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, StorageUnitStatusEntity.ENABLED, AbstractDaoTest.NO_STORAGE_DIRECTORY_PATH); // Get a list of relational table registrations for the schema update.. List<BusinessObjectDataStorageUnitKey> result = relationalTableRegistrationService.getRelationalTableRegistrationsForSchemaUpdate(); // Validate the results. assertEquals(Collections.singletonList(storageUnitHelper.createStorageUnitKeyFromEntity(storageUnitEntity)), result); }
@Test public void testGetStorageUnitByKeyNoSubPartitionValues() { // Create and persist the relative database entities. StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, STORAGE_UNIT_STATUS, STORAGE_DIRECTORY_PATH); // Get a storage unit. assertEquals(storageUnitEntity, storageUnitDao.getStorageUnitByKey( new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME))); }
@Test public void testCheckBusinessObjectDataAvailabilityBusinessObjectDataNotAvailableNoValidStatus() { // Prepare test data with business object data not having the VALID status. storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, true, BDATA_STATUS, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); // Create and execute a business object data availability request without a business object data version. BusinessObjectDataAvailabilityRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityRequest(PARTITION_KEY, Arrays.asList(PARTITION_VALUE)); request.setBusinessObjectDataVersion(null); BusinessObjectDataAvailability resultAvailability = businessObjectDataService.checkBusinessObjectDataAvailability(request); // Validate the results. BusinessObjectDataStatus expectedNotAvailableStatus = new BusinessObjectDataStatus(FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, BDATA_STATUS); businessObjectDataServiceTestHelper .validateBusinessObjectDataAvailability(request, NO_BUSINESS_OBJECT_DATA_STATUSES, Arrays.asList(expectedNotAvailableStatus), resultAvailability); }
@Test public void testBusinessObjectDataEntitiesMatchingStoragePoliciesInvalidStoragePolicyStatus() { // Create and persist a disabled storage policy entity. storagePolicyDaoTestHelper.createStoragePolicyEntity(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME), StoragePolicyRuleTypeEntity.DAYS_SINCE_BDATA_REGISTERED, BDATA_AGE_IN_DAYS, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, StoragePolicyTransitionTypeEntity.GLACIER, StoragePolicyStatusEntity.DISABLED, INITIAL_VERSION, LATEST_VERSION_FLAG_SET); // Create and persist a storage unit with ENABLED status in the storage policy filter storage. storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); // Try to retrieve the business object data matching to the storage policy. Map<BusinessObjectDataEntity, StoragePolicyEntity> result = businessObjectDataDao .getBusinessObjectDataEntitiesMatchingStoragePolicies(new StoragePolicyPriorityLevel(false, false, false), Collections.singletonList(BDATA_STATUS), 0, 0, MAX_RESULT); // Validate the results. assertEquals(0, result.size()); }
@Test public void testGetStorageUnitsByStorageAndBusinessObjectData() { // Create database entities required for testing. StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, STORAGE_UNIT_STATUS, TEST_S3_KEY_PREFIX); // Retrieve storage unit entities by storage and business object data. List<StorageUnitEntity> resultStorageUnitEntities = storageUnitDao.getStorageUnitsByStorageAndBusinessObjectData(storageUnitEntity.getStorage(), Collections.singletonList(storageUnitEntity.getBusinessObjectData())); // Validate the results. assertNotNull(resultStorageUnitEntities); assertEquals(1, resultStorageUnitEntities.size()); assertEquals(TEST_S3_KEY_PREFIX, resultStorageUnitEntities.get(0).getDirectoryPath()); }
@Test public void testBusinessObjectDataEntitiesMatchingStoragePoliciesInvalidSourceStorage() { // Create and persist a storage policy entity. storagePolicyDaoTestHelper.createStoragePolicyEntity(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME), StoragePolicyRuleTypeEntity.DAYS_SINCE_BDATA_REGISTERED, BDATA_AGE_IN_DAYS, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, StoragePolicyTransitionTypeEntity.GLACIER, StoragePolicyStatusEntity.ENABLED, INITIAL_VERSION, LATEST_VERSION_FLAG_SET); // Create and persist a storage unit with ENABLED status which is not in the storage policy filter storage. storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME_3, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); // Try to retrieve the business object data matching to the storage policy. Map<BusinessObjectDataEntity, StoragePolicyEntity> result = businessObjectDataDao .getBusinessObjectDataEntitiesMatchingStoragePolicies(new StoragePolicyPriorityLevel(false, false, false), Collections.singletonList(BDATA_STATUS), 0, 0, MAX_RESULT); // Validate the results. assertEquals(0, result.size()); }
@Test public void testBusinessObjectDataEntitiesMatchingStoragePoliciesNoStoragePolicyLatestVersion() { // Create and persist an enabled storage policy entity that has no latest version flag set. storagePolicyDaoTestHelper.createStoragePolicyEntity(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME), StoragePolicyRuleTypeEntity.DAYS_SINCE_BDATA_REGISTERED, BDATA_AGE_IN_DAYS, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, StoragePolicyTransitionTypeEntity.GLACIER, StoragePolicyStatusEntity.ENABLED, INITIAL_VERSION, NO_LATEST_VERSION_FLAG_SET); // Create and persist a storage unit with ENABLED status in the storage policy filter storage. storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); // Try to retrieve the business object data matching to the storage policy. Map<BusinessObjectDataEntity, StoragePolicyEntity> result = businessObjectDataDao .getBusinessObjectDataEntitiesMatchingStoragePolicies(new StoragePolicyPriorityLevel(false, false, false), Collections.singletonList(BDATA_STATUS), 0, 0, MAX_RESULT); // Validate the results. assertEquals(0, result.size()); }
@Test public void testBusinessObjectDataEntitiesMatchingStoragePoliciesInvalidBusinessObjectDataStatus() { // Create and persist a storage policy entity. storagePolicyDaoTestHelper.createStoragePolicyEntity(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME), StoragePolicyRuleTypeEntity.DAYS_SINCE_BDATA_REGISTERED, BDATA_AGE_IN_DAYS, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, StoragePolicyTransitionTypeEntity.GLACIER, StoragePolicyStatusEntity.ENABLED, INITIAL_VERSION, LATEST_VERSION_FLAG_SET); // Create and persist a storage unit in the storage policy filter storage, but having "not supported" business object data status. storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS_2, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); // Try to retrieve the business object data matching to the storage policy. Map<BusinessObjectDataEntity, StoragePolicyEntity> result = businessObjectDataDao .getBusinessObjectDataEntitiesMatchingStoragePolicies(new StoragePolicyPriorityLevel(false, false, false), Collections.singletonList(BDATA_STATUS), 0, 0, MAX_RESULT); // Validate the results. assertEquals(0, result.size()); }
@Test public void testGetStorageUnitByBusinessObjectDataAndStorageName() { StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, STORAGE_UNIT_STATUS, STORAGE_DIRECTORY_PATH); BusinessObjectDataEntity businessObjectDataEntity = storageUnitEntity.getBusinessObjectData(); // test retrieval by name assertEquals(storageUnitEntity, storageUnitDao.getStorageUnitByBusinessObjectDataAndStorageName(businessObjectDataEntity, STORAGE_NAME)); // test retrieval by name, case insensitive assertEquals(storageUnitEntity, storageUnitDao.getStorageUnitByBusinessObjectDataAndStorageName(businessObjectDataEntity, STORAGE_NAME.toUpperCase())); assertEquals(storageUnitEntity, storageUnitDao.getStorageUnitByBusinessObjectDataAndStorageName(businessObjectDataEntity, STORAGE_NAME.toLowerCase())); // test retrieval failure assertNull(storageUnitDao.getStorageUnitByBusinessObjectDataAndStorageName(businessObjectDataEntity, "I_DO_NOT_EXIST")); }
@Test public void testGetStorageFileByStorageUnitEntityAndFilePath() { // Create relative database entities. StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(StorageEntity.MANAGED_STORAGE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, true, BDATA_STATUS, StorageUnitStatusEntity.ENABLED, NO_STORAGE_DIRECTORY_PATH); storageFileDaoTestHelper.createStorageFileEntity(storageUnitEntity, LOCAL_FILE, FILE_SIZE_1_KB, ROW_COUNT_1000); StorageFileEntity storageFileEntity = storageFileDao.getStorageFileByStorageUnitEntityAndFilePath(storageUnitEntity, LOCAL_FILE); assertThat("Actual path does not equal expected path.", storageFileEntity.getPath(), is(LOCAL_FILE)); assertThat("Actual file size does not equal expected file size.", storageFileEntity.getFileSizeBytes(), is(FILE_SIZE_1_KB)); assertThat("Actual row count does not equal expected row count.", storageFileEntity.getRowCount(), is(ROW_COUNT_1000)); // Confirm negative results when using wrong input parameters. assertNull("Expected null value.", storageFileDao.getStorageFileByStorageUnitEntityAndFilePath(storageUnitEntity, LOCAL_FILE.toUpperCase())); assertNull("Expected null value.", storageFileDao.getStorageFileByStorageUnitEntityAndFilePath(storageUnitEntity, "I_DO_NOT_EXIST")); assertNull("Expected null value.", storageFileDao.getStorageFileByStorageUnitEntityAndFilePath(new StorageUnitEntity(), LOCAL_FILES.get(0))); }
@Test public void testGetBusinessObjectDataPartitionValueNoStorageSpecified() { // Create database entities required for testing. StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity(STORAGE_NAME, STORAGE_PLATFORM_CODE); storageUnitDaoTestHelper .createStorageUnitEntity(storageEntity.getName(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, STORAGE_UNIT_STATUS, NO_STORAGE_DIRECTORY_PATH); // Create a business object format key. BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION); // Validate that we can retrieve maximum and minimum partition values without specifying storage. assertEquals(PARTITION_VALUE, businessObjectDataDao .getBusinessObjectDataMaxPartitionValue(BusinessObjectDataEntity.FIRST_PARTITION_COLUMN_POSITION, businessObjectFormatKey, NO_DATA_VERSION, NO_BDATA_STATUS, NO_STORAGE_NAMES, null, null, null, null)); assertEquals(PARTITION_VALUE, businessObjectDataDao .getBusinessObjectDataMinPartitionValue(BusinessObjectDataEntity.FIRST_PARTITION_COLUMN_POSITION, businessObjectFormatKey, NO_DATA_VERSION, NO_BDATA_STATUS, NO_STORAGE_NAMES, null, null)); }
/** * Creates and persists a new storage unit entity. * * @param businessObjectDataStorageUnitKey the business object data storage unit key * @param storageUnitStatus the storage unit status * * @return the newly created storage unit entity */ public StorageUnitEntity createStorageUnitEntity(BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey, String storageUnitStatus) { return createStorageUnitEntity(businessObjectDataStorageUnitKey.getStorageName(), businessObjectDataStorageUnitKey.getNamespace(), businessObjectDataStorageUnitKey.getBusinessObjectDefinitionName(), businessObjectDataStorageUnitKey.getBusinessObjectFormatUsage(), businessObjectDataStorageUnitKey.getBusinessObjectFormatFileType(), businessObjectDataStorageUnitKey.getBusinessObjectFormatVersion(), businessObjectDataStorageUnitKey.getPartitionValue(), businessObjectDataStorageUnitKey.getSubPartitionValues(), businessObjectDataStorageUnitKey.getBusinessObjectDataVersion(), AbstractDaoTest.LATEST_VERSION_FLAG_SET, AbstractDaoTest.BDATA_STATUS, storageUnitStatus, AbstractDaoTest.NO_STORAGE_DIRECTORY_PATH); }
@Test public void testGetStorageUnitByBusinessObjectDataAndStorage() { StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper .createStorageUnitEntity(STORAGE_NAME, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, INITIAL_DATA_VERSION, LATEST_VERSION_FLAG_SET, BDATA_STATUS, STORAGE_UNIT_STATUS, STORAGE_DIRECTORY_PATH); BusinessObjectDataEntity businessObjectDataEntity = storageUnitEntity.getBusinessObjectData(); StorageEntity storageEntity = storageUnitEntity.getStorage(); // Test retrieval by entities. assertEquals(storageUnitEntity, storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity)); // Test retrieval failures. assertNull( storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(), storageEntity)); assertNull(storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageDaoTestHelper.createStorageEntity())); }