Testing db-migrator with updated persistence.xml

Run API CSIT test without updating persistence.xml



Waiting for mariadb port 3306...
mariadb (172.19.0.2:3306) open
.....Waiting for policy-db-migrator port 6824...
policy-db-migrator (172.19.0.3:6824) open
.......Policy api config file: /opt/app/policy/api/etc/defaultConfig.json
[EL Info]: 2021-08-11 07:41:50.619--ServerSession(878861517)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Warning]: 2021-08-11 07:41:51.532--ServerSession(878861517)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=333) Can't create table `policyadmin`.`toscanodetemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaNodeTemplate ADD CONSTRAINT FK_ToscaNodeTemplate_capabilitiesName FOREIGN KEY (capabilitiesName, capabilitiesVersion) REFERENCES ToscaCapabilityAssignments (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaNodeTemplate ADD CONSTRAINT FK_ToscaNodeTemplate_capabilitiesName FOREIGN KEY (capabilitiesName, capabilitiesVersion) REFERENCES ToscaCapabilityAssignments (name, version)")
[EL Warning]: 2021-08-11 07:41:51.559--ServerSession(878861517)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=333) Can't create table `policyadmin`.`toscanodetype` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaNodeType ADD CONSTRAINT FK_ToscaNodeType_requirementsName FOREIGN KEY (requirementsName, requirementsVersion) REFERENCES ToscaRequirements (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaNodeType ADD CONSTRAINT FK_ToscaNodeType_requirementsName FOREIGN KEY (requirementsName, requirementsVersion) REFERENCES ToscaRequirements (name, version)")
[EL Warning]: 2021-08-11 07:41:51.606--ServerSession(878861517)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=333) Can't create table `policyadmin`.`toscaservicetemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaServiceTemplate ADD CONSTRAINT FK_ToscaServiceTemplate_dataTypesName FOREIGN KEY (dataTypesName, dataTypesVersion) REFERENCES ToscaDataTypes (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaServiceTemplate ADD CONSTRAINT FK_ToscaServiceTemplate_dataTypesName FOREIGN KEY (dataTypesName, dataTypesVersion) REFERENCES ToscaDataTypes (name, version)")
[EL Warning]: 2021-08-11 07:41:51.638--ServerSession(878861517)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=333) Can't create table `policyadmin`.`toscatopologytemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaTopologyTemplate ADD CONSTRAINT FK_ToscaTopologyTemplate_policyName FOREIGN KEY (policyName, policyVersion) REFERENCES ToscaPolicies (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaTopologyTemplate ADD CONSTRAINT FK_ToscaTopologyTemplate_policyName FOREIGN KEY (policyName, policyVersion) REFERENCES ToscaPolicies (name, version)")
[EL Info]: 2021-08-11 07:42:02.006--ServerSession(559000277)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Warning]: 2021-08-11 07:42:02.353--ServerSession(559000277)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=334) Can't create table `policyadmin`.`toscanodetemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaNodeTemplate ADD CONSTRAINT FK_ToscaNodeTemplate_capabilitiesName FOREIGN KEY (capabilitiesName, capabilitiesVersion) REFERENCES ToscaCapabilityAssignments (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaNodeTemplate ADD CONSTRAINT FK_ToscaNodeTemplate_capabilitiesName FOREIGN KEY (capabilitiesName, capabilitiesVersion) REFERENCES ToscaCapabilityAssignments (name, version)")
[EL Warning]: 2021-08-11 07:42:02.373--ServerSession(559000277)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=334) Can't create table `policyadmin`.`toscanodetype` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaNodeType ADD CONSTRAINT FK_ToscaNodeType_requirementsName FOREIGN KEY (requirementsName, requirementsVersion) REFERENCES ToscaRequirements (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaNodeType ADD CONSTRAINT FK_ToscaNodeType_requirementsName FOREIGN KEY (requirementsName, requirementsVersion) REFERENCES ToscaRequirements (name, version)")
[EL Warning]: 2021-08-11 07:42:02.415--ServerSession(559000277)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=334) Can't create table `policyadmin`.`toscaservicetemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaServiceTemplate ADD CONSTRAINT FK_ToscaServiceTemplate_dataTypesName FOREIGN KEY (dataTypesName, dataTypesVersion) REFERENCES ToscaDataTypes (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaServiceTemplate ADD CONSTRAINT FK_ToscaServiceTemplate_dataTypesName FOREIGN KEY (dataTypesName, dataTypesVersion) REFERENCES ToscaDataTypes (name, version)")
[EL Warning]: 2021-08-11 07:42:02.447--ServerSession(559000277)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=334) Can't create table `policyadmin`.`toscatopologytemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaTopologyTemplate ADD CONSTRAINT FK_ToscaTopologyTemplate_policyName FOREIGN KEY (policyName, policyVersion) REFERENCES ToscaPolicies (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaTopologyTemplate ADD CONSTRAINT FK_ToscaTopologyTemplate_policyName FOREIGN KEY (policyName, policyVersion) REFERENCES ToscaPolicies (name, version)")
[EL Info]: 2021-08-11 07:42:06.689--ServerSession(1456799384)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4

