Class FlexibleSearchServiceGetModelByExampleTest
java.lang.Object
de.hybris.platform.testframework.HybrisJUnit4Test
de.hybris.platform.servicelayer.ServicelayerBaseTest
de.hybris.platform.servicelayer.ServicelayerTransactionalBaseTest
de.hybris.platform.servicelayer.search.FlexibleSearchServiceGetModelByExampleTest
- All Implemented Interfaces:
JaloSessionHolder
@IntegrationTest
public class FlexibleSearchServiceGetModelByExampleTest
extends ServicelayerTransactionalBaseTest
The
FlexibleSearchService.getModelByExample(Object) method will get a model (representing a persisted item)
by passing an example model with partly filled values. For gathering the correct model a flexiblesearch has to be
generated from filled model values to gather the persisted model.-
Field Summary
Fields inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
jaloSession -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()voidvoidvoidvoidvoidJust in case: an exception should be thrown if the example isn't a model.voidA search with a wrong set of optional values set (no related entry in system) will fail withModelNotFoundException.voidAn example without any values set is not permitted and will throw aModelLoadingException.voidA null value is not permitted and will throw aIllegalArgumentException.voidA search with an ambiguous set of optional values will will withAmbiguousIdentifierException.voidA search with a wrong set of optional values set (no related entry in system) will fail withModelNotFoundException.voidSearch with localized values is possible.voidSearch with localized values is possible.voidA search with only optional values set will succeed in general (like for unique values), restrictions on kind of optional attributes will be covered in later cases.voidA search with an already persisted model will fail with aModelLoadingException.voidvoidvoidA search using a super model will succeed and return correct sub model.voidA search with not matching optional values will throw aModelNotFoundException.voidA search with unique and optional values set should succeed in general where the optional values will be used too at query.voidA search with models attached to session can be used.voidA search with models attached to session can be used.voidIf no entry with unique attribute set can be found aModelNotFoundExceptionwill be thrown.voidA search by unique identifiers should succeed if there is exactly one entry fulfilling unique attribute values.voidAt search the composedtype of passed model has to be respected, means only models with that type or subtypes will be returned.Methods inherited from class de.hybris.platform.servicelayer.ServicelayerBaseTest
autowireProperties, getApplicationContext, getBeanName, prepareApplicationContextAndSessionMethods inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
establishJaloSession, finish, getOrCreateCurrency, getOrCreateLanguage, init, intenseChecksActivated, takeJaloSession
-
Constructor Details
-
FlexibleSearchServiceGetModelByExampleTest
public FlexibleSearchServiceGetModelByExampleTest()
-
-
Method Details
-
setUp
- Throws:
Exception
-
testWithNullFail
public void testWithNullFail()A null value is not permitted and will throw aIllegalArgumentException. -
testWithNoValuesFail
public void testWithNoValuesFail()An example without any values set is not permitted and will throw aModelLoadingException. -
testWithUniqueValuesSuccess
public void testWithUniqueValuesSuccess()A search by unique identifiers should succeed if there is exactly one entry fulfilling unique attribute values. The returned model is not same the passed one. If the entry was accessed within request already, the cached instance should be returned (here the model ofsetUp()method. -
testWithUniqueValuesAttachedToSessionFail
public void testWithUniqueValuesAttachedToSessionFail()A search with models attached to session can be used. Default values are also used as search params. -
testWithUniqueValuesAttachedToSessionSuccess
public void testWithUniqueValuesAttachedToSessionSuccess()A search with models attached to session can be used. Default values are also used as search params. -
testWithUniqueValuesFail
public void testWithUniqueValuesFail()If no entry with unique attribute set can be found aModelNotFoundExceptionwill be thrown. -
testWithUniqueAndOptionalValuesSuccess
public void testWithUniqueAndOptionalValuesSuccess()A search with unique and optional values set should succeed in general where the optional values will be used too at query. Restrictions to kind of optional values will be defined in following test cases. The resulting model should be not same as passed one (because of model cache). -
testWithUniqueAndOptionalValuesFail
public void testWithUniqueAndOptionalValuesFail()A search with not matching optional values will throw aModelNotFoundException. -
testWithOptionalValuesSuccess
public void testWithOptionalValuesSuccess()A search with only optional values set will succeed in general (like for unique values), restrictions on kind of optional attributes will be covered in later cases. -
testWithOptionalValuesLocalizedSuccess
public void testWithOptionalValuesLocalizedSuccess()Search with localized values is possible. -
testWithOptionalValuesLocalizedFail
public void testWithOptionalValuesLocalizedFail()Search with localized values is possible. -
testWithOptionalValuesFail
public void testWithOptionalValuesFail()A search with a wrong set of optional values set (no related entry in system) will fail withModelNotFoundException. -
testWithOptionalValuesAmbigiuous
public void testWithOptionalValuesAmbigiuous()A search with an ambiguous set of optional values will will withAmbiguousIdentifierException. -
testWithSavedExample
public void testWithSavedExample()A search with an already persisted model will fail with aModelLoadingException. -
testWithNotSearchableValue
public void testWithNotSearchableValue()A search with a wrong set of optional values set (no related entry in system) will fail withModelNotFoundException. -
testWithSuperTypeSuccess
public void testWithSuperTypeSuccess()A search using a super model will succeed and return correct sub model. -
testWithWrongType
public void testWithWrongType()At search the composedtype of passed model has to be respected, means only models with that type or subtypes will be returned. -
testWithNoModel
public void testWithNoModel()Just in case: an exception should be thrown if the example isn't a model. In this case the exception is thrown by the model converter registry. -
testWithSomeOptionalValuesLocalizedSuccess
public void testWithSomeOptionalValuesLocalizedSuccess() -
testWithSomeOptionalValuesLocalizedFail
public void testWithSomeOptionalValuesLocalizedFail() -
testBigChangedAttributeTestSuccessfull
public void testBigChangedAttributeTestSuccessfull() -
testBigChangedAttributeTestFail
public void testBigChangedAttributeTestFail() -
testSearchWithComposedTypeParameter
public void testSearchWithComposedTypeParameter() -
testModelNotFoundOnRemovedItem
- Throws:
ConsistencyCheckException
-