66import fr .sandro642 .github .enums .LangType ;
77import fr .sandro642 .github .enums .MethodType ;
88import fr .sandro642 .github .enums .ResourceType ;
9+ import fr .sandro642 .github .provider .AtomicFactory ;
910import fr .sandro642 .github .provider .RouteImport ;
1011import fr .sandro642 .github .provider .URLProvider ;
1112import fr .sandro642 .github .provider .VersionProvider ;
@@ -43,6 +44,19 @@ public String getRoute() {
4344 }
4445 }
4546
47+ public class ClassheritFromFactory extends AtomicFactory {
48+
49+
50+
51+ public ClassheritFromFactory (ApiFactory apiFactory ) {
52+ getPhysx (apiFactory );
53+ }
54+
55+ public Object getContent () {
56+ return rawPhysx ().get ("content" );
57+ }
58+ }
59+
4660 /**
4761 * Example of URL branches, you can add multiple branches if you have multiple environments (dev, prod, etc.)
4862 */
@@ -94,7 +108,7 @@ public static void main(String[] args) {
94108
95109 CompletableFuture <ApiFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
96110 .getRoutes (MethodType .GET , TestRoutes .HELLO )
97- .getResponse ();
111+ .execute ();
98112
99113 ApiFactory response = apiFactoryCompletableFuture .get (5 , TimeUnit .SECONDS );
100114
@@ -118,7 +132,7 @@ public void testUseFullRoute() {
118132
119133 CompletableFuture <ApiFactory > factoryCompletableFuture = connectLib .JobGetInfos ()
120134 .getRoutes (MethodType .GET , TestRoutes .GREET , null , null , query )
121- .getResponse ();
135+ .execute ();
122136
123137 ApiFactory response = factoryCompletableFuture .get (5 , TimeUnit .SECONDS );
124138
@@ -145,7 +159,7 @@ public void testLangType() {
145159 */
146160 //.urlBranch(ExampleUrlBranch.LOCALHOST)
147161
148- .getResponse ();
162+ .execute ();
149163
150164 ApiFactory response = factoryCompletableFuture .get (5 , TimeUnit .SECONDS );
151165
@@ -167,7 +181,7 @@ public void testSpecData() {
167181 CompletableFuture <ApiFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
168182 .getRoutes (TestCustomVersion .V1_API , MethodType .GET , TestRoutes .REQUEST_TOKEN )
169183 .urlBranch (ExampleUrlBranch .PROD )
170- .getResponse ();
184+ .execute ();
171185
172186 ApiFactory apiFactory = apiFactoryCompletableFuture .get (5 , TimeUnit .SECONDS );
173187
@@ -186,23 +200,18 @@ public void testSpecData() {
186200 public void startAppServices () {
187201 try {
188202 connectLib .Logger ().showLogs ();
189- connectLib .init (ResourceType .TEST_RESOURCES , LangType .ENGLISH , TestRoutes .class )
190- .webServices (8080 , "TestDashboard" );
203+ connectLib .init (ResourceType .TEST_RESOURCES , LangType .ENGLISH , TestRoutes .class );
204+ // .webServices(8080, "TestDashboard");
191205
192- CompletableFuture <ApiFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
206+ CompletableFuture <ClassheritFromFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
193207 .getRoutes (MethodType .GET , TestRoutes .HELLO )
194- .getResponse ();
195-
196- apiFactoryCompletableFuture = connectLib .JobGetInfos ()
197- .getRoutes (TestCustomVersion .V1_API ,MethodType .GET , TestRoutes .REQUEST_TOKEN )
198- .urlBranch (ExampleUrlBranch .PROD )
199- .getResponse ();
200-
201- ApiFactory apiFactory = apiFactoryCompletableFuture .get (5 , TimeUnit .SECONDS );
208+ .urlBranch (ExampleUrlBranch .POST_PROD )
209+ .execute ()
210+ .thenApply (ClassheritFromFactory ::new );
202211
203- System . out . println ( "Response: " + apiFactory . display () );
212+ ClassheritFromFactory classheritFromFactory = apiFactoryCompletableFuture . get ( 5 , TimeUnit . SECONDS );
204213
205- Thread . sleep ( 20000 );
214+ System . out . println ( "Response: " + classheritFromFactory . getContent () );
206215
207216 } catch (Exception e ) {
208217 e .printStackTrace ();
0 commit comments