Skip to content

Commit

Permalink
Fixed api and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
azizbekxm committed Nov 5, 2024
1 parent a9ca78e commit 73d713a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 154 deletions.
10 changes: 6 additions & 4 deletions ramls/fund_update_log.raml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ types:
errors: !include raml-util/schemas/errors.schema
fund-update-log: !include acq-models/mod-finance/schemas/fund_update_log.json
fund-update-log-collection: !include acq-models/mod-finance/schemas/fund_update_log_collection.json
example-fund-update-log: !include acq-models/mod-finance/examples/fund_update_log.sample
example-fund-update-log-collection: !include acq-models/mod-finance/examples/fund_update_log_collection.sample
UUID:
type: string
pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
Expand All @@ -25,11 +27,11 @@ resourceTypes:
collection-item: !include raml-util/rtypes/item-collection.raml


/finance-storage/fund-update_log:
/finance-storage/fund-update-logs:
type:
collection:
exampleCollection: !include acq-models/mod-finance/examples/fund_update_log_collection.sample
exampleItem: !include acq-models/mod-finance/examples/fund_update_log.sample
exampleCollection: example-fund-update-log-collection
exampleItem: example-fund-update-log
schemaCollection: fund-update-log-collection
schemaItem: fund-update-log
is: [validate]
Expand All @@ -46,6 +48,6 @@ resourceTypes:
type: UUID
type:
collection-item:
exampleItem: !include acq-models/mod-finance/examples/fund_update_log.sample
exampleItem: example-fund-update-log
schema: fund-update-log
is: [validate]
34 changes: 21 additions & 13 deletions src/main/java/org/folio/rest/impl/FundUpdateLogAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,51 @@
import org.folio.rest.annotations.Validate;
import org.folio.rest.jaxrs.model.FundUpdateLog;
import org.folio.rest.jaxrs.model.FundUpdateLogCollection;
import org.folio.rest.jaxrs.resource.FinanceStorageFundUpdateLog;
import org.folio.rest.jaxrs.resource.FinanceStorageFundUpdateLogs;
import org.folio.rest.persist.PgUtil;

