diff --git a/.gradle/6.8/executionHistory/executionHistory.bin b/.gradle/6.8/executionHistory/executionHistory.bin index 487dde5f26e8bb40a6b744bb3242a6c3acbbfaea..0937b7d7a3574da085e6d34d8e4e27d6f6b6ffe2 100644 Binary files a/.gradle/6.8/executionHistory/executionHistory.bin and b/.gradle/6.8/executionHistory/executionHistory.bin differ diff --git a/.gradle/6.8/executionHistory/executionHistory.lock b/.gradle/6.8/executionHistory/executionHistory.lock index af20fcff714e2467307d839b3c2c52dfc001bd7d..b8d71ad805654f50c9d334ff24dbee081cf7033f 100644 Binary files a/.gradle/6.8/executionHistory/executionHistory.lock and b/.gradle/6.8/executionHistory/executionHistory.lock differ diff --git a/.gradle/6.8/fileHashes/fileHashes.bin b/.gradle/6.8/fileHashes/fileHashes.bin index 0b805cbed77abc540c4e9b217b1311d955d9e0a8..85b8fc04654f00a26803206273599d087eb2d69a 100644 Binary files a/.gradle/6.8/fileHashes/fileHashes.bin and b/.gradle/6.8/fileHashes/fileHashes.bin differ diff --git a/.gradle/6.8/fileHashes/fileHashes.lock b/.gradle/6.8/fileHashes/fileHashes.lock index 65526b12c90b649566a5068f2caa395cc21602d8..23e552ee05cfd42ba4cc5fbfb0107c0ea92b84e3 100644 Binary files a/.gradle/6.8/fileHashes/fileHashes.lock and b/.gradle/6.8/fileHashes/fileHashes.lock differ diff --git a/.gradle/6.8/javaCompile/javaCompile.lock b/.gradle/6.8/javaCompile/javaCompile.lock index d7dd07d50a31b9c8d34512e0c71ad22a0c94dae8..8a1f5a3c0a58a570da4a16b7728342f0336fcb62 100644 Binary files a/.gradle/6.8/javaCompile/javaCompile.lock and b/.gradle/6.8/javaCompile/javaCompile.lock differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 897f7f32e101ba5cc6967f9ccc13badb416e6cd9..5826910ca27d4367f3743d38a83a2fbdc433e681 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Get.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Get.class index 9d2bacd1f891187a0af801e0932ca1c4fca374b4..31a3f7f496d0fe035751c91e5eaaecf3138c0ef0 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Get.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Get.class differ diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ParameterObject.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ParameterObject.class index d209ac47e41fd62937a0040f26181c298509d2f5..8421cdbfb6bd301a48aebb478d678b7c72e7aa08 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ParameterObject.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/ParameterObject.class differ diff --git a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Post.class b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Post.class index e83ddc03f0e0e291c58555aaa90d0adc9057a1cd..432ef6692eb650ec486b487d6c41b5c0dc9829ef 100644 Binary files a/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Post.class and b/build/classes/java/main/de/tudresden/inf/st/openapi/ast/Post.class differ diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/Get.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/Get.java index aaf98c7d0f49ed4e100ca96a1474b8de5a5d16b5..8723817e7caa23b4e85b131655e72c4bef8521ef 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/Get.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/Get.java @@ -1,17 +1,21 @@ /* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.2 */ package de.tudresden.inf.st.openapi.ast; + import org.openapi4j.core.exception.ResolutionException; import org.openapi4j.core.validation.ValidationException; import org.openapi4j.parser.model.v3.*; import org.openapi4j.core.model.reference.Reference; import org.openapi4j.core.model.OAIContext; + import java.io.IOException; import java.util.*; import java.net.URL; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import org.openapi4j.core.exception.DecodeException; + import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; @@ -19,338 +23,359 @@ import java.net.HttpURLConnection; import javax.net.ssl.HttpsURLConnection; import java.util.Random; import java.util.stream.IntStream; + /** * @ast node * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\OpenAPISpecification.ast:43 * @astdecl Get : ASTNode ::= OperationObject; * @production Get : {@link ASTNode} ::= <span class="component">{@link OperationObject}</span>; - */ public class Get extends ASTNode<ASTNode> implements Cloneable { - /** - * @aspect InferParameter - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:159 - */ - public void connectGET(String path){ + /** + * @aspect InferParameter + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:147 + */ + public void connectGET(String path) { - try{URL url=new URL(path); - HttpsURLConnection con=(HttpsURLConnection)url.openConnection(); - con.setRequestProperty("User-Agent","Mozilla/5.0"); // add request header + try { + URL url = new URL(path); + HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); // add request header - con.setRequestMethod("GET"); // optional default is GET + con.setRequestMethod("GET"); // optional default is GET - int responseCode=con.getResponseCode(); - BufferedReader in=new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuffer response=new StringBuffer(); + int responseCode = con.getResponseCode(); + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); - while((inputLine=in.readLine())!=null){ - response.append(inputLine); - } - in.close(); + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); - // print result - System.out.println("Inferred path : "+path); - System.out.println("HTTP status code (GET) : "+responseCode);}catch(Exception e){ - System.out.println(e.toString()); - } + // print result + System.out.println("Inferred path : " + path); + System.out.println("HTTP status code (GET) : " + responseCode); + } catch (Exception e) { + System.out.println(e.toString()); } - /** - * @declaredat ASTNode:1 - */ - public Get() { - super(); - } - /** - * Initializes the child array to the correct size. - * Initializes List and Opt nta children. - * @apilevel internal - * @ast method - * @declaredat ASTNode:10 - */ - public void init$Children() { - children = new ASTNode[1]; - } - /** - * @declaredat ASTNode:13 - */ - @ASTNodeAnnotation.Constructor( - name = {"OperationObject"}, - type = {"OperationObject"}, - kind = {"Child"} - ) - public Get(OperationObject p0) { - setChild(p0, 0); - } - /** @apilevel low-level - * @declaredat ASTNode:22 - */ - protected int numChildren() { - return 1; - } - /** - * @apilevel internal - * @declaredat ASTNode:28 - */ - public boolean mayHaveRewrite() { - return false; - } - /** @apilevel internal - * @declaredat ASTNode:32 - */ - public void flushAttrCache() { - super.flushAttrCache(); - } - /** @apilevel internal - * @declaredat ASTNode:36 - */ - public void flushCollectionCache() { - super.flushCollectionCache(); - } - /** @apilevel internal - * @declaredat ASTNode:40 - */ - public Get clone() throws CloneNotSupportedException { - Get node = (Get) super.clone(); - return node; - } - /** @apilevel internal - * @declaredat ASTNode:45 - */ - public Get copy() { - try { - Get node = (Get) clone(); - node.parent = null; - if (children != null) { - node.children = (ASTNode[]) children.clone(); - } - return node; - } catch (CloneNotSupportedException e) { - throw new Error("Error: clone not supported for " + getClass().getName()); } - } - /** - * Create a deep copy of the AST subtree at this node. - * The copy is dangling, i.e. has no parent. - * @return dangling copy of the subtree at this node - * @apilevel low-level - * @deprecated Please use treeCopy or treeCopyNoTransform instead - * @declaredat ASTNode:64 - */ - @Deprecated - public Get fullCopy() { - return treeCopyNoTransform(); - } - /** - * Create a deep copy of the AST subtree at this node. - * The copy is dangling, i.e. has no parent. - * @return dangling copy of the subtree at this node - * @apilevel low-level - * @declaredat ASTNode:74 - */ - public Get treeCopyNoTransform() { - Get tree = (Get) copy(); - if (children != null) { - for (int i = 0; i < children.length; ++i) { - ASTNode child = (ASTNode) children[i]; - if (child != null) { - child = child.treeCopyNoTransform(); - tree.setChild(child, i); - } - } + + /** + * @declaredat ASTNode:1 + */ + public Get() { + super(); } - return tree; - } - /** - * Create a deep copy of the AST subtree at this node. - * The subtree of this node is traversed to trigger rewrites before copy. - * The copy is dangling, i.e. has no parent. - * @return dangling copy of the subtree at this node - * @apilevel low-level - * @declaredat ASTNode:94 - */ - public Get treeCopy() { - Get tree = (Get) copy(); - if (children != null) { - for (int i = 0; i < children.length; ++i) { - ASTNode child = (ASTNode) getChild(i); - if (child != null) { - child = child.treeCopy(); - tree.setChild(child, i); - } - } + + /** + * Initializes the child array to the correct size. + * Initializes List and Opt nta children. + * + * @apilevel internal + * @ast method + * @declaredat ASTNode:10 + */ + public void init$Children() { + children = new ASTNode[1]; } - return tree; - } - /** @apilevel internal - * @declaredat ASTNode:108 - */ - protected boolean is$Equal(ASTNode node) { - return super.is$Equal(node); - } - /** - * Replaces the OperationObject child. - * @param node The new node to replace the OperationObject child. - * @apilevel high-level - */ - public void setOperationObject(OperationObject node) { - setChild(node, 0); - } - /** - * Retrieves the OperationObject child. - * @return The current node used as the OperationObject child. - * @apilevel high-level - */ - @ASTNodeAnnotation.Child(name="OperationObject") - public OperationObject getOperationObject() { - return (OperationObject) getChild(0); - } - /** - * Retrieves the OperationObject child. - * <p><em>This method does not invoke AST transformations.</em></p> - * @return The current node used as the OperationObject child. - * @apilevel low-level - */ - public OperationObject getOperationObjectNoTransform() { - return (OperationObject) getChildNoTransform(0); - } -/** @apilevel internal */ -protected java.util.Set inferRandomUrl_String_OperationObject_visited; - /** - * @attribute syn - * @aspect InferParameter - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:38 - */ - @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) - @ASTNodeAnnotation.Source(aspect="InferParameter", declaredAt="E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:38") - public String inferRandomUrl(String pathRef, OperationObject operationObject) { - java.util.List _parameters = new java.util.ArrayList(2); - _parameters.add(pathRef); - _parameters.add(operationObject); - if (inferRandomUrl_String_OperationObject_visited == null) inferRandomUrl_String_OperationObject_visited = new java.util.HashSet(4); - if (inferRandomUrl_String_OperationObject_visited.contains(_parameters)) { - throw new RuntimeException("Circular definition of attribute Get.inferRandomUrl(String,OperationObject)."); + + /** + * @declaredat ASTNode:13 + */ + @ASTNodeAnnotation.Constructor( + name = {"OperationObject"}, + type = {"OperationObject"}, + kind = {"Child"} + ) + public Get(OperationObject p0) { + setChild(p0, 0); } - inferRandomUrl_String_OperationObject_visited.add(_parameters); - try { - List<String> paths=new ArrayList<>(); - - for(ParameterOb o:operationObject.getParameterObs()){ - ParameterObject p=o.parameterObject(); - SchemaObject s=p.getSchemaOb().schemaObject(); - - // check if the parameter is in type 'path'. - if(p.getIn().equals("path")){ - for(InferredParameter i:root().collectInferredParameters()){ - // get the field which must be modified - String pathPart=pathRef.substring(pathRef.indexOf("{"),pathRef.indexOf("}")+1); - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - paths.add(pathRef.replace(pathPart,i.value())); - } - } // check if the parameter is in type 'query' - else if(p.getIn().equals("query")){ - // check if query parameter is in type 'array' - if(s.getType().equals("array")){ - for(InferredParameter i:root().collectInferredParameters()){ - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - pathRef=pathRef+"&"+p.getName()+"="+i.value(); - } - paths.add(pathRef.replaceFirst("&","?")); - }else{ - for(InferredParameter i:root().collectInferredParameters()){ - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - paths.add(pathRef+"?"+p.getName()+"="+i.value()); + + /** + * @apilevel low-level + * @declaredat ASTNode:22 + */ + protected int numChildren() { + return 1; + } + + /** + * @apilevel internal + * @declaredat ASTNode:28 + */ + public boolean mayHaveRewrite() { + return false; + } + + /** + * @apilevel internal + * @declaredat ASTNode:32 + */ + public void flushAttrCache() { + super.flushAttrCache(); + } + + /** + * @apilevel internal + * @declaredat ASTNode:36 + */ + public void flushCollectionCache() { + super.flushCollectionCache(); + } + + /** + * @apilevel internal + * @declaredat ASTNode:40 + */ + public Get clone() throws CloneNotSupportedException { + Get node = (Get) super.clone(); + return node; + } + + /** + * @apilevel internal + * @declaredat ASTNode:45 + */ + public Get copy() { + try { + Get node = (Get) clone(); + node.parent = null; + if (children != null) { + node.children = (ASTNode[]) children.clone(); } + return node; + } catch (CloneNotSupportedException e) { + throw new Error("Error: clone not supported for " + getClass().getName()); + } + } + + /** + * Create a deep copy of the AST subtree at this node. + * The copy is dangling, i.e. has no parent. + * + * @return dangling copy of the subtree at this node + * @apilevel low-level + * @declaredat ASTNode:64 + * @deprecated Please use treeCopy or treeCopyNoTransform instead + */ + @Deprecated + public Get fullCopy() { + return treeCopyNoTransform(); + } + + /** + * Create a deep copy of the AST subtree at this node. + * The copy is dangling, i.e. has no parent. + * + * @return dangling copy of the subtree at this node + * @apilevel low-level + * @declaredat ASTNode:74 + */ + public Get treeCopyNoTransform() { + Get tree = (Get) copy(); + if (children != null) { + for (int i = 0; i < children.length; ++i) { + ASTNode child = (ASTNode) children[i]; + if (child != null) { + child = child.treeCopyNoTransform(); + tree.setChild(child, i); + } } + } + return tree; + } + + /** + * Create a deep copy of the AST subtree at this node. + * The subtree of this node is traversed to trigger rewrites before copy. + * The copy is dangling, i.e. has no parent. + * + * @return dangling copy of the subtree at this node + * @apilevel low-level + * @declaredat ASTNode:94 + */ + public Get treeCopy() { + Get tree = (Get) copy(); + if (children != null) { + for (int i = 0; i < children.length; ++i) { + ASTNode child = (ASTNode) getChild(i); + if (child != null) { + child = child.treeCopy(); + tree.setChild(child, i); + } } - System.out.println(paths.size()+" Paths are inferred."); + } + return tree; + } + + /** + * @apilevel internal + * @declaredat ASTNode:108 + */ + protected boolean is$Equal(ASTNode node) { + return super.is$Equal(node); + } + + /** + * Replaces the OperationObject child. + * + * @param node The new node to replace the OperationObject child. + * @apilevel high-level + */ + public void setOperationObject(OperationObject node) { + setChild(node, 0); + } + + /** + * Retrieves the OperationObject child. + * + * @return The current node used as the OperationObject child. + * @apilevel high-level + */ + @ASTNodeAnnotation.Child(name = "OperationObject") + public OperationObject getOperationObject() { + return (OperationObject) getChild(0); + } + + /** + * Retrieves the OperationObject child. + * <p><em>This method does not invoke AST transformations.</em></p> + * + * @return The current node used as the OperationObject child. + * @apilevel low-level + */ + public OperationObject getOperationObjectNoTransform() { + return (OperationObject) getChildNoTransform(0); + } + + /** + * @apilevel internal + */ + protected java.util.Set inferRandomUrl_String_OperationObject_visited; + + /** + * @attribute syn + * @aspect InferParameter + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:38 + */ + @ASTNodeAnnotation.Attribute(kind = ASTNodeAnnotation.Kind.SYN) + @ASTNodeAnnotation.Source(aspect = "InferParameter", declaredAt = "E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:38") + public String inferRandomUrl(String pathRef, OperationObject operationObject) { + java.util.List _parameters = new java.util.ArrayList(2); + _parameters.add(pathRef); + _parameters.add(operationObject); + if (inferRandomUrl_String_OperationObject_visited == null) + inferRandomUrl_String_OperationObject_visited = new java.util.HashSet(4); + if (inferRandomUrl_String_OperationObject_visited.contains(_parameters)) { + throw new RuntimeException("Circular definition of attribute Get.inferRandomUrl(String,OperationObject)."); + } + inferRandomUrl_String_OperationObject_visited.add(_parameters); + try { + List<String> paths = new ArrayList<>(); + + for (ParameterOb o : operationObject.getParameterObs()) { + ParameterObject p = o.parameterObject(); + SchemaObject s = p.getSchemaOb().schemaObject(); + + // check if the parameter is in type 'path'. + if (p.getIn().equals("path")) + paths = p.addinfPathParameters(pathRef, paths); + // check if the parameter is in type 'query' + else if (p.getIn().equals("query")) + paths = p.addinfQueryParameters(pathRef, paths); + + System.out.println(paths.size() + " Paths are inferred."); } - for(String path:paths) - connectGET(path); + for (String path : paths) + connectGET(path); return pathRef; + } finally { + inferRandomUrl_String_OperationObject_visited.remove(_parameters); + } + } + + /** + * @apilevel internal + */ + protected java.util.Set generateRandomUrl_String_visited; + + /** + * @attribute syn + * @aspect RandomRequestGenerator + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\RandomRequestGenerator.jrag:74 + */ + @ASTNodeAnnotation.Attribute(kind = ASTNodeAnnotation.Kind.SYN) + @ASTNodeAnnotation.Source(aspect = "RandomRequestGenerator", declaredAt = "E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\RandomRequestGenerator.jrag:74") + public boolean generateRandomUrl(String pathRef) { + Object _parameters = pathRef; + if (generateRandomUrl_String_visited == null) generateRandomUrl_String_visited = new java.util.HashSet(4); + if (generateRandomUrl_String_visited.contains(_parameters)) { + throw new RuntimeException("Circular definition of attribute Get.generateRandomUrl(String)."); + } + generateRandomUrl_String_visited.add(_parameters); + try { + try { + for (ParameterOb o : getOperationObject().getParameterObs()) { + ParameterObject p = o.parameterObject(); + if (p.getIn().equals("path")) + pathRef = p.randomPathParameter(pathRef); + else if (p.getIn().equals("query")) + pathRef = p.randomQueryParameter(pathRef); + } + System.out.println("Generated path : " + pathRef); + + URL url = new URL(pathRef); + HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); + con.setRequestProperty("User-Agent", "Mozilla/5.0"); // add request header + + con.setRequestMethod("GET"); // optional default is GET + + int responseCode = con.getResponseCode(); + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + // print result + System.out.println("HTTP status code (GET) : " + responseCode); + //System.out.println("Response : " + response.toString()); + for (ResponseTuple t : getOperationObject().getResponseTuples()) { + if (t.getKey().equals("200") && responseCode == 200) { + //System.out.println("Response successfully saved!"); + SchemaOb respSchema = t.getResponseOb().responseObject().getContentTuple(0).getMediaTypeObject().getSchemaOb(); + if (respSchema.schemaObject().getType().equals("array")) + getOperationObject().writeDictionaryWithArray(respSchema, response.toString()); + else + getOperationObject().writeDictionary(respSchema, response.toString()); + } + } + return true; + } catch (Exception e) { + System.out.println(e.toString()); + return false; } - finally { - inferRandomUrl_String_OperationObject_visited.remove(_parameters); + } finally { + generateRandomUrl_String_visited.remove(_parameters); + } } - } -/** @apilevel internal */ -protected java.util.Set generateRandomUrl_String_visited; - /** - * @attribute syn - * @aspect RandomRequestGenerator - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\RandomRequestGenerator.jrag:74 - */ - @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) - @ASTNodeAnnotation.Source(aspect="RandomRequestGenerator", declaredAt="E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\RandomRequestGenerator.jrag:74") - public boolean generateRandomUrl(String pathRef) { - Object _parameters = pathRef; - if (generateRandomUrl_String_visited == null) generateRandomUrl_String_visited = new java.util.HashSet(4); - if (generateRandomUrl_String_visited.contains(_parameters)) { - throw new RuntimeException("Circular definition of attribute Get.generateRandomUrl(String)."); + + /** + * @apilevel internal + */ + public ASTNode rewriteTo() { + return super.rewriteTo(); } - generateRandomUrl_String_visited.add(_parameters); - try { - try{ - for(ParameterOb o:getOperationObject().getParameterObs()){ - ParameterObject p=o.parameterObject(); - if(p.getIn().equals("path")) - pathRef=p.randomPathParameter(pathRef); - else if(p.getIn().equals("query")) - pathRef=p.randomQueryParameter(pathRef); - } - System.out.println("Generated path : "+pathRef); - - URL url=new URL(pathRef); - HttpsURLConnection con=(HttpsURLConnection)url.openConnection(); - con.setRequestProperty("User-Agent","Mozilla/5.0"); // add request header - - con.setRequestMethod("GET"); // optional default is GET - - int responseCode=con.getResponseCode(); - BufferedReader in=new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuffer response=new StringBuffer(); - - while((inputLine=in.readLine())!=null){ - response.append(inputLine); - } - in.close(); - - // print result - System.out.println("HTTP status code (GET) : "+responseCode); - //System.out.println("Response : " + response.toString()); - for(ResponseTuple t:getOperationObject().getResponseTuples()){ - if(t.getKey().equals("200")&&responseCode==200){ - //System.out.println("Response successfully saved!"); - SchemaOb respSchema=t.getResponseOb().responseObject().getContentTuple(0).getMediaTypeObject().getSchemaOb(); - if(respSchema.schemaObject().getType().equals("array")) - getOperationObject().writeDictionaryWithArray(respSchema,response.toString()); - else - getOperationObject().writeDictionary(respSchema,response.toString()); - } - } - return true; - }catch(Exception e){ - System.out.println(e.toString()); - return false; - } - } - finally { - generateRandomUrl_String_visited.remove(_parameters); + + /** + * @apilevel internal + */ + public boolean canRewrite() { + return false; } - } - /** @apilevel internal */ - public ASTNode rewriteTo() { - return super.rewriteTo(); - } - /** @apilevel internal */ - public boolean canRewrite() { - return false; - } } diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java index 18b4b438670e974da6fb831847e84d0f1f2f5906..f7172fd975b8237bda75847949e73a2cb5bb8b5d 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/OperationObject.java @@ -85,33 +85,33 @@ public class OperationObject extends ASTNode<ASTNode> implements Cloneable { } /** * @aspect InferParameter - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:126 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:114 */ public void writeDictionary(SchemaOb schema,String resp)throws Exception{ - ObjectMapper mapper = new ObjectMapper(); - JsonNode respNode = mapper.readTree(resp); + ObjectMapper mapper=new ObjectMapper(); + JsonNode respNode=mapper.readTree(resp); String value; - if (schema instanceof SchemaReference) { - for (PropertyItem p : schema.schemaObject().getPropertyItems()) { - String infName = p.writePropertyName(schema, p); - value = p.writePropertyValue(respNode, p); + if(schema instanceof SchemaReference){ + for(PropertyItem p:schema.schemaObject().getPropertyItems()){ + String infName=p.writePropertyName(schema,p); + value=p.writePropertyValue(respNode,p); - root().addInferredParameter(new InferredParameter(infName + "?" + value)); - root().addInferredParameter(new InferredParameter(p.getName() + "?" + value)); + root().addInferredParameter(new InferredParameter(infName+"?"+value)); + root().addInferredParameter(new InferredParameter(p.getName()+"?"+value)); } - } else { - for (PropertyItem p : schema.schemaObject().getPropertyItems()) { - value = p.writePropertyValue(respNode, p); + }else{ + for(PropertyItem p:schema.schemaObject().getPropertyItems()){ + value=p.writePropertyValue(respNode,p); - root().addInferredParameter(new InferredParameter(p.getName() + "?" + respNode.get(p.getName()).textValue())); + root().addInferredParameter(new InferredParameter(p.getName()+"?"+respNode.get(p.getName()).textValue())); } } } /** * @aspect InferParameter - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:149 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:137 */ public void writeDictionaryWithArray(SchemaOb schema,String resp)throws Exception{ ObjectMapper mapper=new ObjectMapper(); diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java index fabf01fd3e7367547a5094665c6f765823013a8d..c1a73e81db54a2d5e7184448b5b081e9c9446a33 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/ParameterObject.java @@ -828,6 +828,82 @@ protected java.util.Set composeParameter_ParameterOb_Map_Object__ASTNode__visite } } /** @apilevel internal */ +protected java.util.Set addinfPathParameters_String_List_String__visited; + /** + * @attribute syn + * @aspect InferParameter + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:80 + */ + @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) + @ASTNodeAnnotation.Source(aspect="InferParameter", declaredAt="E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:80") + public List<String> addinfPathParameters(String pathRef, List<String> paths) { + java.util.List _parameters = new java.util.ArrayList(2); + _parameters.add(pathRef); + _parameters.add(paths); + if (addinfPathParameters_String_List_String__visited == null) addinfPathParameters_String_List_String__visited = new java.util.HashSet(4); + if (addinfPathParameters_String_List_String__visited.contains(_parameters)) { + throw new RuntimeException("Circular definition of attribute ParameterObject.addinfPathParameters(String,List_String_)."); + } + addinfPathParameters_String_List_String__visited.add(_parameters); + try { + for(InferredParameter i:root().collectInferredParameters()){ + // get the field which must be modified + String pathPart=pathRef.substring(pathRef.indexOf("{"),pathRef.indexOf("}")+1); + // case insensitive comparison of parameter name and name of inferred parameters + if(getName().equalsIgnoreCase(i.name())) + // add inferred parameter in url + paths.add(pathRef.replace(pathPart,i.value())); + } + return paths; + } + finally { + addinfPathParameters_String_List_String__visited.remove(_parameters); + } + } +/** @apilevel internal */ +protected java.util.Set addinfQueryParameters_String_List_String__visited; + /** + * @attribute syn + * @aspect InferParameter + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:92 + */ + @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) + @ASTNodeAnnotation.Source(aspect="InferParameter", declaredAt="E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:92") + public List<String> addinfQueryParameters(String pathRef, List<String> paths) { + java.util.List _parameters = new java.util.ArrayList(2); + _parameters.add(pathRef); + _parameters.add(paths); + if (addinfQueryParameters_String_List_String__visited == null) addinfQueryParameters_String_List_String__visited = new java.util.HashSet(4); + if (addinfQueryParameters_String_List_String__visited.contains(_parameters)) { + throw new RuntimeException("Circular definition of attribute ParameterObject.addinfQueryParameters(String,List_String_)."); + } + addinfQueryParameters_String_List_String__visited.add(_parameters); + try { + SchemaObject s=getSchemaOb().schemaObject(); + // check if query parameter is in type 'array' + if(s.getType().equals("array")){ + for(InferredParameter i:root().collectInferredParameters()){ + // case insensitive comparison of parameter name and name of inferred parameters + if(getName().equalsIgnoreCase(i.name())) + // add inferred parameter in url + pathRef=pathRef+"&"+getName()+"="+i.value(); + } + paths.add(pathRef.replaceFirst("&","?")); + }else{ + for(InferredParameter i:root().collectInferredParameters()){ + // case insensitive comparison of parameter name and name of inferred parameters + if(getName().equalsIgnoreCase(i.name())) + // add inferred parameter in url + paths.add(pathRef+"?"+getName()+"="+i.value()); + } + } + return paths; + } + finally { + addinfQueryParameters_String_List_String__visited.remove(_parameters); + } + } +/** @apilevel internal */ protected java.util.Set randomPathParameter_String_visited; /** * @attribute syn diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/Post.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/Post.java index faeef69f3d843492e84cddbe8d9152d1e2a004c6..f9d2472460fdb48f7b159c7e161ebd34735521d9 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/Post.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/Post.java @@ -29,7 +29,7 @@ import java.util.stream.IntStream; public class Post extends ASTNode<ASTNode> implements Cloneable { /** * @aspect InferParameter - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:184 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:172 */ public void connectPOST(String path){ try{URL url=new URL(path); @@ -219,10 +219,10 @@ protected java.util.Set inferRandomUrl_String_OperationObject_visited; /** * @attribute syn * @aspect InferParameter - * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:82 + * @declaredat E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:59 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) - @ASTNodeAnnotation.Source(aspect="InferParameter", declaredAt="E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:82") + @ASTNodeAnnotation.Source(aspect="InferParameter", declaredAt="E:\\bachelor-thesis\\SigTest\\bachelor-thesis-jastadd\\src\\main\\jastadd\\InferParameter.jrag:59") public String inferRandomUrl(String pathRef, OperationObject operationObject) { java.util.List _parameters = new java.util.ArrayList(2); _parameters.add(pathRef); @@ -240,35 +240,12 @@ protected java.util.Set inferRandomUrl_String_OperationObject_visited; SchemaObject s=p.getSchemaOb().schemaObject(); // check if the parameter is in type 'path'. - if(p.getIn().equals("path")){ - for(InferredParameter i:root().collectInferredParameters()){ - // get the field which must be modified - String pathPart=pathRef.substring(pathRef.indexOf("{"),pathRef.indexOf("}")+1); - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - paths.add(pathRef.replace(pathPart,i.value())); - } - } // check if the parameter is in type 'query' - else if(p.getIn().equals("query")){ - // check if query parameter is in type 'array' - if(s.getType().equals("array")){ - for(InferredParameter i:root().collectInferredParameters()){ - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - pathRef=pathRef+"&"+p.getName()+"="+i.value(); - } - paths.add(pathRef.replaceFirst("&","?")); - }else{ - for(InferredParameter i:root().collectInferredParameters()){ - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - paths.add(pathRef+"?"+p.getName()+"="+i.value()); - } - } - } + if(p.getIn().equals("path")) + paths=p.addinfPathParameters(pathRef,paths); + // check if the parameter is in type 'query' + else if(p.getIn().equals("query")) + paths=p.addinfQueryParameters(pathRef,paths); + System.out.println(paths.size()+" Paths are inferred."); } for(String path:paths) diff --git a/src/gen/java/de/tudresden/inf/st/openapi/ast/PropertyItem.java b/src/gen/java/de/tudresden/inf/st/openapi/ast/PropertyItem.java index 46e31fa9b1ec6e40048e6ed4e845c31a91164048..126ca8a753838b349ef1d37848d5adc7955b4a55 100644 --- a/src/gen/java/de/tudresden/inf/st/openapi/ast/PropertyItem.java +++ b/src/gen/java/de/tudresden/inf/st/openapi/ast/PropertyItem.java @@ -225,7 +225,7 @@ protected java.util.Set writePropertyName_SchemaOb_PropertyItem_visited; throw new RuntimeException("Circular definition of attribute PropertyItem.writePropertyName(SchemaOb,PropertyItem)."); } writePropertyName_SchemaOb_PropertyItem_visited.add(_parameters); - String writePropertyName_SchemaOb_PropertyItem_value = ((SchemaReference) schema).getRef().substring(((SchemaReference) schema).getRef().lastIndexOf("/") + 1) + p.getName(); + String writePropertyName_SchemaOb_PropertyItem_value = ((SchemaReference)schema).getRef().substring(((SchemaReference)schema).getRef().lastIndexOf("/")+1)+p.getName(); writePropertyName_SchemaOb_PropertyItem_visited.remove(_parameters); return writePropertyName_SchemaOb_PropertyItem_value; } @@ -247,7 +247,7 @@ protected java.util.Set writePropertyValue_JsonNode_PropertyItem_visited; throw new RuntimeException("Circular definition of attribute PropertyItem.writePropertyValue(JsonNode,PropertyItem)."); } writePropertyValue_JsonNode_PropertyItem_visited.add(_parameters); - String writePropertyValue_JsonNode_PropertyItem_value = node.get(p.getName()).toString().startsWith("\"") && node.get(p.getName()).toString().endsWith("\"") ? node.get(p.getName()).toString().substring(1, node.get(p.getName()).toString().length() - 1) : node.get(p.getName()).toString(); + String writePropertyValue_JsonNode_PropertyItem_value = node.get(p.getName()).toString().startsWith("\"")&&node.get(p.getName()).toString().endsWith("\"")?node.get(p.getName()).toString().substring(1,node.get(p.getName()).toString().length()-1):node.get(p.getName()).toString(); writePropertyValue_JsonNode_PropertyItem_visited.remove(_parameters); return writePropertyValue_JsonNode_PropertyItem_value; } diff --git a/src/main/jastadd/InferParameter.jrag b/src/main/jastadd/InferParameter.jrag index 86d7944031e73957f7710ddb3de010fd561aabbc..c0f1850bd781a76c259b8e343f9f27d0d010651e 100644 --- a/src/main/jastadd/InferParameter.jrag +++ b/src/main/jastadd/InferParameter.jrag @@ -3,13 +3,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; aspect InferParameter{ - syn String PropertyItem.writePropertyName(SchemaOb schema, PropertyItem p) = ((SchemaReference) schema).getRef().substring(((SchemaReference) schema).getRef().lastIndexOf("/") + 1) + p.getName(); + syn String PropertyItem.writePropertyName(SchemaOb schema,PropertyItem p)=((SchemaReference)schema).getRef().substring(((SchemaReference)schema).getRef().lastIndexOf("/")+1)+p.getName(); - syn String PropertyItem.writePropertyValue(JsonNode node, PropertyItem p) = node.get(p.getName()).toString().startsWith("\"") && node.get(p.getName()).toString().endsWith("\"") ? node.get(p.getName()).toString().substring(1, node.get(p.getName()).toString().length() - 1) : node.get(p.getName()).toString(); + syn String PropertyItem.writePropertyValue(JsonNode node,PropertyItem p)=node.get(p.getName()).toString().startsWith("\"")&&node.get(p.getName()).toString().endsWith("\"")?node.get(p.getName()).toString().substring(1,node.get(p.getName()).toString().length()-1):node.get(p.getName()).toString(); coll Set<InferredParameter> OpenAPIObject.collectInferredParameters()[new HashSet<InferredParameter>()]; InferredParameter contributes this to OpenAPIObject.collectInferredParameters(); + syn String InferredParameter.name()=getParameter().substring(0,getParameter().indexOf("?")); syn String InferredParameter.value()=getParameter().substring(getParameter().indexOf("?")+1); @@ -19,20 +20,20 @@ public void OpenAPIObject.generateRequestsWithInferredParameters()throws Excepti generateRequests(); for(PathsObject p:getPathsObjects()) - p.inferUrl(urls); + p.inferUrl(); } - inh Set<String> PathsObject.inferUrl(Set<String> urls); - eq OpenAPIObject.getPathsObject(int i).inferUrl(Set<String> urls){ + inh boolean PathsObject.inferUrl(); + eq OpenAPIObject.getPathsObject(int i).inferUrl(){ PathItemObject p=getPathsObject(i).getPathItemObject(); String path=getServerObject(0).getUrl(); if(p.hasGet()) - urls.add(p.getGet().inferRandomUrl(path+getPathsObject(i).getRef(),p.getGet().getOperationObject())); + p.getGet().inferRandomUrl(path+getPathsObject(i).getRef(),p.getGet().getOperationObject()); else if(p.hasPost()) - urls.add(p.getPost().inferRandomUrl(path+getPathsObject(i).getRef(),p.getPost().getOperationObject())); + p.getPost().inferRandomUrl(path+getPathsObject(i).getRef(),p.getPost().getOperationObject()); - return urls; + return true; } syn String Get.inferRandomUrl(String pathRef,OperationObject operationObject){ @@ -43,35 +44,12 @@ public void OpenAPIObject.generateRequestsWithInferredParameters()throws Excepti SchemaObject s=p.getSchemaOb().schemaObject(); // check if the parameter is in type 'path'. - if(p.getIn().equals("path")){ - for(InferredParameter i:root().collectInferredParameters()){ - // get the field which must be modified - String pathPart=pathRef.substring(pathRef.indexOf("{"),pathRef.indexOf("}")+1); - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - paths.add(pathRef.replace(pathPart,i.value())); - } - } // check if the parameter is in type 'query' - else if(p.getIn().equals("query")){ - // check if query parameter is in type 'array' - if(s.getType().equals("array")){ - for(InferredParameter i:root().collectInferredParameters()){ - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - pathRef=pathRef+"&"+p.getName()+"="+i.value(); - } - paths.add(pathRef.replaceFirst("&","?")); - }else{ - for(InferredParameter i:root().collectInferredParameters()){ - // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) - // add inferred parameter in url - paths.add(pathRef+"?"+p.getName()+"="+i.value()); - } - } - } + if(p.getIn().equals("path")) + paths=p.addinfPathParameters(pathRef,paths); + // check if the parameter is in type 'query' + else if(p.getIn().equals("query")) + paths=p.addinfQueryParameters(pathRef,paths); + System.out.println(paths.size()+" Paths are inferred."); } for(String path:paths) @@ -87,60 +65,71 @@ public void OpenAPIObject.generateRequestsWithInferredParameters()throws Excepti SchemaObject s=p.getSchemaOb().schemaObject(); // check if the parameter is in type 'path'. - if(p.getIn().equals("path")){ + if(p.getIn().equals("path")) + paths=p.addinfPathParameters(pathRef,paths); + // check if the parameter is in type 'query' + else if(p.getIn().equals("query")) + paths=p.addinfQueryParameters(pathRef,paths); + + System.out.println(paths.size()+" Paths are inferred."); + } + for(String path:paths) + connectPOST(path); + return pathRef; + } + + syn List<String> ParameterObject.addinfPathParameters(String pathRef,List<String> paths){ for(InferredParameter i:root().collectInferredParameters()){ // get the field which must be modified String pathPart=pathRef.substring(pathRef.indexOf("{"),pathRef.indexOf("}")+1); // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) + if(getName().equalsIgnoreCase(i.name())) // add inferred parameter in url paths.add(pathRef.replace(pathPart,i.value())); } - } // check if the parameter is in type 'query' - else if(p.getIn().equals("query")){ + return paths; + } + + syn List<String> ParameterObject.addinfQueryParameters(String pathRef,List<String> paths){ + SchemaObject s=getSchemaOb().schemaObject(); // check if query parameter is in type 'array' if(s.getType().equals("array")){ for(InferredParameter i:root().collectInferredParameters()){ // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) + if(getName().equalsIgnoreCase(i.name())) // add inferred parameter in url - pathRef=pathRef+"&"+p.getName()+"="+i.value(); + pathRef=pathRef+"&"+getName()+"="+i.value(); } paths.add(pathRef.replaceFirst("&","?")); }else{ for(InferredParameter i:root().collectInferredParameters()){ // case insensitive comparison of parameter name and name of inferred parameters - if(p.getName().equalsIgnoreCase(i.name())) + if(getName().equalsIgnoreCase(i.name())) // add inferred parameter in url - paths.add(pathRef+"?"+p.getName()+"="+i.value()); - } + paths.add(pathRef+"?"+getName()+"="+i.value()); } } - System.out.println(paths.size()+" Paths are inferred."); - } - for(String path:paths) - connectPOST(path); - return pathRef; + return paths; } public void OperationObject.writeDictionary(SchemaOb schema,String resp)throws Exception{ - ObjectMapper mapper = new ObjectMapper(); - JsonNode respNode = mapper.readTree(resp); + ObjectMapper mapper=new ObjectMapper(); + JsonNode respNode=mapper.readTree(resp); String value; - if (schema instanceof SchemaReference) { - for (PropertyItem p : schema.schemaObject().getPropertyItems()) { - String infName = p.writePropertyName(schema, p); - value = p.writePropertyValue(respNode, p); + if(schema instanceof SchemaReference){ + for(PropertyItem p:schema.schemaObject().getPropertyItems()){ + String infName=p.writePropertyName(schema,p); + value=p.writePropertyValue(respNode,p); - root().addInferredParameter(new InferredParameter(infName + "?" + value)); - root().addInferredParameter(new InferredParameter(p.getName() + "?" + value)); + root().addInferredParameter(new InferredParameter(infName+"?"+value)); + root().addInferredParameter(new InferredParameter(p.getName()+"?"+value)); } - } else { - for (PropertyItem p : schema.schemaObject().getPropertyItems()) { - value = p.writePropertyValue(respNode, p); + }else{ + for(PropertyItem p:schema.schemaObject().getPropertyItems()){ + value=p.writePropertyValue(respNode,p); - root().addInferredParameter(new InferredParameter(p.getName() + "?" + respNode.get(p.getName()).textValue())); + root().addInferredParameter(new InferredParameter(p.getName()+"?"+respNode.get(p.getName()).textValue())); } } diff --git a/src/main/jastadd/RandomRequestGenerator.jrag b/src/main/jastadd/RandomRequestGenerator.jrag index c0004f5596507ed6e34c72178175aa7ced32d6df..52940edfd8c21121a1cbfcd64e2fd43660e0956a 100644 --- a/src/main/jastadd/RandomRequestGenerator.jrag +++ b/src/main/jastadd/RandomRequestGenerator.jrag @@ -50,9 +50,12 @@ aspect RandomRequestGenerator{ return pathRef; } -public void OpenAPIObject.generateRequests()throws Exception{ +syn boolean OpenAPIObject.generateRequests(){ + try{ for(PathsObject p:getPathsObjects()) - p.generateUrl(); + p.generateUrl();} catch (Exception e) { + return false; + } } inh boolean PathsObject.generateUrl();