/** * Create an instance of {@link BusinessObjectDataStorageUnitKey } * */ public BusinessObjectDataStorageUnitKey createBusinessObjectDataStorageUnitKey() { return new BusinessObjectDataStorageUnitKey(); }
/** * Create an instance of {@link BusinessObjectDataStorageUnitKey } * */ public BusinessObjectDataStorageUnitKey createBusinessObjectDataStorageUnitKey() { return new BusinessObjectDataStorageUnitKey(); }
/** * Create an instance of {@link BusinessObjectDataStorageUnitKey } * */ public BusinessObjectDataStorageUnitKey createBusinessObjectDataStorageUnitKey() { return new BusinessObjectDataStorageUnitKey(); }
public Object createNewInstance() { return new BusinessObjectDataStorageUnitKey(); }
public Object createNewInstance() { return new BusinessObjectDataStorageUnitKey(); }
public Object createNewInstance() { return new BusinessObjectDataStorageUnitKey(); }
@Test public void testGetS3StorageUnitsToExpire() { // Create a storage unit entity. StorageUnitEntity storageUnitEntity = new StorageUnitEntity(); // Create a list of storage unit entities. List<StorageUnitEntity> storageUnitEntities = Arrays.asList(storageUnitEntity); // Create a storage unit key. BusinessObjectDataStorageUnitKey storageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); // Mock the external calls. when(storageUnitDao.getS3StorageUnitsToExpire(MAX_RESULT)).thenReturn(storageUnitEntities); when(storageUnitHelper.createStorageUnitKeyFromEntity(storageUnitEntity)).thenReturn(storageUnitKey); // Call the method under test. List<BusinessObjectDataStorageUnitKey> result = expireRestoredBusinessObjectDataServiceImpl.getS3StorageUnitsToExpire(MAX_RESULT); // Verify the external calls. verify(storageUnitDao).getS3StorageUnitsToExpire(MAX_RESULT); verify(storageUnitHelper).createStorageUnitKeyFromEntity(storageUnitEntity); verifyNoMoreInteractionsHelper(); // Validate the result. assertEquals(Arrays.asList(storageUnitKey), result); }
/** * Creates a business object data storage unit key from business object data key and storage name. * * @param businessObjectDataKey the business object data key * @param storageName the storage name * * @return the storage unit key */ public BusinessObjectDataStorageUnitKey createBusinessObjectDataStorageUnitKey(BusinessObjectDataKey businessObjectDataKey, String storageName) { return new BusinessObjectDataStorageUnitKey(businessObjectDataKey.getNamespace(), businessObjectDataKey.getBusinessObjectDefinitionName(), businessObjectDataKey.getBusinessObjectFormatUsage(), businessObjectDataKey.getBusinessObjectFormatFileType(), businessObjectDataKey.getBusinessObjectFormatVersion(), businessObjectDataKey.getPartitionValue(), businessObjectDataKey.getSubPartitionValues(), businessObjectDataKey.getBusinessObjectDataVersion(), storageName); }
/** * Creates a storage unit key from a business object data key and a storage name. * * @param businessObjectDataKey the business object data key * @param storageName the storage name * * @return the storage unit key */ public BusinessObjectDataStorageUnitKey createStorageUnitKey(BusinessObjectDataKey businessObjectDataKey, String storageName) { return new BusinessObjectDataStorageUnitKey(businessObjectDataKey.getNamespace(), businessObjectDataKey.getBusinessObjectDefinitionName(), businessObjectDataKey.getBusinessObjectFormatUsage(), businessObjectDataKey.getBusinessObjectFormatFileType(), businessObjectDataKey.getBusinessObjectFormatVersion(), businessObjectDataKey.getPartitionValue(), businessObjectDataKey.getSubPartitionValues(), businessObjectDataKey.getBusinessObjectDataVersion(), storageName); }
@Test public void testGetBusinessObjectDataKey() { // Get a business object data key. BusinessObjectDataKey result = storageUnitHelper.getBusinessObjectDataKey( new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME)); // Validate the result object. assertEquals( new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), result); }
/** * Creates a business object data storage unit key from business object data key and storage name. * * @param businessObjectDataKey the business object data key * @param storageName the storage name * * @return the storage unit key */ public BusinessObjectDataStorageUnitKey createBusinessObjectDataStorageUnitKey(BusinessObjectDataKey businessObjectDataKey, String storageName) { return new BusinessObjectDataStorageUnitKey(businessObjectDataKey.getNamespace(), businessObjectDataKey.getBusinessObjectDefinitionName(), businessObjectDataKey.getBusinessObjectFormatUsage(), businessObjectDataKey.getBusinessObjectFormatFileType(), businessObjectDataKey.getBusinessObjectFormatVersion(), businessObjectDataKey.getPartitionValue(), businessObjectDataKey.getSubPartitionValues(), businessObjectDataKey.getBusinessObjectDataVersion(), storageName); }
@Test public void testCreateStorageUnitKeyFromEntity() { // Create a business object data storage unit key. BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); // Create a storage unit entity. StorageUnitEntity storageUnitEntity = storageUnitDaoTestHelper.createStorageUnitEntity(businessObjectDataStorageUnitKey, STORAGE_UNIT_STATUS); // Mock the external calls. when(businessObjectDataHelper.getSubPartitionValues(storageUnitEntity.getBusinessObjectData())).thenReturn(SUBPARTITION_VALUES); // Call the method under test. BusinessObjectDataStorageUnitKey result = storageUnitHelper.createStorageUnitKeyFromEntity(storageUnitEntity); // Verify the external calls. verify(businessObjectDataHelper).getSubPartitionValues(storageUnitEntity.getBusinessObjectData()); verifyNoMoreInteractionsHelper(); // Validate the results. assertEquals(new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME), result); }
@Test public void testCreateBusinessObjectDataStorageUnitKey() { // Get a business object data storage unit key. BusinessObjectDataStorageUnitKey result = storageUnitHelper.createBusinessObjectDataStorageUnitKey( new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), STORAGE_NAME); // Validate the result object. assertEquals(new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME), 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 testCreateStorageUnitKey() { // Get a storage unit key. BusinessObjectDataStorageUnitKey result = storageUnitHelper.createStorageUnitKey( new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), STORAGE_NAME); // Validate the result object. assertEquals(new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME), result); }
/** * Creates a storage unit key from a business object data key and a storage name. * * @param businessObjectDataKey the business object data key * @param storageName the storage name * * @return the storage unit key */ public BusinessObjectDataStorageUnitKey createStorageUnitKey(BusinessObjectDataKey businessObjectDataKey, String storageName) { return new BusinessObjectDataStorageUnitKey(businessObjectDataKey.getNamespace(), businessObjectDataKey.getBusinessObjectDefinitionName(), businessObjectDataKey.getBusinessObjectFormatUsage(), businessObjectDataKey.getBusinessObjectFormatFileType(), businessObjectDataKey.getBusinessObjectFormatVersion(), businessObjectDataKey.getPartitionValue(), businessObjectDataKey.getSubPartitionValues(), businessObjectDataKey.getBusinessObjectDataVersion(), storageName); }
@Test public void testGetStorageUnitEntityByKey() { // Create a storage unit key. BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); // Create a storage unit entity. StorageUnitEntity storageUnitEntity = new StorageUnitEntity(); // Mock the external calls. when(storageUnitDao.getStorageUnitByKey(businessObjectDataStorageUnitKey)).thenReturn(storageUnitEntity); // Call the method under test. StorageUnitEntity result = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey); // Validate the results. assertEquals(storageUnitEntity, result); // Verify the external calls. verify(storageUnitDao).getStorageUnitByKey(businessObjectDataStorageUnitKey); verifyNoMoreInteractionsHelper(); }
@Test public void testValidateBusinessObjectDataStorageUnitCreateRequestDirectoryOnlyRegistration() { // Create a business object data storage unit key. BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); // Call the method under test. businessObjectDataStorageUnitServiceImpl.validateBusinessObjectDataStorageUnitCreateRequest( new BusinessObjectDataStorageUnitCreateRequest(businessObjectDataStorageUnitKey, new StorageDirectory(STORAGE_DIRECTORY_PATH), NO_STORAGE_FILES, DISCOVER_STORAGE_FILES)); // Verify the external calls. verify(storageUnitHelper).validateBusinessObjectDataStorageUnitKey(businessObjectDataStorageUnitKey); verifyNoMoreInteractionsHelper(); }
@Test public void testPrepareToFinalizeRestoreBusinessObjectDataNoExists() { // Try to prepare to finalize a restore for a non-existing business object data. try { businessObjectDataFinalizeRestoreHelperService.prepareToFinalizeRestore( new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME)); fail(); } catch (ObjectNotFoundException e) { assertEquals(businessObjectDataServiceTestHelper .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage()); } }
/** * Creates a storage unit key from a storage unit entity. * * @param storageUnitEntity the storage unit entity * * @return the storage unit key */ public BusinessObjectDataStorageUnitKey createStorageUnitKeyFromEntity(StorageUnitEntity storageUnitEntity) { // Get the business object data entity. BusinessObjectDataEntity businessObjectDataEntity = storageUnitEntity.getBusinessObjectData(); // Create and initialize the storage unit key. BusinessObjectDataStorageUnitKey storageUnitKey = new BusinessObjectDataStorageUnitKey(); storageUnitKey.setNamespace(businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode()); storageUnitKey.setBusinessObjectDefinitionName(businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName()); storageUnitKey.setBusinessObjectFormatUsage(businessObjectDataEntity.getBusinessObjectFormat().getUsage()); storageUnitKey.setBusinessObjectFormatFileType(businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode()); storageUnitKey.setBusinessObjectFormatVersion(businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion()); storageUnitKey.setPartitionValue(businessObjectDataEntity.getPartitionValue()); storageUnitKey.setSubPartitionValues(businessObjectDataHelper.getSubPartitionValues(businessObjectDataEntity)); storageUnitKey.setBusinessObjectDataVersion(businessObjectDataEntity.getVersion()); storageUnitKey.setStorageName(storageUnitEntity.getStorage().getName()); return storageUnitKey; }