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 ;
@@ -44,6 +45,19 @@ public String getRoute() {
4445 }
4546 }
4647
48+ public class ClassheritFromFactory extends AtomicFactory {
49+
50+
51+
52+ public ClassheritFromFactory (ApiFactory apiFactory ) {
53+ getPhysx (apiFactory );
54+ }
55+
56+ public Object getContent () {
57+ return rawPhysx ().get ("content" );
58+ }
59+ }
60+
4761 /**
4862 * Example of URL branches, you can add multiple branches if you have multiple environments (dev, prod, etc.)
4963 */
@@ -94,8 +108,8 @@ public static void main(String[] args) {
94108 connectLib .Logger ().showLogs ();
95109
96110 CompletableFuture <ApiFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
97- .getRoutes (null , MethodType .GET , TestRoutes .HELLO )
98- .getResponse ();
111+ .getRoutes (MethodType .GET , TestRoutes .HELLO )
112+ .execute ();
99113
100114 ApiFactory response = apiFactoryCompletableFuture .get (5 , TimeUnit .SECONDS );
101115
@@ -118,10 +132,8 @@ public void testUseFullRoute() {
118132 );
119133
120134 CompletableFuture <ApiFactory > factoryCompletableFuture = connectLib .JobGetInfos ()
121- .getRoutes (null , MethodType .GET , TestRoutes .GREET )
122- .urlBranch (ExampleUrlBranch .POST_PROD )
123- .query (query )
124- .getResponse ();
135+ .getRoutes (MethodType .GET , TestRoutes .GREET )
136+ .execute ();
125137
126138 ApiFactory response = factoryCompletableFuture .get (5 , TimeUnit .SECONDS );
127139
@@ -148,7 +160,7 @@ public void testLangType() {
148160 */
149161 //.urlBranch(ExampleUrlBranch.LOCALHOST)
150162
151- .getResponse ();
163+ .execute ();
152164
153165 ApiFactory response = factoryCompletableFuture .get (5 , TimeUnit .SECONDS );
154166
@@ -178,7 +190,7 @@ public void testSpecData() {
178190 CompletableFuture <ApiFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
179191 .getRoutes (TestCustomVersion .V1_API , MethodType .GET , TestRoutes .REQUEST_TOKEN )
180192 .urlBranch (ExampleUrlBranch .PROD )
181- .getResponse ();
193+ .execute ();
182194
183195 ApiFactory apiFactory = apiFactoryCompletableFuture .get (5 , TimeUnit .SECONDS );
184196
@@ -222,23 +234,18 @@ public void pushsession() {
222234 public void startAppServices () {
223235 try {
224236 connectLib .Logger ().showLogs ();
225- connectLib .init (ResourceType .TEST_RESOURCES , LangType .ENGLISH , TestRoutes .class )
226- .webServices (8080 , "TestDashboard" );
227-
228- CompletableFuture <ApiFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
229- .getRoutes (null , MethodType .GET , TestRoutes .HELLO )
230- .getResponse ();
237+ connectLib .init (ResourceType .TEST_RESOURCES , LangType .ENGLISH , TestRoutes .class );
238+ //.webServices(8080, "TestDashboard");
231239
232- apiFactoryCompletableFuture = connectLib .JobGetInfos ()
233- .getRoutes (TestCustomVersion .V1_API ,MethodType .GET , TestRoutes .REQUEST_TOKEN )
234- .urlBranch (ExampleUrlBranch .PROD )
235- .getResponse ();
236-
237- ApiFactory apiFactory = apiFactoryCompletableFuture .get (5 , TimeUnit .SECONDS );
240+ CompletableFuture <ClassheritFromFactory > apiFactoryCompletableFuture = connectLib .JobGetInfos ()
241+ .getRoutes (MethodType .GET , TestRoutes .HELLO )
242+ .urlBranch (ExampleUrlBranch .POST_PROD )
243+ .execute ()
244+ .thenApply (ClassheritFromFactory ::new );
238245
239- System . out . println ( "Response: " + apiFactory . display () );
246+ ClassheritFromFactory classheritFromFactory = apiFactoryCompletableFuture . get ( 5 , TimeUnit . SECONDS );
240247
241- Thread . sleep ( 20000 );
248+ System . out . println ( "Response: " + classheritFromFactory . getContent () );
242249
243250 } catch (Exception e ) {
244251 e .printStackTrace ();
0 commit comments