@@ -83,6 +83,19 @@ public static void createNativeWorkerConfigProperties(int coordinatorPort, Strin
8383 createPropertiesFile ("testcontainers/" + nodeId + "/etc/config.properties" , properties );
8484 }
8585
86+ public static void createNativeWorkerConfigPropertiesWithFunctionServer (int coordinatorPort , int functionServerPort , String nodeId )
87+ throws IOException
88+ {
89+ Properties properties = new Properties ();
90+ properties .setProperty ("presto.version" , "testversion" );
91+ properties .setProperty ("http-server.http.port" , "7777" );
92+ properties .setProperty ("discovery.uri" , "http://presto-coordinator:" + coordinatorPort );
93+ properties .setProperty ("system-memory-gb" , "2" );
94+ properties .setProperty ("native.sidecar" , "false" );
95+ properties .setProperty ("remote-function-server.rest.url" , "http://presto-coordinator:" + functionServerPort );
96+ createPropertiesFile ("testcontainers/" + nodeId + "/etc/config.properties" , properties );
97+ }
98+
8699 public static void createCoordinatorConfigProperties (int port )
87100 throws IOException
88101 {
@@ -93,6 +106,8 @@ public static void createCoordinatorConfigProperties(int port)
93106 properties .setProperty ("http-server.http.port" , Integer .toString (port ));
94107 properties .setProperty ("discovery-server.enabled" , "true" );
95108 properties .setProperty ("discovery.uri" , "http://presto-coordinator:" + port );
109+ properties .setProperty ("list-built-in-functions-only" , "false" );
110+ properties .setProperty ("native-execution-enabled" , "false" );
96111
97112 // Get native worker system properties and add them to the coordinator properties
98113 Map <String , String > nativeWorkerProperties = NativeQueryRunnerUtils .getNativeWorkerSystemProperties ();
@@ -103,6 +118,52 @@ public static void createCoordinatorConfigProperties(int port)
103118 createPropertiesFile ("testcontainers/coordinator/etc/config.properties" , properties );
104119 }
105120
121+ public static void createFunctionNamespaceRemoteProperties ()
122+ throws IOException
123+ {
124+ Properties properties = new Properties ();
125+ properties .setProperty ("function-namespace-manager.name" , "rest" );
126+ properties .setProperty ("supported-function-languages" , "Java" );
127+ properties .setProperty ("function-implementation-type" , "REST" );
128+
129+ String directoryPath = "testcontainers/function-namespace" ;
130+ File directory = new File (directoryPath );
131+ if (!directory .exists ()) {
132+ directory .mkdirs ();
133+ }
134+
135+ createPropertiesFile ("testcontainers/coordinator/etc/function-namespace/remote.properties" , properties );
136+ }
137+
138+ public static void createFunctionNamespaceRemotePropertiesWithFunctionServer (int functionServerPort )
139+ throws IOException
140+ {
141+ Properties properties = new Properties ();
142+ properties .setProperty ("function-namespace-manager.name" , "rest" );
143+ properties .setProperty ("supported-function-languages" , "Java" );
144+ properties .setProperty ("function-implementation-type" , "REST" );
145+ properties .setProperty ("rest-based-function-manager.rest.url" , "http://localhost:" + functionServerPort );
146+
147+ String directoryPath = "testcontainers/function-namespace" ;
148+ File directory = new File (directoryPath );
149+ if (!directory .exists ()) {
150+ directory .mkdirs ();
151+ }
152+
153+ createPropertiesFile ("testcontainers/coordinator/etc/function-namespace/remote.properties" , properties );
154+ }
155+
156+ public static void createFunctionServerConfigProperties (int functionServerPort )
157+ throws IOException
158+ {
159+ Properties properties = new Properties ();
160+ properties .setProperty ("http-server.http.port" , String .valueOf (functionServerPort ));
161+ properties .setProperty ("regex-library" , "RE2J" );
162+ properties .setProperty ("parse-decimal-literals-as-double" , "true" );
163+
164+ createPropertiesFile ("testcontainers/coordinator/etc/function-server/config.properties" , properties );
165+ }
166+
106167 public static void createCoordinatorJvmConfig ()
107168 throws IOException
108169
@@ -161,6 +222,11 @@ public static void createCoordinatorEntryPointScript()
161222 {
162223 String scriptContent = "#!/bin/sh\n " +
163224 "set -e\n " +
225+ "java " +
226+ // "-Dplugin.dir=/opt/presto-remote-server/function-server-plugin " +
227+ // "-Dconfig=/opt/presto-remote-server/function-server-etc/config.properties " +
228+ // "-jar /opt/presto-remote-server >> log1.txt 2>&1 & \n" +
229+ "-Dconfig=/opt/function-server/etc/config.properties -jar /opt/presto-remote-server >> log1.txt 2>&1 & \n " +
164230 "$PRESTO_HOME/bin/launcher run\n " ;
165231 createScriptFile ("testcontainers/coordinator/entrypoint.sh" , scriptContent );
166232 }
@@ -204,10 +270,6 @@ public static void createPropertiesFile(String filePath, Properties properties)
204270 parentDir .mkdirs ();
205271 }
206272
207- if (file .exists ()) {
208- throw new IOException ("File exists: " + filePath );
209- }
210-
211273 try (OutputStreamWriter writer = new OutputStreamWriter (new FileOutputStream (file ), StandardCharsets .UTF_8 )) {
212274 for (String key : properties .stringPropertyNames ()) {
213275 writer .write (key + "=" + properties .getProperty (key ) + "\n " );
@@ -224,10 +286,6 @@ public static void createScriptFile(String filePath, String scriptContent)
224286 parentDir .mkdirs ();
225287 }
226288
227- if (file .exists ()) {
228- throw new IOException ("File exists: " + filePath );
229- }
230-
231289 try (OutputStream output = new FileOutputStream (file );
232290 OutputStreamWriter writer = new OutputStreamWriter (output , StandardCharsets .UTF_8 )) {
233291 writer .write (scriptContent );
0 commit comments