A number of errors are thrown because db-migrator has already created these objects



Run API CSIT test with updated persistence.xml

In the api directory go to main/src/main/resources/META-INF/persistence.xml

Update the properties section

persistence.xml
<properties> <property name="javax.persistence.schema-generation.database.action" value="create" /> <!--property name="eclipselink.ddl-generation" value="create-or-extend-tables" /--> <property name="eclipselink.ddl-generation" value="none" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.logging.level" value="INFO" /> </properties>



mvn clean install to build the project

Use docker images to see image stored in the local cache.

Use docker rmi <image id> to remove api images

cd to packages/policy-api-docker/ and run mvn clean install again to build the docker image

cd to the docker/csit directory and edit docker-compose-all.yml

docker-compose-all.yml
api: #image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION} image: onap/policy-api:${POLICY_API_VERSION}

Re-run CSIT test for API

Waiting for mariadb port 3306...
mariadb (172.21.0.2:3306) open
.....Waiting for policy-db-migrator port 6824...
policy-db-migrator (172.21.0.3:6824) open
........Policy api config file: /opt/app/policy/api/etc/defaultConfig.json
[EL Info]: 2021-08-11 08:54:22.739--ServerSession(1961129028)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Info]: 2021-08-11 08:54:33.045--ServerSession(1054452800)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Info]: 2021-08-11 08:54:38.963--ServerSession(865436777)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Info]: 2021-08-11 08:54:39.563--ServerSession(1114449639)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Info]: 2021-08-11 08:54:40.433--ServerSession(2113871782)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4

SQL errors no longer present

------------------------------------------------------------------------------
api | PASS |
16 tests, 16 passed, 0 failed
==============================================================================



Updated persistence.xml

persistence.xml
<!--properties> <property name="javax.persistence.schema-generation.database.action" value="create" /> <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.logging.level" value="INFO" /> </properties--> <properties> <property name="javax.persistence.schema-generation.database.action" value="none" /> <property name="eclipselink.ddl-generation" value="none" /> <property name="eclipselink.logging.level" value="INFO" /> </properties>

Re-created image, re-ran CSIT api test



Waiting for mariadb port 3306...
mariadb (192.168.96.2:3306) open
.....Waiting for policy-db-migrator port 6824...
policy-db-migrator (192.168.96.3:6824) open
.......Policy api config file: /opt/app/policy/api/etc/defaultConfig.json
[EL Info]: 2021-08-11 14:52:32.594--ServerSession(429058804)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Info]: 2021-08-11 14:52:43.681--ServerSession(1763404393)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Info]: 2021-08-11 14:52:49.378--ServerSession(2132329236)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4



------------------------------------------------------------------------------
api | PASS |
16 tests, 16 passed, 0 failed
==============================================================================

Run PAP CSIT test without updating persistence.xml

