Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042165Openbravo ERPY. DBSourceManagerpublic2019-10-31 10:052022-02-01 08:07
AugustoMauch 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0042165: DBSM.assertExportIsConsistent works only with databases with only one first-level object
The DbsmTest.assertExportIsConsistent method only works properly only when the model contains only one first-level component (i.e. one function, one table (which may contain several columns, indexes, etc)).

It is not suitable for other simple models (i.e. one that has a materialized view, because it contains two first-level models, the materialized view and the table it gets data from).

When checking if each component has been exported consistently, it should extract from the XML model only the part relevant to the component being asserted.

For instance, in a model that contains both a table and a materialized view, to check if the table has been consistently exported the following comparison is done:

<?xml version="1.0" encoding="UTF-8"?>
<database name="TABLE TEST">
   <table name="TEST" primaryKey="TEST_ID">
      <column name="TEST_ID" primaryKey="true" required="true" type="VARCHAR" size="32" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
      <column name="COL1" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
      <column name="COL2" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
   </table>
</database>

<?xml version="1.0" encoding="UTF-8"?>
<database name="TABLE TEST">
   <table name="TEST" primaryKey="TEST_ID">
      <column name="TEST_ID" primaryKey="true" required="true" type="VARCHAR" size="32" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
      <column name="COL1" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
      <column name="COL2" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
   </table>
   <materializedView name="TEST_MATERIALIZEDVIEW">
      <![CDATA[SELECT t.col1 AS matviewcol FROM test t]]>
      <column name="MATVIEWCOL" primaryKey="false" required="false" type="OTHER" autoIncrement="false">
         <default />
         <onCreateDefault />
      </column>
   </materializedView>
</database>

The assertion fails, because the whole model is being compared with the exported object, instead of picking only the table element.
- In the MaterializedViews class, try to use assertExportIsConsistent instead of assertExportedMaterializedView.
- All tests will fail
Extract from the model only the part relevant with the database object being asserted
No tags attached.
Issue History
2019-10-31 10:05AugustoMauchNew Issue
2019-10-31 10:05AugustoMauchAssigned To => platform
2019-10-31 10:05AugustoMauchModules => Core
2019-10-31 10:05AugustoMauchTriggers an Emergency Pack => No
2019-10-31 10:14alostaleTypedefect => design defect
2022-02-01 08:07alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.