Testing your customizations

In this lesson, you perform two test cases to verify the customizations performed in this module.

About this task

You can test the result of your customized code by:

  • Verifying that search results are displayed correctly in the Management Center user interface
  • Verifying that the search results are consistent with the contents of the database.
  • Verifying the results by viewing the trace

The results are verified using two test cases:

  • Search using a number as input
  • Search using a string as input.

Procedure

  1. For the first test case, search using numeric input:
    1. Verify the customized result with the Management Center user interface:
      1. Ensure that the WebSphere Commerce Server is running.
      2. In the Web browser, type https://hostname:8000/lobtools .
      3. Log on to the Management Center using the category manager user ID you previously registered.
      4. From the Management Center menu, select Catalogs to open the Catalogs tool.
      5. From the Store list, select Select Store > ConsumerDirect store.
      6. From the Find area underneath the store dropdown list, select All Catalog Entries By Warranty, as shown in the following screen capture:
        Screen capture displaying the completed customization in the search widget.
      7. Input a number in search text area, for example, "30". Click the Search button.
      8. The search results contains one entry with the code FULO-01 and a 30 day warranty.
        Screen capture displaying the completed customization on the search results panel.
    2. Verify if the search result is correct in the database. Check the warranty information stored in the database now, to verify if the search is finding the correct result. Run the following SQL:
      select A.catentry_ID, A.warterm, A.wartype, B.careinstruction,
      C.partnumber from xwarranty A, xcareinstruction B, catentry C where
      A.catentry_ID=B.catentry_ID and A.catentry_ID=c.catentry_ID;

      Screen capture showing database results.

      FULO-01 is the only item with 30 in the warranty term, warranty type or care instructions. You should see this item displayed in the search.

    3. Examine the trace:

      Two traces are used in this tutorial. The BOD request message, generated SQL statement and BOD response message are located in the WCDE_installdir \wasprofile\logs\server1\trace.log file. The following samples show parts of the trace.log file:

      • Request BOD Message:
      <_cat:GetCatalogEntry
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:Oagis9="http://www.openapplications.org/oagis/9"
      	xmlns:_cat="http://www.ibm.com/xmlns/prod/commerce/9/catalog"
      	xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation"
      	versionID="6.0.0.4">
      	<Oagis9:ApplicationArea xsi:type="_wcf:ApplicationAreaType">
      		<Oagis9:CreationDateTime>
      			2008-04-21T11:22:12.922Z
      		</Oagis9:CreationDateTime>
      		<Oagis9:BODID>
      			221ec640-0f52-11dd-bc43-84624806c574
      		</Oagis9:BODID>
      		<_wcf:BusinessContext>
      			<_wcf:ContextData name="storeId">10101</_wcf:ContextData>
      			<_wcf:ContextData name="catalogId">10101</_wcf:ContextData>
      		</_wcf:BusinessContext>
      	</Oagis9:ApplicationArea>
      	<_cat:DataArea>
      		<Oagis9:Get maxItems="25">
      			<Oagis9:Expression expressionLanguage="_wcf:XPath">
      				{_wcf.ap=MyCompany_All}/CatalogEntry[(@catalogEntryTypeCode='ProductBean'
      				or @catalogEntryTypeCode='BundleBean' or
      				@catalogEntryTypeCode='PackageBean' or
      				@catalogEntryTypeCode='DynamicKitBean') and search(
      				UserData/UserDataField/Warterm='30' or
      				contains(UserData/UserDataField/Wartype,'30') or
      				contains(Description/Attributes/careinstruction,'30'))]
      			</Oagis9:Expression>
      		</Oagis9:Get>
      	</_cat:DataArea>
      </_cat:GetCatalogEntry>
      • Generated SQL statement:
      SELECT DISTINCT CATENTRY.CATENTRY_ID 
      FROM CATENTRY JOIN STORECENT ON (CATENTRY.CATENTRY_ID = STORECENT.CATENTRY_ID AND STORECENT.STOREENT_ID IN ( ? )) , XCAREINSTRUCTION IBM_1 
      WHERE CATENTRY.CATENTTYPE_ID IN (?, ?, ?, ?) AND CATENTRY.MARKFORDELETE = 0 AND ( (CATENTRY.CATENTRY_ID=IBM_1.CATENTRY_ID AND (IBM_1.CAREINSTRUCTION LIKE ?)) ) UNION SELECT DISTINCT CATENTRY.CATENTRY_ID FROM CATENTRY JOIN STORECENT ON (CATENTRY.CATENTRY_ID = STORECENT.CATENTRY_ID AND STORECENT.STOREENT_ID IN ( ? )) , XWARRANTY IBM_1 WHERE CATENTRY.CATENTTYPE_ID IN (?, ?, ?, ?) AND CATENTRY.MARKFORDELETE = 0 AND ( (CATENTRY.CATENTRY_ID=IBM_1.CATENTRY_ID AND (IBM_1.WARTERM=? OR IBM_1.WARTYPE LIKE ?)) )  
      Note:
      • The generated SQL Statement appears in the trace.log file if
        com.ibm.commerce.foundation.server.services.dataaccess.queryservice.gen
        is enabled. You can find the generated SQL statements by searching on
        com.ibm.commerce.foundation.internal.server.services.dataaccess.queryservice.gen.QueryDataComposer buildQuery
        .
      • A number of search query generation options can be selected by configuration. Different generation modes allow you to fine-tune the performance of the generated queries. For more information, see Parametric Search Support.
      • Response BOD Message:
      <_cat:ShowCatalogEntry
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:Oagis9="http://www.openapplications.org/oagis/9"
      	xmlns:_cat="http://www.ibm.com/xmlns/prod/commerce/9/catalog"
      	xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation">
      	<Oagis9:ApplicationArea xsi:type="_wcf:ApplicationAreaType">
      		<Oagis9:CreationDateTime>
      			2008-04-21T10:45:31.672Z
      		</Oagis9:CreationDateTime>
      		<Oagis9:BODID>
      			0212ae20-0f4d-11dd-bc43-84624806c574
      		</Oagis9:BODID>
      	</Oagis9:ApplicationArea>
      	<_cat:DataArea>
      		<Oagis9:Show recordSetCompleteIndicator="true"
      			recordSetCount="1"
      			recordSetReferenceId="017c88a0-0f4d-11dd-bc43-84624806c574:1"
      			recordSetStartNumber="0" recordSetTotal="1">
      			<Oagis9:OriginalApplicationArea>
      				<Oagis9:CreationDateTime>
      					2008-04-21T10:45:26.688Z
      				</Oagis9:CreationDateTime>
      				<Oagis9:BODID>
      					ff1a2ea0-0f4c-11dd-bc43-84624806c574
      				</Oagis9:BODID>
      			</Oagis9:OriginalApplicationArea>
      		</Oagis9:Show>
      		<_cat:CatalogEntry catalogEntryTypeCode="ProductBean"
      			sequence="0.0">
      			<_cat:CatalogEntryIdentifier>
      				<_wcf:UniqueID>10251</_wcf:UniqueID>
      				<_wcf:ExternalIdentifier
      					ownerID="7000000000000000101">
      					<_wcf:PartNumber>FULO-01</_wcf:PartNumber>
      				</_wcf:ExternalIdentifier>
      			</_cat:CatalogEntryIdentifier>
      			<_cat:Description language="-1">
      				<_cat:Name>White Fabric Roll Arm Chaise</_cat:Name>
      				<_cat:Thumbnail>
      					images/catalog/FULO_01_sm.jpg
      				</_cat:Thumbnail>
      				<_cat:FullImage>
      					images/catalog/FULO_01.jpg
      				</_cat:FullImage>
      				<_cat:ShortDescription>
      					Plumply padded for your ultimate comfort.
      				</_cat:ShortDescription>
      				<_cat:LongDescription>
      					Plumply padded for your ultimate comfort. Removable
      					and reversible back cushion lets you adjust your
      					comfort. Measures 39&quot; in width, 34&quot; in
      					depth, and 34&quot; in height. Some assembly
      					required.
      				</_cat:LongDescription>
      				<_cat:Attributes name="published">1</_cat:Attributes>
      				<_cat:Attributes name="available">1</_cat:Attributes>
      				<_cat:Attributes name="auxDescription2">
      					images/catalog/FULO_01_sm45.jpg
      				</_cat:Attributes>
      				<_cat:Attributes name="catentry_id">
      					10251
      				</_cat:Attributes>
      				<_cat:Attributes name="language_id">-1</_cat:Attributes>
      				<_cat:Attributes name="careinstruction">
      					Very limited use an abrasive cleaner or material on
      					any finished product
      				</_cat:Attributes>
      				<_cat:Attributes name="optcounter">3</_cat:Attributes>
      			</_cat:Description>
      			<_cat:CatalogEntryAttributes>
      				<_cat:Attributes displaySequence="0.0">
      					<_cat:Name>buyable</_cat:Name>
      					<_cat:AttributeDataType>
      						String
      					</_cat:AttributeDataType>
      					<_cat:StringValue>
      						<_cat:Value>1</_cat:Value>
      					</_cat:StringValue>
      				</_cat:Attributes>
      				<_cat:Attributes displaySequence="0.0">
      					<_cat:Name>state</_cat:Name>
      					<_cat:AttributeDataType>
      						String
      					</_cat:AttributeDataType>
      					<_cat:StringValue>
      						<_cat:Value>1</_cat:Value>
      					</_cat:StringValue>
      				</_cat:Attributes>
      			</_cat:CatalogEntryAttributes>
      			<_cat:ListPrice>
      				<_wcf:Price currency="USD">449.99000</_wcf:Price>
      				<_wcf:AlternativeCurrencyPrice currency="USD">
      					449.99000
      				</_wcf:AlternativeCurrencyPrice>
      			</_cat:ListPrice>
      			<_cat:ParentCatalogGroupIdentifier>
      				<_wcf:UniqueID>10104</_wcf:UniqueID>
      				<_wcf:ExternalIdentifier
      					ownerID="7000000000000000101">
      					<_wcf:GroupIdentifier>
      						Lounge Chairs
      					</_wcf:GroupIdentifier>
      				</_wcf:ExternalIdentifier>
      			</_cat:ParentCatalogGroupIdentifier>
      			<_cat:NavigationRelationship displaySequence="0.0"
      				type="child-parent">
      				<_cat:CatalogGroupReference>
      					<_cat:CatalogGroupIdentifier>
      						<_wcf:UniqueID>10104</_wcf:UniqueID>
      						<_wcf:ExternalIdentifier
      							ownerID="7000000000000000101">
      							<_wcf:GroupIdentifier>
      								Lounge Chairs
      							</_wcf:GroupIdentifier>
      						</_wcf:ExternalIdentifier>
      					</_cat:CatalogGroupIdentifier>
      					<_cat:CatalogIdentifier>
      						<_wcf:UniqueID>10101</_wcf:UniqueID>
      					</_cat:CatalogIdentifier>
      				</_cat:CatalogGroupReference>
      			</_cat:NavigationRelationship>
      			<_cat:NavigationRelationship displaySequence="0.0"
      				type="child-parent">
      				<_cat:CatalogGroupReference>
      					<_cat:CatalogGroupIdentifier>
      						<_wcf:UniqueID>10104</_wcf:UniqueID>
      						<_wcf:ExternalIdentifier
      							ownerID="7000000000000000101">
      							<_wcf:GroupIdentifier>
      								Lounge Chairs
      							</_wcf:GroupIdentifier>
      						</_wcf:ExternalIdentifier>
      					</_cat:CatalogGroupIdentifier>
      					<_cat:CatalogIdentifier>
      						<_wcf:UniqueID>10101</_wcf:UniqueID>
      					</_cat:CatalogIdentifier>
      				</_cat:CatalogGroupReference>
      			</_cat:NavigationRelationship>
      			<_cat:FulfillmentProperties>
      				<_wcf:UserData />
      			</_cat:FulfillmentProperties>
      			<_wcf:UserData>
      				<_wcf:UserDataField name="catentry_id">
      					10251
      				</_wcf:UserDataField>
      				<_wcf:UserDataField name="warterm">
      					30
      				</_wcf:UserDataField>
      				<_wcf:UserDataField name="wartype">
      					COMPREHENSIVE
      				</_wcf:UserDataField>
      				<_wcf:UserDataField name="optcounter">
      					3
      				</_wcf:UserDataField>
      			</_wcf:UserData>
      		</_cat:CatalogEntry>
      	</_cat:DataArea>
      </_cat:ShowCatalogEntry>
  2. For this second test case, you search using a string as input:
    1. Input a string in the search text area, for example, "LIMITED". Click the search button. The search result is returned back in the Search Results list view, as shown in the following screen capture:

      Screen capture displaying the completed customization on the search results panel.

      As shown, there is one search result: FULO-03.

    2. Verify that the results are consistent with the data in the database. Check the warranty information stored in the database, to verify if the search is finding the correct results. Run the following SQL:
       select A.catentry_ID, A.warterm, A.wartype, B.careinstruction, C.partnumber from xwarranty A, xcareinstruction B, catentry C where A.catentry_ID=B.catentry_ID and A.catentry_ID=c.catentry_ID;

      Screen capture showing database results.
    3. Examine the trace:
      • Request BOD Message:
      <_cat:GetCatalogEntry
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:Oagis9="http://www.openapplications.org/oagis/9"
      	xmlns:_cat="http://www.ibm.com/xmlns/prod/commerce/9/catalog"
      	xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation"
      	versionID="6.0.0.4">
      	<Oagis9:ApplicationArea xsi:type="_wcf:ApplicationAreaType">
      		<Oagis9:CreationDateTime>
      			2008-04-21T11:08:59.016Z
      		</Oagis9:CreationDateTime>
      		<Oagis9:BODID>
      			48ea5520-0f50-11dd-bc43-84624806c574
      		</Oagis9:BODID>
      		<_wcf:BusinessContext>
      			<_wcf:ContextData name="storeId">10101</_wcf:ContextData>
      			<_wcf:ContextData name="catalogId">10101</_wcf:ContextData>
      		</_wcf:BusinessContext>
      	</Oagis9:ApplicationArea>
      	<_cat:DataArea>
      		<Oagis9:Get maxItems="25">
      			<Oagis9:Expression expressionLanguage="_wcf:XPath">
      				{
      				_wcf.ap=MyCompany_All}/CatalogEntry[(@catalogEntryTypeCode='ProductBean'
      				or @catalogEntryTypeCode='BundleBean' or
      				@catalogEntryTypeCode='PackageBean' or
      				@catalogEntryTypeCode='DynamicKitBean') and search(
      				contains(UserData/UserDataField/Wartype,'LIMITED') or
      				contains(Description/Attributes/careinstruction,'LIMITED'))]
      			</Oagis9:Expression>
      		</Oagis9:Get>
      	</_cat:DataArea>
      </_cat:GetCatalogEntry>
      • Generated SQL statement:
      SELECT DISTINCT CATENTRY.CATENTRY_ID 
      FROM CATENTRY JOIN STORECENT ON (CATENTRY.CATENTRY_ID = STORECENT.CATENTRY_ID AND STORECENT.STOREENT_ID IN ( ? )) , XCAREINSTRUCTION IBM_1 
      WHERE CATENTRY.CATENTTYPE_ID IN (?, ?, ?, ?) AND CATENTRY.MARKFORDELETE = 0 AND ( (CATENTRY.CATENTRY_ID=IBM_1.CATENTRY_ID AND (IBM_1.CAREINSTRUCTION LIKE ?)) ) UNION SELECT DISTINCT CATENTRY.CATENTRY_ID FROM CATENTRY JOIN STORECENT ON (CATENTRY.CATENTRY_ID = STORECENT.CATENTRY_ID AND STORECENT.STOREENT_ID IN ( ? )) , XWARRANTY IBM_1 WHERE CATENTRY.CATENTTYPE_ID IN (?, ?, ?, ?) AND CATENTRY.MARKFORDELETE = 0 AND ( (CATENTRY.CATENTRY_ID=IBM_1.CATENTRY_ID AND (IBM_1.WARTYPE LIKE ?)) )  
      • Response BOD Message:
      <_cat:ShowCatalogEntry
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:Oagis9="http://www.openapplications.org/oagis/9"
      	xmlns:_cat="http://www.ibm.com/xmlns/prod/commerce/9/catalog"
      	xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation">
      	<Oagis9:ApplicationArea xsi:type="_wcf:ApplicationAreaType">
      		<Oagis9:CreationDateTime>
      			2008-04-21T11:08:59.609Z
      		</Oagis9:CreationDateTime>
      		<Oagis9:BODID>
      			4944d130-0f50-11dd-bc43-84624806c574
      		</Oagis9:BODID>
      	</Oagis9:ApplicationArea>
      	<_cat:DataArea>
      		<Oagis9:Show recordSetCompleteIndicator="true"
      			recordSetCount="1"
      			recordSetReferenceId="49428740-0f50-11dd-bc43-84624806c574:1"
      			recordSetStartNumber="0" recordSetTotal="1">
      			<Oagis9:OriginalApplicationArea>
      				<Oagis9:CreationDateTime>
      					2008-04-21T11:08:59.016Z
      				</Oagis9:CreationDateTime>
      				<Oagis9:BODID>
      					48ea5520-0f50-11dd-bc43-84624806c574
      				</Oagis9:BODID>
      			</Oagis9:OriginalApplicationArea>
      		</Oagis9:Show>
      		<_cat:CatalogEntry catalogEntryTypeCode="ProductBean"
      			sequence="4.0">
      			<_cat:CatalogEntryIdentifier>
      				<_wcf:UniqueID>10255</_wcf:UniqueID>
      				<_wcf:ExternalIdentifier
      					ownerID="7000000000000000101">
      					<_wcf:PartNumber>FULO-03</_wcf:PartNumber>
      				</_wcf:ExternalIdentifier>
      			</_cat:CatalogEntryIdentifier>
      			<_cat:Description language="-1">
      				<_cat:Name>White Wing Chair</_cat:Name>
      				<_cat:Thumbnail>
      					images/catalog/FULO_03_sm.jpg
      				</_cat:Thumbnail>
      				<_cat:FullImage>
      					images/catalog/FULO_03.jpg
      				</_cat:FullImage>
      				<_cat:ShortDescription>
      					Wing chair to complement any decor.
      				</_cat:ShortDescription>
      				<_cat:LongDescription>
      					Wing chair to complement any decor. White fabric
      					wing armchair with mahogany-wood legs. Measures
      					39&quot; in width, 33&quot; in depth, and 42&quot;
      					in height. Some assembly required.
      				</_cat:LongDescription>
      				<_cat:Attributes name="published">1</_cat:Attributes>
      				<_cat:Attributes name="available">1</_cat:Attributes>
      				<_cat:Attributes name="auxDescription2">
      					images/catalog/FULO_03_sm45.jpg
      				</_cat:Attributes>
      				<_cat:Attributes name="catentry_id">
      					10255
      				</_cat:Attributes>
      				<_cat:Attributes name="language_id">-1</_cat:Attributes>
      				<_cat:Attributes name="careinstruction">
      					Never use hoousehold cleaners
      				</_cat:Attributes>
      			</_cat:Description>
      			<_cat:CatalogEntryAttributes>
      				<_cat:Attributes displaySequence="0.0">
      					<_cat:Name>buyable</_cat:Name>
      					<_cat:AttributeDataType>
      						String
      					</_cat:AttributeDataType>
      					<_cat:StringValue>
      						<_cat:Value>1</_cat:Value>
      					</_cat:StringValue>
      				</_cat:Attributes>
      				<_cat:Attributes displaySequence="0.0">
      					<_cat:Name>state</_cat:Name>
      					<_cat:AttributeDataType>
      						String
      					</_cat:AttributeDataType>
      					<_cat:StringValue>
      						<_cat:Value>1</_cat:Value>
      					</_cat:StringValue>
      				</_cat:Attributes>
      			</_cat:CatalogEntryAttributes>
      			<_cat:ListPrice>
      				<_wcf:Price currency="USD">499.99000</_wcf:Price>
      				<_wcf:AlternativeCurrencyPrice currency="USD">
      					499.99000
      				</_wcf:AlternativeCurrencyPrice>
      			</_cat:ListPrice>
      			<_cat:ParentCatalogGroupIdentifier>
      				<_wcf:UniqueID>10104</_wcf:UniqueID>
      				<_wcf:ExternalIdentifier
      					ownerID="7000000000000000101">
      					<_wcf:GroupIdentifier>
      						Lounge Chairs
      					</_wcf:GroupIdentifier>
      				</_wcf:ExternalIdentifier>
      			</_cat:ParentCatalogGroupIdentifier>
      			<_cat:NavigationRelationship displaySequence="4.0"
      				type="child-parent">
      				<_cat:CatalogGroupReference>
      					<_cat:CatalogGroupIdentifier>
      						<_wcf:UniqueID>10104</_wcf:UniqueID>
      						<_wcf:ExternalIdentifier
      							ownerID="7000000000000000101">
      							<_wcf:GroupIdentifier>
      								Lounge Chairs
      							</_wcf:GroupIdentifier>
      						</_wcf:ExternalIdentifier>
      					</_cat:CatalogGroupIdentifier>
      					<_cat:CatalogIdentifier>
      						<_wcf:UniqueID>10101</_wcf:UniqueID>
      					</_cat:CatalogIdentifier>
      				</_cat:CatalogGroupReference>
      			</_cat:NavigationRelationship>
      			<_cat:NavigationRelationship displaySequence="4.0"
      				type="child-parent">
      				<_cat:CatalogGroupReference>
      					<_cat:CatalogGroupIdentifier>
      						<_wcf:UniqueID>10104</_wcf:UniqueID>
      						<_wcf:ExternalIdentifier
      							ownerID="7000000000000000101">
      							<_wcf:GroupIdentifier>
      								Lounge Chairs
      							</_wcf:GroupIdentifier>
      						</_wcf:ExternalIdentifier>
      					</_cat:CatalogGroupIdentifier>
      					<_cat:CatalogIdentifier>
      						<_wcf:UniqueID>10101</_wcf:UniqueID>
      					</_cat:CatalogIdentifier>
      				</_cat:CatalogGroupReference>
      			</_cat:NavigationRelationship>
      			<_cat:FulfillmentProperties>
      				<_wcf:UserData />
      			</_cat:FulfillmentProperties>
      			<_wcf:UserData>
      				<_wcf:UserDataField name="catentry_id">
      					10255
      				</_wcf:UserDataField>
      				<_wcf:UserDataField name="warterm">
      					60
      				</_wcf:UserDataField>
      				<_wcf:UserDataField name="wartype">
      					LIMITED
      				</_wcf:UserDataField>
      			</_wcf:UserData>
      		</_cat:CatalogEntry>
      	</_cat:DataArea>
      </_cat:ShowCatalogEntry>

Results