Class CharonFacadeImplTest
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.runtime.cps.impl.CharonFacadeImplTest
-
@UnitTest public class CharonFacadeImplTest extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected CPSCharacteristicInputchangesprotected CPSCharacteristiccharacteristicprotected CPSCharacteristiccharacteristic2protected CharonFacadeImplclassUnderTestprotected ConfigurationClientclientprotected CommerceExternalConfigurationStrategycommerceExternalConfigurationStrategyprotected static java.lang.StringCONFIG_IDprotected CPSConfigurationconfigurationprotected com.hybris.charon.RawResponse<CPSConfiguration>configurationGetResponseprotected CPSConfigurationParentReferenceStrategyconfigurationParentReferenceStrategyprotected CPSContextSuppliercontextSupplierprotected javax.ws.rs.core.NewCookiecookieprotected static java.lang.StringCOOKIE_AS_STRINGprotected static java.lang.StringCOOKIE_NAMEprotected static java.lang.StringCOOKIE_VALUEprotected CPSResponseAttributeStrategyImplcookieHandlerprotected java.util.List<java.lang.String>cookieListprotected CPSCachecpsCacheprotected static java.lang.StringCSTIC_IDprotected static java.lang.StringCSTIC_ID2protected rx.Observable<java.lang.String>emptyResponseObservableprotected RequestErrorHandlererrorHandlerprotected com.hybris.charon.RawResponse<CPSConfiguration>eTagRawResponseprotected rx.Observable<com.hybris.charon.RawResponse>eTagRawResponseObservableprotected rx.Observable<com.hybris.charon.RawResponse>eTagRawResponseObservableSuccessorprotected com.hybris.charon.RawResponse<CPSConfiguration>eTagRawResponseSuccessorprotected static java.lang.StringEXTERNAL_CONFIG_STRINGprotected CPSExternalConfigurationexternalConfigurationprotected CPSCommerceExternalConfigurationexternalConfigurationCommerceFormatprotected CPSCharacteristicGroupgroupprotected static java.lang.StringGROUP_IDprotected I18NServicei18NServiceprotected static java.lang.StringITEM_IDprotected static java.lang.IntegerKB_IDprotected static java.lang.StringLANGprotected com.fasterxml.jackson.databind.ObjectMapperobjectMapperMockprotected static java.lang.StringOLD_VERSIONprotected java.util.Optional<java.lang.String>optinalETagprotected java.util.Optional<java.lang.String>optinalETagSuccessorprotected static java.lang.StringPRODUCT_CODEprotected com.hybris.charon.RawResponse<CPSConfiguration>rawResponseprotected rx.Observable<com.hybris.charon.RawResponse<CPSConfiguration>>rawResponseObservableprotected java.util.List<javax.ws.rs.core.NewCookie>responseCookiesprotected CPSItemrootItemprotected java.lang.RuntimeExceptionruntimeExceptionWrappingNPEprotected java.lang.RuntimeExceptionruntimeExceptionWrappingTimeoutprotected static java.lang.StringSUB_ITEM_CSTICprotected static java.lang.StringSUB_ITEM_CSTIC_VALUEprotected java.util.concurrent.TimeoutExceptiontimeoutExceptionprotected static java.lang.StringVERSIONprotected static java.lang.StringVERSION_SUCCESSOR
-
Constructor Summary
Constructors Constructor Description CharonFacadeImplTest()
-
Method Summary
-
-
-
Field Detail
-
classUnderTest
protected CharonFacadeImpl classUnderTest
-
PRODUCT_CODE
protected static final java.lang.String PRODUCT_CODE
- See Also:
- Constant Field Values
-
EXTERNAL_CONFIG_STRING
protected static final java.lang.String EXTERNAL_CONFIG_STRING
- See Also:
- Constant Field Values
-
KB_ID
protected static final java.lang.Integer KB_ID
-
COOKIE_NAME
protected static final java.lang.String COOKIE_NAME
- See Also:
- Constant Field Values
-
COOKIE_VALUE
protected static final java.lang.String COOKIE_VALUE
- See Also:
- Constant Field Values
-
COOKIE_AS_STRING
protected static final java.lang.String COOKIE_AS_STRING
- See Also:
- Constant Field Values
-
CONFIG_ID
protected static final java.lang.String CONFIG_ID
- See Also:
- Constant Field Values
-
VERSION_SUCCESSOR
protected static final java.lang.String VERSION_SUCCESSOR
- See Also:
- Constant Field Values
-
VERSION
protected static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
OLD_VERSION
protected static final java.lang.String OLD_VERSION
- See Also:
- Constant Field Values
-
SUB_ITEM_CSTIC_VALUE
protected static final java.lang.String SUB_ITEM_CSTIC_VALUE
- See Also:
- Constant Field Values
-
SUB_ITEM_CSTIC
protected static final java.lang.String SUB_ITEM_CSTIC
- See Also:
- Constant Field Values
-
LANG
protected static final java.lang.String LANG
-
ITEM_ID
protected static final java.lang.String ITEM_ID
- See Also:
- Constant Field Values
-
GROUP_ID
protected static final java.lang.String GROUP_ID
- See Also:
- Constant Field Values
-
CSTIC_ID
protected static final java.lang.String CSTIC_ID
- See Also:
- Constant Field Values
-
CSTIC_ID2
protected static final java.lang.String CSTIC_ID2
- See Also:
- Constant Field Values
-
configuration
protected final CPSConfiguration configuration
-
rootItem
protected final CPSItem rootItem
-
group
protected final CPSCharacteristicGroup group
-
characteristic
protected final CPSCharacteristic characteristic
-
characteristic2
protected final CPSCharacteristic characteristic2
-
responseCookies
protected final java.util.List<javax.ws.rs.core.NewCookie> responseCookies
-
externalConfiguration
protected final CPSExternalConfiguration externalConfiguration
-
externalConfigurationCommerceFormat
protected final CPSCommerceExternalConfiguration externalConfigurationCommerceFormat
-
commerceExternalConfigurationStrategy
@Mock protected CommerceExternalConfigurationStrategy commerceExternalConfigurationStrategy
-
optinalETag
protected final java.util.Optional<java.lang.String> optinalETag
-
optinalETagSuccessor
protected final java.util.Optional<java.lang.String> optinalETagSuccessor
-
cookieList
protected final java.util.List<java.lang.String> cookieList
-
changes
protected CPSCharacteristicInput changes
-
emptyResponseObservable
protected rx.Observable<java.lang.String> emptyResponseObservable
-
eTagRawResponseObservable
protected rx.Observable<com.hybris.charon.RawResponse> eTagRawResponseObservable
-
eTagRawResponseObservableSuccessor
protected rx.Observable<com.hybris.charon.RawResponse> eTagRawResponseObservableSuccessor
-
rawResponseObservable
protected rx.Observable<com.hybris.charon.RawResponse<CPSConfiguration>> rawResponseObservable
-
errorHandler
@Mock protected RequestErrorHandler errorHandler
-
cookieHandler
@Mock protected CPSResponseAttributeStrategyImpl cookieHandler
-
cookie
@Mock protected javax.ws.rs.core.NewCookie cookie
-
client
@Mock protected ConfigurationClient client
-
i18NService
@Mock protected I18NService i18NService
-
objectMapperMock
@Mock protected com.fasterxml.jackson.databind.ObjectMapper objectMapperMock
-
rawResponse
@Mock protected com.hybris.charon.RawResponse<CPSConfiguration> rawResponse
-
eTagRawResponse
@Mock protected com.hybris.charon.RawResponse<CPSConfiguration> eTagRawResponse
-
eTagRawResponseSuccessor
@Mock protected com.hybris.charon.RawResponse<CPSConfiguration> eTagRawResponseSuccessor
-
contextSupplier
@Mock protected CPSContextSupplier contextSupplier
-
cpsCache
@Mock protected CPSCache cpsCache
-
configurationParentReferenceStrategy
@Mock protected CPSConfigurationParentReferenceStrategy configurationParentReferenceStrategy
-
runtimeExceptionWrappingTimeout
@Mock protected java.lang.RuntimeException runtimeExceptionWrappingTimeout
-
timeoutException
@Mock protected java.util.concurrent.TimeoutException timeoutException
-
runtimeExceptionWrappingNPE
@Mock protected java.lang.RuntimeException runtimeExceptionWrappingNPE
-
configurationGetResponse
@Mock protected com.hybris.charon.RawResponse<CPSConfiguration> configurationGetResponse
-
-
Method Detail
-
setup
public void setup() throws ConfigurationEngineException, CredentialException
-
testPassportService
public void testPassportService()
-
testApiRegistryClientService
public void testApiRegistryClientService()
-
testAssembleCreateDefaultConfigurationRequest
public void testAssembleCreateDefaultConfigurationRequest()
-
testCreateDefaultErrorHandlerCalled
public void testCreateDefaultErrorHandlerCalled()
-
testCreateDefault
public void testCreateDefault()
-
testGetExternalErrorHandlerCalled
public void testGetExternalErrorHandlerCalled() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testDeleteErrorHandlerCalled
public void testDeleteErrorHandlerCalled()
-
testCreateConfigurationFromExternalErrorHandlerCalled
public void testCreateConfigurationFromExternalErrorHandlerCalled() throws com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException, java.io.IOException- Throws:
com.fasterxml.jackson.core.JsonParseExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionjava.io.IOException
-
testGetExternalConfiguration
public void testGetExternalConfiguration() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
checkExternalConfiguration
protected void checkExternalConfiguration(java.lang.String result)
-
testGetExternalConfigurationNoCookies
public void testGetExternalConfigurationNoCookies() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetExternalConfigurationTimeOut
public void testGetExternalConfigurationTimeOut() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetExternalConfiguration_invalidResponse
public void testGetExternalConfiguration_invalidResponse() throws com.fasterxml.jackson.core.JsonProcessingException, ConfigurationEngineException- Throws:
com.fasterxml.jackson.core.JsonProcessingExceptionConfigurationEngineException
-
testCreateConfigurationFromExternal
public void testCreateConfigurationFromExternal() throws com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException, java.io.IOException- Throws:
com.fasterxml.jackson.core.JsonParseExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionjava.io.IOException
-
testReleaseSession
public void testReleaseSession()
-
testReleaseSessionNoETag
public void testReleaseSessionNoETag()
-
testReleaseSessionNoCookies
public void testReleaseSessionNoCookies()
-
testReleaseSessionClientException
public void testReleaseSessionClientException()
-
testExtConfigurationStrategy
public void testExtConfigurationStrategy()
-
testCreateConfigurationFromExternalTyped
public void testCreateConfigurationFromExternalTyped() throws com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException, java.io.IOException- Throws:
com.fasterxml.jackson.core.JsonParseExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionjava.io.IOException
-
testGetAutoCleanUP
public void testGetAutoCleanUP()
-
testUpdateConfigurationSingleCstic
public void testUpdateConfigurationSingleCstic() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationSavesCookie
public void testUpdateConfigurationSavesCookie() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationNoETag
public void testUpdateConfigurationNoETag() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationExceptionStillConfigCacheCleared
public void testUpdateConfigurationExceptionStillConfigCacheCleared() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationSingleCsticWrongNumberOFCookies
public void testUpdateConfigurationSingleCsticWrongNumberOFCookies() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testCreateCharacteristicInput
public void testCreateCharacteristicInput()
-
testUpdateConfiguration
public void testUpdateConfiguration() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationWithoutCookies
public void testUpdateConfigurationWithoutCookies() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationTimeOutExceptionHappens
public void testUpdateConfigurationTimeOutExceptionHappens() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationRuntimeExceptionHappens
public void testUpdateConfigurationRuntimeExceptionHappens() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationMultipleChanges
public void testUpdateConfigurationMultipleChanges() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateConfigurationNoUpdatePerformed
public void testUpdateConfigurationNoUpdatePerformed() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateCPSCharacteristicForSinglelevel
public void testUpdateCPSCharacteristicForSinglelevel() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateCPSCharacteristicForMultilevel
public void testUpdateCPSCharacteristicForMultilevel() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testUpdateErrorHandlerCalled
public void testUpdateErrorHandlerCalled() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testEncodeNull
public void testEncodeNull()
-
testEncode
public void testEncode()
-
testGetConfiguration
public void testGetConfiguration() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetConfigurationCached
public void testGetConfigurationCached() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetConfigurationWithoutCookies
public void testGetConfigurationWithoutCookies() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetConfigurationWithoutCookiesCPSReturnsNewCookies
public void testGetConfigurationWithoutCookiesCPSReturnsNewCookies() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetConfigurationTimeOutExceptionHappens
public void testGetConfigurationTimeOutExceptionHappens() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetErrorHandlerCalled
public void testGetErrorHandlerCalled() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testGetConfigurationKbBuildCheck
public void testGetConfigurationKbBuildCheck() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testRetrieveConfigurationAndSaveResponseAttributesKbBuildCheck
public void testRetrieveConfigurationAndSaveResponseAttributesKbBuildCheck() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
mockClientCallWithCstic
protected void mockClientCallWithCstic(java.lang.String cfgId, java.lang.String currentVersion, java.lang.String itemId, java.lang.String csticIdentifier)
-
mockClientCallWithCsticSuccessor
protected void mockClientCallWithCsticSuccessor(java.lang.String cfgId, java.lang.String currentVersion, java.lang.String itemId, java.lang.String csticIdentifier)
-
mockClientCallWithCsticWoCookies
protected void mockClientCallWithCsticWoCookies(java.lang.String cfgId, java.lang.String itemId, java.lang.String csticIdentifier)
-
verifyClientCallWithCstic
protected void verifyClientCallWithCstic(java.lang.String cfgId, java.lang.String updatedVersion, java.lang.String itemId, java.lang.String csticIdentifier, boolean isExpected)
-
verifyClientCallWithCsticWoCookies
protected void verifyClientCallWithCsticWoCookies(java.lang.String cfgId, java.lang.String itemId, java.lang.String csticIdentifier, boolean isExpected)
-
addRuntimeCsticGroup
protected void addRuntimeCsticGroup(CPSItem item, CPSCharacteristicGroup characteristicGroup)
-
isRuntimeCsticGroupPresent
protected boolean isRuntimeCsticGroupPresent(CPSItem item, java.lang.String id)
-
isRuntimeCsticPresent
protected boolean isRuntimeCsticPresent(CPSItem item, java.lang.String id)
-
addRuntimeCstic
protected void addRuntimeCstic(CPSItem item, CPSCharacteristic characteristic)
-
ensureCookieHandlerHasNoCookies
protected void ensureCookieHandlerHasNoCookies()
-
createCPSItem
protected CPSItem createCPSItem(java.lang.String itemId)
-
createCPSCharacteristic
protected CPSCharacteristic createCPSCharacteristic()
-
createListOfPossibleValues
protected java.util.List<CPSPossibleValue> createListOfPossibleValues()
-
createListOfCPSValues
protected java.util.List<CPSValue> createListOfCPSValues(CPSCharacteristic characteristic)
-
createCPSValue
protected CPSValue createCPSValue(CPSCharacteristic characteristic, java.lang.String valueName)
-
testCache
public void testCache()
-
testGetClient
public void testGetClient()
-
testGetClientNotFound
public void testGetClientNotFound() throws CredentialException- Throws:
CredentialException
-
testGetObjectMapper
public void testGetObjectMapper()
-
testUpdateConfigurationRootItemNull
public void testUpdateConfigurationRootItemNull() throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
testConvertFromStringToStructured
public void testConvertFromStringToStructured()
-
-