From 197d527837acde84f16edb3c428ce06d16d50567 Mon Sep 17 00:00:00 2001
From: Javier <10879637+javiertuya@users.noreply.github.com>
Date: Sat, 4 Jan 2025 11:20:31 +0100
Subject: [PATCH] Move path resolver model/apiWriter config to live adapter
---
pom.xml | 3 ++-
.../java/test4giis/tdrules/tdg/st/eval/petstore/Base.java | 6 ++----
.../test/java/test4giis/tdrules/tdg/st/test/BaseAll.java | 5 +----
.../test4giis/tdrules/tdg/st/test/market/BaseMarket.java | 4 +---
.../tdg/st/test/petstore/TestPetstoreDatagenLiveBackId.java | 4 ++--
5 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/pom.xml b/pom.xml
index 94bc526..5abc0ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,8 @@
3.3.0
- 4.3.2-SNAPSHOT
+
+ 4.3.2-next-release-SNAPSHOT
1.4.275
diff --git a/st-tdg-eval/src/test/java/test4giis/tdrules/tdg/st/eval/petstore/Base.java b/st-tdg-eval/src/test/java/test4giis/tdrules/tdg/st/eval/petstore/Base.java
index 27f7b18..fedfcd9 100644
--- a/st-tdg-eval/src/test/java/test4giis/tdrules/tdg/st/eval/petstore/Base.java
+++ b/st-tdg-eval/src/test/java/test4giis/tdrules/tdg/st/eval/petstore/Base.java
@@ -12,9 +12,7 @@
import giis.tdrules.store.loader.IAttrGen;
import giis.tdrules.store.loader.gen.DictionaryAttrGen;
import giis.tdrules.store.loader.oa.ApiWriter;
-import giis.tdrules.store.loader.oa.IPathResolver;
import giis.tdrules.store.loader.oa.OaLiveAdapter;
-import giis.tdrules.store.loader.oa.OaPathResolver;
import giis.visualassert.Framework;
import giis.visualassert.VisualAssert;
import giis.visualassert.portable.FileUtil;
@@ -57,8 +55,8 @@ protected void load(ApiWriter writer, String query) {
// The path resolver is created using a controller mock (writer)
// and the data loader using a dictionary
- IPathResolver pathResolver = new OaPathResolver().setSchemaModel(model).setServerUrl("").setApiWriter(writer);
- DataLoader loader = new DataLoader(model, new OaLiveAdapter(pathResolver)).setAttrGen(getPetstoreDictionary().setMinYear(2024));
+ DataLoader loader = new DataLoader(model, new OaLiveAdapter("").setApiWriter(writer))
+ .setAttrGen(getPetstoreDictionary().setMinYear(2024));
// Generation and loading: Each test first delete all data previous to the generation and load
writer.delete("/test/deleteAll");
diff --git a/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/BaseAll.java b/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/BaseAll.java
index b52198e..84473d3 100644
--- a/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/BaseAll.java
+++ b/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/BaseAll.java
@@ -22,10 +22,8 @@
import giis.tdrules.store.loader.DataLoader;
import giis.tdrules.store.loader.IAttrGen;
import giis.tdrules.store.loader.oa.ApiWriter;
-import giis.tdrules.store.loader.oa.IPathResolver;
import giis.tdrules.store.loader.oa.OaLiveAdapter;
import giis.tdrules.store.loader.oa.OaLocalAdapter;
-import giis.tdrules.store.loader.oa.OaPathResolver;
import giis.tdrules.store.loader.oa.Reserializer;
import giis.visualassert.Framework;
import giis.visualassert.VisualAssert;
@@ -149,8 +147,7 @@ protected DataLoader getLocalDataLoader() {
}
protected DataLoader getLiveDataLoader() {
TdSchema model = getSchema();
- IPathResolver pathResolver = new OaPathResolver().setSchemaModel(model);
- return new DataLoader(model, new OaLiveAdapter(getServerUrl(), pathResolver));
+ return new DataLoader(model, new OaLiveAdapter(getServerUrl()));
}
/**
diff --git a/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/market/BaseMarket.java b/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/market/BaseMarket.java
index 7aa74db..dd9cebb 100644
--- a/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/market/BaseMarket.java
+++ b/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/market/BaseMarket.java
@@ -13,7 +13,6 @@
import giis.tdrules.store.loader.DataLoader;
import giis.tdrules.store.loader.IAttrGen;
import giis.tdrules.store.loader.gen.DictionaryAttrGen;
-import giis.tdrules.store.loader.oa.IPathResolver;
import giis.tdrules.store.loader.oa.OaBasicAuthStore;
import giis.tdrules.store.loader.oa.OaLiveAdapter;
import giis.tdrules.store.loader.oa.OaLiveUidGen;
@@ -91,14 +90,13 @@ protected DataLoader getLiveDataLoader() {
// OrderDTO (username is userAccount attribute)
// * Use a dictionary
TdSchema model = getSchema();
- IPathResolver pathResolver=new CustomPathResolver();
OaBasicAuthStore authenticator = new OaBasicAuthStore()
.setProvider("UserDTOReq", "email", "password")
.addConsumer(new String[] { "CartItemDTORes", "CartItemDTOReq",
"ContactsDTORes", "ContactsDTOReq" }, "user")
.addConsumer(new String[] { "OrderDTO"} , "userAccount");
- return new DataLoader(model, new OaLiveAdapter(MARKET_URL_LIVE, pathResolver).setAuthStore(authenticator))
+ return new DataLoader(model, new OaLiveAdapter(MARKET_URL_LIVE).setPathResolver(new CustomPathResolver()).setAuthStore(authenticator))
.setUidGen(new OaLiveUidGen())
.setAttrGen(getDictionaryAttrGen());
}
diff --git a/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/petstore/TestPetstoreDatagenLiveBackId.java b/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/petstore/TestPetstoreDatagenLiveBackId.java
index 229a326..0fd7a5a 100644
--- a/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/petstore/TestPetstoreDatagenLiveBackId.java
+++ b/st-tdg-test/src/test/java/test4giis/tdrules/tdg/st/test/petstore/TestPetstoreDatagenLiveBackId.java
@@ -28,7 +28,7 @@ public class CustomPathResolver extends OaPathResolver {
@Override
public String getEndpointPath(String tableName) {
if ("Pet".equals(tableName) || "Category".equals(tableName))
- return super.getEndpointPath("backid/" + tableName);
+ return "/backid/" + tableName.toLowerCase();
else
return super.getEndpointPath(tableName);
}
@@ -39,7 +39,7 @@ public String getEndpointPath(String tableName) {
@Override
protected DataLoader getLiveDataLoader() {
IPathResolver pathResolver=new CustomPathResolver();
- return new DataLoader(getSchema(), new OaLiveAdapter(getServerUrl(), pathResolver)).setUidGen(new OaLiveUidGen());
+ return new DataLoader(getSchema(), new OaLiveAdapter(getServerUrl()).setPathResolver(pathResolver)).setUidGen(new OaLiveUidGen());
}
/**