2222
2323public class ScaffoldingTest extends HubTestBase {
2424
25- private File pluginsDir = new File ("./test-ye-plugins" );
25+ private String pluginPath = "./test-ye-plugins" ;
26+ private File pluginsDir = new File (pluginPath );
2627
2728 @ BeforeClass
2829 public static void setup () {
@@ -44,12 +45,12 @@ public void createEntity() {
4445 File entityDir = Scaffolding .getEntityDir (pluginsDir , "my-fun-test" );
4546 assertTrue (entityDir .exists ());
4647 assertEquals (
47- new File ("./test-ye-plugins /entities/my-fun-test" ).toPath (),
48+ new File (pluginPath + " /entities/my-fun-test" ).toPath (),
4849 entityDir .toPath ());
4950
5051 File flowDir = Scaffolding .getFlowDir (pluginsDir , "my-fun-test" , "blah" , FlowType .INPUT );
5152 assertEquals (new File (
52- "./test-ye-plugins /entities/my-fun-test/input/blah" ).toPath (),
53+ pluginPath + " /entities/my-fun-test/input/blah" ).toPath (),
5354 flowDir .toPath ());
5455 assertFalse (flowDir .exists ());
5556 }
@@ -82,11 +83,11 @@ private void createInputFlow(PluginFormat pluginFormat, Format dataFormat) throw
8283
8384 File entityDir = Scaffolding .getEntityDir (pluginsDir , "my-fun-test" );
8485 assertTrue (entityDir .exists ());
85- assertEquals (new File ("./test-ye-plugins /entities/my-fun-test" ).toPath (), entityDir .toPath ());
86+ assertEquals (new File (pluginPath + " /entities/my-fun-test" ).toPath (), entityDir .toPath ());
8687
8788 Scaffolding .createFlow ("my-fun-test" , "test-input" , FlowType .INPUT , pluginFormat , dataFormat , pluginsDir );
8889 File flowDir = Scaffolding .getFlowDir (pluginsDir , "my-fun-test" , "test-input" , FlowType .INPUT );
89- assertEquals (new File ("./test-ye-plugins /entities/my-fun-test/input/test-input" ).toPath (), flowDir .toPath ());
90+ assertEquals (new File (pluginPath + " /entities/my-fun-test/input/test-input" ).toPath (), flowDir .toPath ());
9091 assertTrue (flowDir .exists ());
9192
9293 File flowDescriptor = new File (flowDir , "test-input.xml" );
@@ -121,11 +122,11 @@ private void createConformanceFlow(PluginFormat pluginFormat, Format dataFormat)
121122
122123 File entityDir = Scaffolding .getEntityDir (pluginsDir , "my-fun-test" );
123124 assertTrue (entityDir .exists ());
124- assertEquals (new File ("./test-ye-plugins /entities/my-fun-test" ).toPath (), entityDir .toPath ());
125+ assertEquals (new File (pluginPath + " /entities/my-fun-test" ).toPath (), entityDir .toPath ());
125126
126127 Scaffolding .createFlow ("my-fun-test" , "test-conformance" , FlowType .CONFORMANCE , pluginFormat , dataFormat , pluginsDir );
127128 File flowDir = Scaffolding .getFlowDir (pluginsDir , "my-fun-test" , "test-conformance" , FlowType .CONFORMANCE );
128- assertEquals (new File ("./test-ye-plugins /entities/my-fun-test/conformance/test-conformance" ).toPath (), flowDir .toPath ());
129+ assertEquals (new File (pluginPath + " /entities/my-fun-test/conformance/test-conformance" ).toPath (), flowDir .toPath ());
129130 assertTrue (flowDir .exists ());
130131
131132 File flowDescriptor = new File (flowDir , "test-conformance.xml" );
@@ -153,4 +154,72 @@ private void createConformanceFlow(PluginFormat pluginFormat, Format dataFormat)
153154 assertTrue (triplesDir .exists ());
154155 assertTrue (triplesContent .exists ());
155156 }
157+
158+ @ Test
159+ public void createXqyRestExtension () throws IOException {
160+ String entityName = "my-fun-test" ;
161+ String extensionName = "myExtension" ;
162+ FlowType flowType = FlowType .CONFORMANCE ;
163+ PluginFormat pluginFormat = PluginFormat .XQUERY ;
164+ Scaffolding .createRestExtension (entityName , extensionName , flowType , pluginFormat , pluginsDir );
165+ File restDir = new File (pluginsDir .getAbsolutePath () + "/entities/" + entityName + "/" + flowType .name () +"/REST" );
166+ assertTrue (restDir .exists ());
167+ File restServicesDir = new File (restDir , "services" );
168+ assertTrue (restServicesDir .exists ());
169+ File restExtensionFile = new File (restServicesDir , extensionName + "." + pluginFormat );
170+ assertTrue (restExtensionFile .exists ());
171+ File restExtensionMetadataDir = new File (restServicesDir , "metadata" );
172+ assertTrue (restExtensionMetadataDir .exists ());
173+ File restExtensionMetadataFile = new File (restExtensionMetadataDir , extensionName + ".xml" );
174+ assertTrue (restExtensionMetadataFile .exists ());
175+ }
176+
177+ @ Test
178+ public void createSjsRestExtension () throws IOException {
179+ String entityName = "my-fun-test" ;
180+ String extensionName = "myExtension" ;
181+ FlowType flowType = FlowType .INPUT ;
182+ PluginFormat pluginFormat = PluginFormat .JAVASCRIPT ;
183+ Scaffolding .createRestExtension (entityName , extensionName , flowType , pluginFormat , pluginsDir );
184+ File restDir = new File (pluginsDir .getAbsolutePath () + "/entities/" + entityName + "/" + flowType .name () +"/REST" );
185+ assertTrue (restDir .exists ());
186+ File restServicesDir = new File (restDir , "services" );
187+ assertTrue (restServicesDir .exists ());
188+ File restExtensionFile = new File (restServicesDir , extensionName + "." + pluginFormat );
189+ assertTrue (restExtensionFile .exists ());
190+ File restExtensionMetadataDir = new File (restServicesDir , "metadata" );
191+ assertTrue (restExtensionMetadataDir .exists ());
192+ File restExtensionMetadataFile = new File (restExtensionMetadataDir , extensionName + ".xml" );
193+ assertTrue (restExtensionMetadataFile .exists ());
194+ }
195+
196+ @ Test
197+ public void createXqyRestTransform () throws IOException {
198+ String entityName = "my-fun-test" ;
199+ String transformName = "myTransform" ;
200+ FlowType flowType = FlowType .CONFORMANCE ;
201+ PluginFormat pluginFormat = PluginFormat .XQUERY ;
202+ Scaffolding .createRestTransform (entityName , transformName , flowType , pluginFormat , pluginsDir );
203+ File restDir = new File (pluginsDir .getAbsolutePath () + "/entities/" + entityName + "/" + flowType .name () +"/REST" );
204+ assertTrue (restDir .exists ());
205+ File restTransformDir = new File (restDir , "transforms" );
206+ assertTrue (restTransformDir .exists ());
207+ File restTransformFile = new File (restTransformDir , transformName + "." + pluginFormat );
208+ assertTrue (restTransformFile .exists ());
209+ }
210+
211+ @ Test
212+ public void createSjsRestTransform () throws IOException {
213+ String entityName = "my-fun-test" ;
214+ String transformName = "myTransform" ;
215+ FlowType flowType = FlowType .CONFORMANCE ;
216+ PluginFormat pluginFormat = PluginFormat .JAVASCRIPT ;
217+ Scaffolding .createRestTransform (entityName , transformName , flowType , pluginFormat , pluginsDir );
218+ File restDir = new File (pluginsDir .getAbsolutePath () + "/entities/" + entityName + "/" + flowType .name () +"/REST" );
219+ assertTrue (restDir .exists ());
220+ File restTransformDir = new File (restDir , "transforms" );
221+ assertTrue (restTransformDir .exists ());
222+ File restTransformFile = new File (restTransformDir , transformName + "." + pluginFormat );
223+ assertTrue (restTransformFile .exists ());
224+ }
156225}
0 commit comments