Fixing code due to refactoring

This commit is contained in:
Luca Frosini 2021-03-18 13:17:47 +01:00
parent 4c81b7fdf9
commit 261b0b9d8d
10 changed files with 8 additions and 170 deletions

View File

@ -35,7 +35,7 @@ public class PersistencePostgreSQL extends PersistenceBackend {
@Override
protected void prepareConnection(PersistenceBackendConfiguration configuration) throws Exception {
statementMap = new StatementMap(configuration);
Map<String, Class<? extends AggregatedRecord<?,?>>> aggregatedRecords = RecordUtility.getAggregatedRecordClassesFound();
for(String typeName : aggregatedRecords.keySet()) {
try {

View File

@ -42,6 +42,7 @@ public class StatementMap {
RecordToDBConnection recordDBInfo = RecordToDBMapping.getRecordDBInfo(clz);
if(recordDBInfo == null) {
RecordToDBMapping.addRecordToDB(clz, configuration);
recordDBInfo = RecordToDBMapping.getRecordDBInfo(clz);
}
return recordDBInfo.getConnection();
}

View File

@ -251,6 +251,7 @@ public class PersistencePostgreSQLTest extends ContextTest {
persistencePostgreSQL.commitAndClose();
}
/*
AggregatedServiceUsageRecord usageRecord = getTestServiceUsageRecord();
/*
logger.debug("operationCount : {} - min : {} duration : {} - max : {}",
@ -258,8 +259,9 @@ public class PersistencePostgreSQLTest extends ContextTest {
usageRecord.getMinInvocationTime(),
usageRecord.getDuration(),
usageRecord.getMaxInvocationTime());
*/
* /
persistencePostgreSQL.insert(usageRecord);
*/
/*
UsageRecord usageRecord = getTestAggregatedJobUsageRecord();
@ -273,11 +275,10 @@ public class PersistencePostgreSQLTest extends ContextTest {
usageRecord = getTestAggregatedStorageStatusRecord();
persistencePostgreSQL.insert(usageRecord);
usageRecord = getTestAggregatedStorageUsageRecord();
persistencePostgreSQL.insert(usageRecord);
*/
UsageRecord usageRecord = getTestAggregatedStorageUsageRecord();
persistencePostgreSQL.insert(usageRecord);
}
persistencePostgreSQL.commitAndClose();
}

View File

@ -1,20 +0,0 @@
-- CREATE TYPE operation_result AS ENUM ('SUCCESS', 'FAILED');
CREATE TABLE "jobusagerecord"(
id UUID NOT NULL PRIMARY KEY,
consumer_id TEXT NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL,
scope TEXT NOT NULL,
operation_result operation_result NOT NULL,
caller_qualifier TEXT NOT NULL DEFAULT 'TOKEN',
host TEXT NOT NULL,
service_class TEXT NOT NULL,
service_name TEXT NOT NULL,
job_name TEXT NOT NULL,
duration NUMERIC NOT NULL,
max_invocation_time NUMERIC NOT NULL,
min_invocation_time NUMERIC NOT NULL,
operation_count INTEGER NOT NULL DEFAULT 1,
aggregated BOOLEAN NOT NULL DEFAULT true,
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
end_time TIMESTAMP WITH TIME ZONE NOT NULL
);

View File

@ -1,15 +0,0 @@
-- CREATE TYPE operation_result AS ENUM ('SUCCESS', 'FAILED');
CREATE TABLE "portletusagerecord"(
id UUID NOT NULL PRIMARY KEY,
consumer_id TEXT NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL,
scope TEXT NOT NULL,
operation_result operation_result NOT NULL,
caller_qualifier TEXT NOT NULL DEFAULT 'TOKEN',
portlet_id TEXT NOT NULL,
operation_id TEXT NOT NULL,
operation_count INTEGER NOT NULL DEFAULT 1,
aggregated BOOLEAN NOT NULL DEFAULT true,
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
end_time TIMESTAMP WITH TIME ZONE NOT NULL
);

View File

@ -1,21 +0,0 @@
CREATE TYPE operation_result AS ENUM ('SUCCESS', 'FAILED');
CREATE TABLE "serviceusagerecord"(
id UUID NOT NULL PRIMARY KEY,
consumer_id TEXT NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL,
scope TEXT NOT NULL,
operation_result operation_result NOT NULL,
caller_qualifier TEXT NOT NULL DEFAULT 'TOKEN',
caller_host TEXT NOT NULL,
host TEXT NOT NULL,
service_class TEXT NOT NULL,
service_name TEXT NOT NULL,
called_method TEXT NOT NULL,
duration NUMERIC NOT NULL,
max_invocation_time NUMERIC NOT NULL,
min_invocation_time NUMERIC NOT NULL,
operation_count INTEGER NOT NULL DEFAULT 1,
aggregated BOOLEAN NOT NULL DEFAULT true,
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
end_time TIMESTAMP WITH TIME ZONE NOT NULL
);

View File

@ -1,20 +0,0 @@
-- CREATE TYPE operation_result AS ENUM ('SUCCESS', 'FAILED');
-- CREATE TYPE data_type AS ENUM ('STORAGE', 'TREE', 'GEO', 'DATABASE', 'LOCAL', 'OTHER');
CREATE TABLE "storagestatusrecord"(
id UUID NOT NULL PRIMARY KEY,
consumer_id TEXT NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL,
scope TEXT NOT NULL,
operation_result operation_result NOT NULL,
data_type data_type NOT NULL,
data_volume NUMERIC NOT NULL,
data_count NUMERIC NOT NULL,
data_service_class TEXT NOT NULL,
data_service_name TEXT NOT NULL,
data_service_id TEXT NOT NULL,
provider_id TEXT NOT NULL,
operation_count INTEGER NOT NULL DEFAULT 1,
aggregated BOOLEAN NOT NULL DEFAULT true,
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
end_time TIMESTAMP WITH TIME ZONE NOT NULL
);

View File

@ -1,21 +0,0 @@
-- CREATE TYPE operation_result AS ENUM ('SUCCESS', 'FAILED');
CREATE TYPE operation_type AS ENUM ('CREATE', 'READ', 'UPDATE', 'DELETE');
CREATE TYPE data_type AS ENUM ('STORAGE', 'TREE', 'GEO', 'DATABASE', 'LOCAL', 'OTHER');
CREATE TABLE "storageusagerecord"(
id UUID NOT NULL PRIMARY KEY,
consumer_id TEXT NOT NULL,
creation_time TIMESTAMP WITH TIME ZONE NOT NULL,
scope TEXT NOT NULL,
operation_result operation_result NOT NULL,
resource_owner TEXT NOT NULL,
resource_scope TEXT NOT NULL,
resource_uri TEXT NOT NULL,
provider_uri TEXT NOT NULL,
operation_type operation_type NOT NULL,
data_type data_type NOT NULL,
data_volume NUMERIC NOT NULL,
operation_count INTEGER NOT NULL DEFAULT 1,
aggregated BOOLEAN NOT NULL DEFAULT true,
start_time TIMESTAMP WITH TIME ZONE NOT NULL,
end_time TIMESTAMP WITH TIME ZONE NOT NULL
);

View File

@ -1,64 +0,0 @@
INSERT INTO jobusagerecord
(aggregated,caller_qualifier,consumer_id,creation_time,
duration,end_time,host,id,
job_name,max_invocation_time,min_invocation_time,operation_count,
operation_result,scope,service_class,service_name,
start_time)
VALUES
('true','TestCallerQualifier','name.surname','2021-03-15 12:20:32.705 +0100',
295,'2021-03-15 12:20:32.704 +0100','localhost','17abc69a-491e-47ed-994b-9e1db0cf05fd',
'TestJobName',295,295,1,
'SUCCESS','/gcube/devNext','TestServiceClass','TestServiceName',
'2021-03-15 12:20:32.704 +0100');
----------------------------------------------------------------------------------------
INSERT INTO portletusagerecord
(aggregated,consumer_id,creation_time,end_time,
id,operation_count,operation_id,operation_result,
portlet_id,scope,start_time)
VALUES
('true','name.surname','2021-03-15 12:20:32.706 +0100','2021-03-15 12:20:32.705 +0100',
'724aee1c-3f7c-40b9-bb27-40211a7b10ca',1,'TestPortletOperationID','SUCCESS',
'TestPortlet','/gcube/devNext','2021-03-15 12:20:32.705 +0100');
----------------------------------------------------------------------------------------
INSERT INTO serviceusagerecord
(aggregated,called_method,caller_host,caller_qualifier,
consumer_id,creation_time,duration,end_time,
host,id,max_invocation_time,min_invocation_time,operation_count,
operation_result,scope,service_class,service_name,
start_time)
VALUES
('true','TestCalledMethod','remotehost','TestCallerQualifier',
'name.surname','2021-03-15 12:20:32.987 +0100',361,'2021-03-15 12:20:32.706 +0100',
'localhost','c386cf48-b955-4683-a3da-372216e34eb3',361,361,
1,'SUCCESS','/gcube/devNext','TestServiceClass',
'TestServiceName','2021-03-15 12:20:32.706 +0100');
----------------------------------------------------------------------------------------
INSERT INTO storagestatusrecord
(aggregated,consumer_id,creation_time,data_count,
data_service_class,data_service_id,data_service_name,data_type,
data_volume,end_time,id,operation_count,
operation_result,provider_id,scope,start_time)
VALUES ('true','name.surname','2021-03-15 12:20:32.988 +0100',8117,
'dataServiceClass','dataServiceId','dataServiceName','STORAGE',
8086,'2021-03-15 12:20:32.988 +0100','21d68adf-b17f-4a19-85ac-c50ba854cf72',1,
'SUCCESS','testprotocol://providerURI','/gcube/devNext','2021-03-15 12:20:32.988 +0100');
----------------------------------------------------------------------------------------
INSERT INTO storageusagerecord
(aggregated,consumer_id,creation_time,data_type,
data_volume,end_time,id,operation_count,
operation_result,operation_type,provider_uri,resource_owner,
resource_scope,resource_uri,scope,start_time)
VALUES
('true','name.surname','2021-03-15 12:20:32.990 +0100','STORAGE',
9177,'2021-03-15 12:20:32.989 +0100','11c0f9bb-e04f-4035-a230-50160dad737e',1,
'SUCCESS','READ','testprotocol://providerURI','resource.owner',
'/infrastructure/vo','testprotocol://objectURI','/gcube/devNext','2021-03-15 12:20:32.989 +0100');

View File

@ -1,3 +0,0 @@
postgres://lucafrosini:silviomerda@localhost:5432/accounting
jdbc:postgres://localhost:5432/accounting