public class FundUpdateLogAPI implements FinanceStorageFundUpdateLog {
public class FundUpdateLogAPI implements FinanceStorageFundUpdateLogs {

public static final String FUND_UPDATE_LOG_TABLE = "fund_update_log";

@Override
@Validate
public void getFinanceStorageFundUpdateLog(String query, String totalRecords, int offset, int limit, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
public void getFinanceStorageFundUpdateLogs(String query, String totalRecords, int offset, int limit,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
PgUtil.get(FUND_UPDATE_LOG_TABLE, FundUpdateLog.class, FundUpdateLogCollection.class, query, offset, limit,
okapiHeaders, vertxContext, GetFinanceStorageFundUpdateLogResponse.class, asyncResultHandler);
okapiHeaders, vertxContext, GetFinanceStorageFundUpdateLogsResponse.class, asyncResultHandler);
}

@Override
@Validate
public void postFinanceStorageFundUpdateLog(FundUpdateLog entity, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.post(FUND_UPDATE_LOG_TABLE, entity, okapiHeaders, vertxContext, PostFinanceStorageFundUpdateLogResponse.class, asyncResultHandler);
public void postFinanceStorageFundUpdateLogs(FundUpdateLog entity, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.post(FUND_UPDATE_LOG_TABLE, entity, okapiHeaders, vertxContext,
PostFinanceStorageFundUpdateLogsResponse.class, asyncResultHandler);
}

@Override
@Validate
public void getFinanceStorageFundUpdateLogById(String id, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
public void getFinanceStorageFundUpdateLogsById(String id, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.getById(FUND_UPDATE_LOG_TABLE, FundUpdateLog.class, String.valueOf(id), okapiHeaders, vertxContext,
GetFinanceStorageFundUpdateLogByIdResponse.class, asyncResultHandler);
GetFinanceStorageFundUpdateLogsByIdResponse.class, asyncResultHandler);
}

@Override
@Validate
public void deleteFinanceStorageFundUpdateLogById(String id, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.deleteById(FUND_UPDATE_LOG_TABLE, String.valueOf(id), okapiHeaders, vertxContext, DeleteFinanceStorageFundUpdateLogByIdResponse.class,
asyncResultHandler);
public void deleteFinanceStorageFundUpdateLogsById(String id, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.deleteById(FUND_UPDATE_LOG_TABLE, String.valueOf(id), okapiHeaders, vertxContext,
DeleteFinanceStorageFundUpdateLogsByIdResponse.class, asyncResultHandler);
}

@Override
@Validate
public void putFinanceStorageFundUpdateLogById(String id, FundUpdateLog entity, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.put(FUND_UPDATE_LOG_TABLE, entity, String.valueOf(id), okapiHeaders, vertxContext, PutFinanceStorageFundUpdateLogByIdResponse.class, asyncResultHandler);
public void putFinanceStorageFundUpdateLogsById(String id, FundUpdateLog entity, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.put(FUND_UPDATE_LOG_TABLE, entity, String.valueOf(id), okapiHeaders, vertxContext,
PutFinanceStorageFundUpdateLogsByIdResponse.class, asyncResultHandler);
}
}

This file was deleted.

5 changes: 0 additions & 5 deletions src/test/java/org/folio/StorageTestSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.folio.rest.core.RestClientTest;
import org.folio.rest.impl.BudgetTest;
import org.folio.rest.impl.EntitiesCrudTest;
import org.folio.rest.impl.FundUpdateLogTest;
import org.folio.rest.impl.GroupBudgetTest;
import org.folio.rest.impl.GroupFundFYTest;
import org.folio.rest.impl.GroupTest;
Expand All @@ -31,7 +30,6 @@
import org.folio.rest.impl.LedgerRolloverBudgetTest;
import org.folio.rest.impl.TenantSampleDataTest;
import org.folio.rest.impl.TransactionTest;
import org.folio.rest.jaxrs.model.FundUpdateLog;
import org.folio.rest.jaxrs.model.TenantJob;
import org.folio.rest.persist.PostgresClient;
import org.folio.rest.tools.utils.NetworkUtils;
Expand Down Expand Up @@ -218,7 +216,4 @@ class PaymentCreditTestNested extends PaymentCreditTest {}

@Nested
class PendingPaymentTestNested extends PendingPaymentTest {}

@Nested
class FundUpdateLogTestNested extends FundUpdateLogTest {}
}
3 changes: 1 addition & 2 deletions src/test/java/org/folio/rest/impl/EntitiesCrudTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import static org.folio.rest.utils.TestEntities.FISCAL_YEAR;
import static org.folio.rest.utils.TestEntities.FUND;
import static org.folio.rest.utils.TestEntities.FUND_TYPE;
import static org.folio.rest.utils.TestEntities.FUND_UPDATE_LOG;
import static org.folio.rest.utils.TestEntities.GROUP;
import static org.folio.rest.utils.TestEntities.GROUP_FUND_FY;
import static org.folio.rest.utils.TestEntities.LEDGER;
Expand Down Expand Up @@ -52,7 +51,7 @@ public class EntitiesCrudTest extends TestBase {
*/
static Stream<TestEntities> deleteOrder() {
return Stream.of(GROUP_FUND_FY, BUDGET_EXPENSE_CLASS, BUDGET, LEDGER_FISCAL_YEAR_ROLLOVER_ERROR,
LEDGER_FISCAL_YEAR_ROLLOVER, FUND, FUND_TYPE, FUND_UPDATE_LOG, LEDGER, FISCAL_YEAR, GROUP, EXPENSE_CLASS);
LEDGER_FISCAL_YEAR_ROLLOVER, FUND, FUND_TYPE, LEDGER, FISCAL_YEAR, GROUP, EXPENSE_CLASS);
}

static Stream<TestEntities> deleteFailOrder() {
Expand Down
91 changes: 0 additions & 91 deletions src/test/java/org/folio/rest/impl/FundUpdateLogTest.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/test/java/org/folio/rest/utils/TestEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public enum TestEntities {
LEDGER_FISCAL_YEAR_ROLLOVER(HelperUtils.getEndpoint(FinanceStorageLedgerRollovers.class), LedgerFiscalYearRollover.class, "data/ledger-fiscal-year-rollovers/", "main-library.json", "restrictEncumbrance", "true", 0, true),
LEDGER_FISCAL_YEAR_ROLLOVER_LOG(HelperUtils.getEndpoint(FinanceStorageLedgerRolloversLogs.class), LedgerFiscalYearRolloverLog.class, null, null, null, null, 0, false),
LEDGER_FISCAL_YEAR_ROLLOVER_PROGRESS(HelperUtils.getEndpoint(FinanceStorageLedgerRolloversProgress.class), LedgerFiscalYearRolloverProgress.class, "data/ledger-fiscal-year-rollovers/", "main-library-progress.json", "financialRolloverStatus", "Success", 0, false),
LEDGER_FISCAL_YEAR_ROLLOVER_ERROR(HelperUtils.getEndpoint(FinanceStorageLedgerRolloversErrors.class), LedgerFiscalYearRolloverError.class, "data/ledger-fiscal-year-rollovers/", "main-library-errors.json", "errorType", "Fund", 0, false),
FUND_UPDATE_LOG(HelperUtils.getEndpoint(FinanceStorageFundUpdateLog.class), FundUpdateLog.class, "data/fund-update-log/", "monthly-fund-update.json", "jobName", "Weekly Fund Update", 0, true);
LEDGER_FISCAL_YEAR_ROLLOVER_ERROR(HelperUtils.getEndpoint(FinanceStorageLedgerRolloversErrors.class), LedgerFiscalYearRolloverError.class, "data/ledger-fiscal-year-rollovers/", "main-library-errors.json", "errorType", "Fund", 0, false);


TestEntities(String endpoint, Class<?> clazz, String pathToSamples, String sampleFileName, String updatedFieldName,
String updatedFieldValue, int initialQuantity, boolean isOptLockingEnabled) {
Expand Down
25 changes: 0 additions & 25 deletions src/test/java/org/folio/utils/CopilotGenerated.java

This file was deleted.

0 comments on commit 73d713a

Please sign in to comment.