mariadb (172.22.0.3:3306) open
.......Waiting for policy-db-migrator port 6824...
policy-db-migrator (172.22.0.4:6824) open
...........Waiting for message-router port 3905...
message-router (172.22.0.2:3905) open
Waiting for api port 6969...
api (172.22.0.5:6969) open
............Policy pap config file: /opt/app/policy/pap/etc/defaultConfig.json
[EL Info]: 2021-08-11 09:11:51.066--ServerSession(73698537)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Warning]: 2021-08-11 09:11:51.9--ServerSession(73698537)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=335) Can't create table `policyadmin`.`toscanodetemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaNodeTemplate ADD CONSTRAINT FK_ToscaNodeTemplate_capabilitiesName FOREIGN KEY (capabilitiesName, capabilitiesVersion) REFERENCES ToscaCapabilityAssignments (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaNodeTemplate ADD CONSTRAINT FK_ToscaNodeTemplate_capabilitiesName FOREIGN KEY (capabilitiesName, capabilitiesVersion) REFERENCES ToscaCapabilityAssignments (name, version)")
[EL Warning]: 2021-08-11 09:11:51.932--ServerSession(73698537)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=335) Can't create table `policyadmin`.`toscanodetype` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaNodeType ADD CONSTRAINT FK_ToscaNodeType_requirementsName FOREIGN KEY (requirementsName, requirementsVersion) REFERENCES ToscaRequirements (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaNodeType ADD CONSTRAINT FK_ToscaNodeType_requirementsName FOREIGN KEY (requirementsName, requirementsVersion) REFERENCES ToscaRequirements (name, version)")
[EL Warning]: 2021-08-11 09:11:51.995--ServerSession(73698537)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=335) Can't create table `policyadmin`.`toscaservicetemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaServiceTemplate ADD CONSTRAINT FK_ToscaServiceTemplate_dataTypesName FOREIGN KEY (dataTypesName, dataTypesVersion) REFERENCES ToscaDataTypes (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaServiceTemplate ADD CONSTRAINT FK_ToscaServiceTemplate_dataTypesName FOREIGN KEY (dataTypesName, dataTypesVersion) REFERENCES ToscaDataTypes (name, version)")
[EL Warning]: 2021-08-11 09:11:52.042--ServerSession(73698537)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLTransientConnectionException: (conn=335) Can't create table `policyadmin`.`toscatopologytemplate` (errno: 121 "Duplicate key on write or update")
Error Code: 1005
Call: ALTER TABLE ToscaTopologyTemplate ADD CONSTRAINT FK_ToscaTopologyTemplate_policyName FOREIGN KEY (policyName, policyVersion) REFERENCES ToscaPolicies (name, version)
Query: DataModifyQuery(sql="ALTER TABLE ToscaTopologyTemplate ADD CONSTRAINT FK_ToscaTopologyTemplate_policyName FOREIGN KEY (policyName, policyVersion) REFERENCES ToscaPolicies (name, version)")

A number of errors are thrown because db-migrator has already created these objects



Run PAP CSIT test with updated persistence.xml

In the pap directory go to main/src/main/resources/META-INF/persistence.xml

persistence.xml



run mvn clean install

Use docker images to see image stored in the local cache.

Use docker rmi <image id> to remove pap images

cd packages/policy-pap-docker and run mvn clean install again to build the docker image

update docker-compose-all.yml

docker-compose-all.yml



Re-run CSIT test for pap

