Run API CSIT test without updating persistence.xml
API docker log
Expand |
---|
|
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 |
...
mvn clean install to build the projjectproject
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
...
SQL errors no longer present
------------------------------------------------------------------------------
api | PASS |
16 tests, 16 passed, 0 failed
==============================================================================
Updated persistence.xml
Code Block |
---|
language | xml |
---|
title | 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
Expand |
---|
|
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
Expand |
---|
|
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
Code Block |
---|
language | xml |
---|
title | 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> |
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
Code Block |
---|
language | yml |
---|
title | docker-compose-all.yml |
---|
|
pap:
#image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION}
image: onap/policy-pap:${POLICY_PAP_VERSION} |
Re-run CSIT test for pap
Expand |
---|
|
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
Code Block |
---|
language | bash |
---|
title | 0470-pdp.sql |
---|
|
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
CREATE TABLE IF NOT EXISTS pdp (HEALTHY INT DEFAULT NULL NULL, LASTUPDATE DATETIME DEFAULT NULL NULL, MESSAGE VARCHAR(255) NULL, PDPSTATE INT DEFAULT NULL NULL, parentLocalName VARCHAR(120) NOT NULL, localName VARCHAR(120) NOT NULL, parentKeyVersion VARCHAR(15) NOT NULL, parentKeyName VARCHAR(120) NOT NULL, CONSTRAINT PK_PDP PRIMARY KEY (parentLocalName, localName, parentKeyVersion, parentKeyName)); |
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
Code Block |
---|
language | yml |
---|
title | docker-compose-all.yaml |
---|
|
policy-db-migrator:
#image: nexus3.onap.org:10001/onap/policy-db-migrator:${POLICY_DOCKER_VERSION}
image: onap/policy-db-migrator:${POLICY_DOCKER_VERSION}
|
Re-run papa CSIT test
Expand |
---|
|
Waiting for mariadb port 3306... mariadb (172.28.0.3:3306) open .......Waiting for policy-db-migrator port 6824... policy-db-migrator (172.28.0.4:6824) open ...........Waiting for message-router port 3905... message-router (172.28.0.2:3905) open Waiting for api port 6969... api (172.28.0.5:6969) open .........Policy pap config file: /opt/app/policy/pap/etc/defaultConfig.json [EL Info]: 2021-08-11 11:14:26.965--ServerSession(124494140)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:38.6--ServerSession(465183707)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:40.254--ServerSession(1922626110)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:40.652--ServerSession(2027186692)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:41.202--ServerSession(1371975109)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Warning]: 2021-08-11 11:14:41.94--UnitOfWork(1142495097)--Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Error preallocating sequence numbers. The sequence table information is not complete. [EL Info]: 2021-08-11 11:14:42.121--ServerSession(1307703223)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:42.41--ServerSession(1515135276)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:42.649--ServerSession(1239331505)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Warning]: 2021-08-11 11:14:43.169--UnitOfWork(761891474)--Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Error preallocating sequence numbers. The sequence table information is not complete. [EL Info]: 2021-08-11 11:14:43.34--ServerSession(858762233)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:43.604--ServerSession(1429879266)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:43.87--ServerSession(713555031)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:44.137--ServerSession(1486795260)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:44.395--ServerSession(298203416)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 11:14:49.248--ServerSession(627717566)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 |
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
Code Block |
---|
language | bash |
---|
title | 0110-sequence.sql |
---|
|
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
CREATE TABLE IF NOT EXISTS sequence (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(38) DEFAULT NULL NULL, CONSTRAINT PK_SEQUENCE PRIMARY KEY (SEQ_NAME));
INSERT INTO sequence(SEQ_NAME, SEQ_COUNT) VALUES('SEQ_GEN', 0);
COMMIT; |
Re-created docker image for db-migrator
Updated persistence.xml
Code Block |
---|
language | xml |
---|
title | 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 docker image for pap
Re-ran the test
Expand |
---|
|
Waiting for mariadb port 3306... mariadb (192.168.112.3:3306) open .......Waiting for message-router port 3905... message-router (192.168.112.2:3905) open Waiting for api port 6969... api (192.168.112.5:6969) open .....................Policy pap config file: /opt/app/policy/pap/etc/defaultConfig.json [EL Info]: 2021-08-11 14:54:24.239--ServerSession(1572745406)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:37.265--ServerSession(220424180)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:39.097--ServerSession(1950556808)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:39.671--ServerSession(1605414813)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:40.276--ServerSession(294027387)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:41.367--ServerSession(137072768)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:41.728--ServerSession(955119253)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:42.067--ServerSession(2073108423)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:42.925--ServerSession(758208991)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:43.249--ServerSession(1446701546)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:43.573--ServerSession(1830540395)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:43.891--ServerSession(1635115429)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:44.206--ServerSession(1983561358)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 [EL Info]: 2021-08-11 14:54:46.858--ServerSession(1451508796)--EclipseLink, version: Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4 |
------------------------------------------------------------------------------
pap | PASS |
15 tests, 15 passed, 0 failed
==============================================================================