Waiting for mariadb port 3306...
mariadb (172.23.0.3:3306) open
.......Waiting for policy-db-migrator port 6824...
policy-db-migrator (172.23.0.4:6824) open
...........Waiting for message-router port 3905...
message-router (172.23.0.2:3905) open
Waiting for api port 6969...
api (172.23.0.5:6969) open
.........Policy pap config file: /opt/app/policy/pap/etc/defaultConfig.json
[EL Info]: 2021-08-11 09:30:21.762--ServerSession(1758893871)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4
[EL Warning]: 2021-08-11 09:30:22.738--ServerSession(1758893871)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: (conn=335) Unknown column 't1.LASTUPDATE' in 'field list'
Error Code: 1054
Call: SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName))))))))
bind => [4 parameters bound]
Query: ReadAllQuery(name="pdpInstances" referenceClass=JpaPdp sql="SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName))))))))")
Exception in thread "main" org.onap.policy.pap.main.PolicyPapRuntimeException: Start of policy-pap service failed.
at org.onap.policy.pap.main.startstop.Main.<init>(Main.java:93)
at org.onap.policy.pap.main.startstop.Main.main(Main.java:159)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: (conn=335) Unknown column 't1.LASTUPDATE' in 'field list'
Error Code: 1054
Call: SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName))))))))
bind => [4 parameters bound]
Query: ReadAllQuery(name="pdpInstances" referenceClass=JpaPdp sql="SELECT t1.HEALTHY, t1.LASTUPDATE, t1.MESSAGE, t1.PDPSTATE, t1.parentLocalName, t1.localName, t1.parentKeyVersion, t1.parentKeyName FROM PdpSubGroup_Pdp t0, Pdp t1 WHERE ((t0.pdpLocalName = ?) AND ((t0.pdpParentLocalName = ?) AND ((t0.pdpParentKeyVersion = ?) AND ((t0.pdpParentKeyName = ?) AND ((t1.parentKeyName = t0.parentKeyName) AND ((t1.parentKeyVersion = t0.parentKeyVersion) AND ((t1.localName = t0.localName) AND (t1.parentLocalName = t0.parentLocalName))))))))")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:342)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:691)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:567)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2099)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:603)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:277)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:263)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:334)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:746)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2768)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2721)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:584)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:485)
at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3356)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880)
at org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery(NoIndirectionPolicy.java:328)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal(ForeignReferenceMapping.java:2344)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java:2185)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.readFromRowIntoObject(ForeignReferenceMapping.java:1511)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:472)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.refreshObjectIfRequired(ObjectBuilder.java:4321)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:1050)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:747)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:1351)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:605)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:485)
at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3356)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880)
at org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery(NoIndirectionPolicy.java:328)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal(ForeignReferenceMapping.java:2344)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java:2185)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.readFromRowIntoObject(ForeignReferenceMapping.java:1511)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:472)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.refreshObjectIfRequired(ObjectBuilder.java:4321)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:1050)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:909)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:862)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:745)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:699)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:861)
at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(ReadObjectQuery.java:901)
at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:568)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1232)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:911)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191)
at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:447)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1279)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2983)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1830)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:1012)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.refresh(EntityManagerImpl.java:1156)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.refresh(EntityManagerImpl.java:1042)
at org.onap.policy.models.dao.impl.DefaultPfDao.genericGet(DefaultPfDao.java:443)
at org.onap.policy.models.dao.impl.DefaultPfDao.get(DefaultPfDao.java:412)
at org.onap.policy.models.pdp.persistence.provider.PdpProvider.createPdpGroups(PdpProvider.java:114)
at org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl.createPdpGroups(DatabasePolicyModelsProviderImpl.java:225)
at org.onap.policy.pap.main.startstop.PapDatabaseInitializer.initializePapDatabase(PapDatabaseInitializer.java:79)
at org.onap.policy.pap.main.startstop.Main.<init>(Main.java:72)
... 1 more
Caused by: java.sql.SQLSyntaxErrorException: (conn=335) Unknown column 't1.LASTUPDATE' in 'field list'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:153)
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:274)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:229)
at org.mariadb.jdbc.ClientSidePreparedStatement.execute(ClientSidePreparedStatement.java:149)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeQuery(ClientSidePreparedStatement.java:163)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:1015)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:651)
... 67 more
Caused by: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: Unknown column 't1.LASTUPDATE' in 'field list'
at org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException.of(MariaDbSqlException.java:34)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:194)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:177)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:321)
at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:220)
... 71 more
Caused by: java.sql.SQLException: Unknown column 't1.LASTUPDATE' in 'field list'
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1683)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1545)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1508)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:318)
... 72 more

The PDP table is missing a column



cd to the docker directory

cd to policy-db-migrator/src/main/docker

Update config/policyadmin/sql/0800/upgrade/0470-pdp.sql

0470-pdp.sql



Use docker images to see image stored in the local cache.

Use docker rmi <image id> to remove db-migrator images

cd /git/docker/policy-db-migrator, run mvn clean install again to build the docker image

Update docker-compose-all.yaml to use the local copy

docker-compose-all.yaml



Re-run papa CSIT test



Still some errors around the sequence table, we may need to prepopulate this table.



------------------------------------------------------------------------------
pap | FAIL |
15 tests, 13 passed, 2 failed
==============================================================================

2 test failures

QueryPolicyAuditAfterDeploy :: Verify policy audit record after de... /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
QueryPolicyAuditAfterDeploy :: Verify policy audit record after de... | FAIL |
Resolving variable '${resp.json()[0]['pdpGroup']}' failed: IndexError: list index out of range
------------------------------------------------------------------------------
UndeployPolicy :: Undeploy a policy named 'onap.restart.tca' from ... /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
UndeployPolicy :: Undeploy a policy named 'onap.restart.tca' from ... | PASS |
------------------------------------------------------------------------------
QueryPdpGroupsAfterUndeploy :: Verify PdpGroups after undeploy /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
QueryPdpGroupsAfterUndeploy :: Verify PdpGroups after undeploy | PASS |
------------------------------------------------------------------------------
QueryPolicyAuditAfterUnDeploy :: Verify policy audit record after ... /tmp/v/robot/lib/python3.8/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
QueryPolicyAuditAfterUnDeploy :: Verify policy audit record after ... | FAIL |
Resolving variable '${resp.json()[0]['pdpGroup']}' failed: IndexError: list index out of range



Updated docker/policy-db-migrator

vi config/policyadmin/sql/0900/upgrade/0110-sequence.sql

0110-sequence.sql



Re-created docker image for db-migrator



Updated persistence.xml

persistence.xml

Re-created docker image for pap

Re-ran the test



------------------------------------------------------------------------------
pap | PASS |
15 tests, 15 passed, 0 failed
==============================================================================