diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java index 5f97d07..4867382 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Account.java @@ -3,16 +3,16 @@ public class Account { private Map notifications; public Map getValue() { - Map temp_nil3 = new HashMap<>(); - temp_nil3.put("notifications",this.getNotifications()); - return temp_nil3; - } - public Map getNotifications() { - return notifications; + Map temp_nil1 = new HashMap<>(); + temp_nil1.put("notifications",this.getNotifications()); + return temp_nil1; } public void updateNotificationsFromMessages(String self, String gid, int mno, List messages, String member) { this.notifications.put(gid,true); } + public Map getNotifications() { + return this.notifications; + } public void hasRead(String aid, String gid) { this.notifications.remove(gid); } diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java index c18d220..30519de 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Accounts.java @@ -1,7 +1,7 @@ import java.util.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.JsonProcessingException; @@ -13,35 +13,35 @@ @Produces(MediaType.APPLICATION_JSON) @GET public Map getValue() { - return new HashMap<>(value); + return new HashMap<>(this.value); } public Account getAccount(String v1) { return this.value.get(v1); } - @Path("accounts/{v1}/notifications") - @POST - public void updateNotificationsFromMessages(@PathParam("v1") String v1, @FormParam("gid") String gid, @FormParam("mno") int mno, @FormParam("messages") List messages, @FormParam("member") String member) { - getAccount(v1).updateNotificationsFromMessages(v1, gid, mno, messages, member); - } @Path("/{v1}") @Produces(MediaType.APPLICATION_JSON) @GET public Map getAccountValue(@PathParam("v1") String v1) { return getAccount(v1).getValue(); } - @Path("/{aid}/notifications") + @Path("/{v1}/notifications") + @POST + public void updateNotificationsFromMessages(@PathParam("v1") String v1, @FormParam("gid") String gid, @FormParam("mno") int mno, @FormParam("messages") List messages, @FormParam("member") String member) { + getAccount(v1).updateNotificationsFromMessages(v1, gid, mno, messages, member); + } + @Path("/{v1}/notifications") @Produces(MediaType.APPLICATION_JSON) @GET - public Map getNotificationsValue(@PathParam("aid") String aid) { - return getAccount(aid).getNotifications(); - } - @POST - public void signUp(@FormParam("aid") String aid) { - this.value.put(aid,new Account(new HashMap<>())); + public Map getNotificationsValue(@PathParam("v1") String v1) { + return getAccount(v1).getNotifications(); } @Path("/{aid}/notifications") @DELETE public void hasRead(@PathParam("aid") String aid, @FormParam("gid") String gid) { getAccount(aid).hasRead(aid, gid); } + @POST + public void signUp(@FormParam("aid") String aid) { + this.value.put(aid,new Account(new HashMap<>())); + } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java index bb06954..6d15fd7 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Group.java @@ -1,39 +1,38 @@ import java.util.*; -import javax.ws.rs.client.*; public class Group { - private List members; - private List messages; private Client client = ClientBuilder.newClient(); + private List messages; + private List members; public Map getValue() { - Map temp_nil2 = new HashMap<>(); - temp_nil2.put("members",this.getMembers()); - temp_nil2.put("messages",this.getMessages()); - return temp_nil2; - } - public List getMembers() { - return this.members; - } - public String getMember(int mno) { - return this.members.get(mno); + Map temp_nil0 = new HashMap<>(); + temp_nil0.put("members",this.getMembers()); + temp_nil0.put("messages",this.getMessages()); + return temp_nil0; } public List getMessages() { return this.messages; } - public void postMessage(String gid, String message) throws JsonProcessingException { + public void postMessage(String gid, String message) { + this.messages.add(message); for (int mno = 0; mno < members.size(); mno++) { String member = getMember(mno); Form form = new Form(); form.param("gid", gid.toString()); form.param("mno", Integer.toString(mno)); - for (String i: messages) { + for (String i: this.messages) { form.param("messages", i.toString()); } form.param("member", member.toString()); Entity
entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); String result = client.target("http://localhost:8080").path("/accounts/"+member+"/notifications").request().post(entity, String.class); } - this.messages.add(message); + } + public String getMember(int mno) { + return this.members.get(mno); + } + public List getMembers() { + return this.members; } public void addGroupMember(String gid, String aid) { this.members.add(aid); diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java index 19b1f42..e6f2b90 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/GroupChat/Groups.java @@ -1,7 +1,7 @@ import java.util.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.JsonProcessingException; @@ -13,7 +13,7 @@ @Produces(MediaType.APPLICATION_JSON) @GET public Map getValue() { - return new HashMap<>(value); + return new HashMap<>(this.value); } public Group getGroup(String gid) { return this.value.get(gid); @@ -24,36 +24,36 @@ public Map getGroupValue(@PathParam("gid") String gid) { return getGroup(gid).getValue(); } - @Path("/{gid}/members") - @Produces(MediaType.APPLICATION_JSON) - @GET - public List getMembersValue(@PathParam("gid") String gid) { - return getGroup(gid).getMembers(); - } @Path("/{gid}/messages") @Produces(MediaType.APPLICATION_JSON) @GET public List getMessagesValue(@PathParam("gid") String gid) { return getGroup(gid).getMessages(); } + @Path("/{gid}/messages") + @POST + public void postMessage(@PathParam("gid") String gid, @FormParam("message") String message) { + getGroup(gid).postMessage(gid, message); + } @Path("/{gid}/members/{mno}") @Produces(MediaType.APPLICATION_JSON) @GET public String getMemberValue(@PathParam("gid") String gid, @PathParam("mno") int mno) { return getGroup(gid).getMember(mno); } + @POST + public void createGroup(@FormParam("gid") String gid) { + this.value.put(gid,new Group(new ArrayList<>(), new ArrayList<>())); + } + @Path("/{gid}/members") + @Produces(MediaType.APPLICATION_JSON) + @GET + public List getMembersValue(@PathParam("gid") String gid) { + return getGroup(gid).getMembers(); + } @Path("/{gid}/members") @POST public void addGroupMember(@PathParam("gid") String gid, @FormParam("aid") String aid) { getGroup(gid).addGroupMember(gid, aid); } - @Path("/{gid}/messages") - @POST - public void postMessage(@PathParam("gid") String gid, @FormParam("message") String message) throws JsonProcessingException { - getGroup(gid).postMessage(gid, message); - } - @POST - public void createGroup(@FormParam("gid") String gid) { - this.value.put(gid,new Group(new ArrayList<>(), new ArrayList<>())); - } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Account.java index 31bc4bd..ca1ca70 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Account.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Account.java @@ -1,19 +1,13 @@ import java.util.*; public class Account { - private String name; private int point; + private String name; public Map getValue() { - Map temp_nil5 = new HashMap<>(); - temp_nil5.put("point",this.getPoint()); - temp_nil5.put("name",this.getName()); - return temp_nil5; - } - public String getName() { - return this.name; - } - public int getPoint() { - return point; + Map temp_nil2 = new HashMap<>(); + temp_nil2.put("name",this.getName()); + temp_nil2.put("point",this.getPoint()); + return temp_nil2; } public void updatePointFromBattle(String self, String rid, int mno, boolean battle, String id) { int temp_if0; @@ -23,6 +17,12 @@ temp_if0 = this.point; }this.point = temp_if0; } + public int getPoint() { + return this.point; + } + public String getName() { + return this.name; + } public void changeName(String aid, String name) { this.name = name; } diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Accounts.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Accounts.java index fc4d20e..3575712 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Accounts.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Accounts.java @@ -1,7 +1,7 @@ import java.util.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.JsonProcessingException; @@ -13,12 +13,22 @@ @Produces(MediaType.APPLICATION_JSON) @GET public Map getValue() { - return new HashMap<>(value); + return new HashMap<>(this.value); } public Account getAccount(String mid) { return this.value.get(mid); } - @Path("accounts/{mid}/point") + @POST + public void signUp(@FormParam("name") String name, @FormParam("aid") String aid) { + this.value.put(aid,new Account(name, 0)); + } + @Path("/{mid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getAccountValue(@PathParam("mid") String mid) { + return getAccount(mid).getValue(); + } + @Path("/{mid}/point") @POST public void updatePointFromBattle(@PathParam("mid") String mid, @FormParam("rid") String rid, @FormParam("mno") int mno, @FormParam("battle") boolean battle, @FormParam("id") String id) { getAccount(mid).updatePointFromBattle(mid, rid, mno, battle, id); @@ -29,22 +39,12 @@ public int getPointValue(@PathParam("mid") String mid) { return getAccount(mid).getPoint(); } - @Path("/{mid}") - @Produces(MediaType.APPLICATION_JSON) - @GET - public Map getAccountValue(@PathParam("mid") String mid) { - return getAccount(mid).getValue(); - } @Path("/{mid}/name") @Produces(MediaType.APPLICATION_JSON) @GET public String getNameValue(@PathParam("mid") String mid) { return getAccount(mid).getName(); } - @POST - public void signUp(@FormParam("name") String name, @FormParam("aid") String aid) { - this.value.put(aid,new Account(name, 0)); - } @Path("/{aid}/name") @PUT public void changeName(@PathParam("aid") String aid, @FormParam("name") String name) { diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Member.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Member.java index d12c2cf..03ee021 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Member.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Member.java @@ -1,14 +1,13 @@ import java.util.*; -import javax.ws.rs.client.*; public class Member { private String id; private Client client = ClientBuilder.newClient(); public Map getValue() { - Map temp_nil6 = new HashMap<>(); - temp_nil6.put("id",this.getId()); - temp_nil6.put("name",this.getName()); - return temp_nil6; + Map temp_nil3 = new HashMap<>(); + temp_nil3.put("name",this.getName()); + temp_nil3.put("id",this.getId()); + return temp_nil3; } public String getId() { return this.id; diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Members.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Members.java index 0dd75c8..c1ef7ee 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Members.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Members.java @@ -3,7 +3,7 @@ public class Members { private List value = new ArrayList<>(); public List getValue() { - return new ArrayList<>(value); + return new ArrayList<>(this.value); } public Member getMember(int mno) { return this.value.get(mno); diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Room.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Room.java index edbdd93..3ccf47d 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Room.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Room.java @@ -1,14 +1,13 @@ import java.util.*; -import javax.ws.rs.client.*; public class Room { private Members members = new Members(); - private boolean battle; private Client client = ClientBuilder.newClient(); + private boolean battle; public Map getValue() { Map temp_nil4 = new HashMap<>(); - temp_nil4.put("battle",this.getBattle()); temp_nil4.put("members",this.members.getValue()); + temp_nil4.put("battle",this.getBattle()); return temp_nil4; } public Members getMembers() { @@ -17,18 +16,18 @@ public boolean getBattle() { return this.battle; } - public void battle(String rid, boolean hasWon) throws JsonProcessingException { + public void battle(String rid, boolean hasWon) { + this.battle = hasWon; for (int mno = 0; mno < members.getValue().size(); mno++) { String id = getMembers().getMember(mno).getId(); Form form = new Form(); form.param("rid", rid.toString()); form.param("mno", Integer.toString(mno)); - form.param("battle", Boolean.toString(battle)); + form.param("battle", Boolean.toString(this.battle)); form.param("id", id.toString()); Entity entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED); String result = client.target("http://localhost:8080").path("/accounts/"+id+"/point").request().post(entity, String.class); } - this.battle = hasWon; } public Room(boolean battle) { this.battle = battle; diff --git a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Rooms.java b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Rooms.java index 818eebd..c0b5e43 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Rooms.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/JAX-RS/OnlineBattleGame2/Rooms.java @@ -1,7 +1,7 @@ import java.util.*; -import javax.ws.rs.*; -import javax.ws.rs.client.*; -import javax.ws.rs.core.*; +import jakarta.ws.rs.*; +import jakarta.ws.rs.client.*; +import jakarta.ws.rs.core.*; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.JsonProcessingException; @@ -13,16 +13,25 @@ @Produces(MediaType.APPLICATION_JSON) @GET public Map getValue() { - return new HashMap<>(value); + return new HashMap<>(this.value); } public Room getRoom(String rid) { return this.value.get(rid); } - @Path("/{rid}") + @Path("/{rid}/members") @Produces(MediaType.APPLICATION_JSON) @GET - public Map getRoomValue(@PathParam("rid") String rid) { - return getRoom(rid).getValue(); + public List getMembersValue(@PathParam("rid") String rid) { + return getRoom(rid).getMembers().getValue(); + } + @Path("/{rid}/members") + @POST + public void addRoomMember(@PathParam("rid") String rid, @FormParam("id") String id) { + getRoom(rid).getMembers().addRoomMember(rid, id); + } + @POST + public void createRoom(@FormParam("rid") String rid) { + this.value.put(rid,new Room(false)); } @Path("/{rid}/members/{mno}/id") @Produces(MediaType.APPLICATION_JSON) @@ -42,30 +51,21 @@ public boolean getBattleValue(@PathParam("rid") String rid) { return getRoom(rid).getBattle(); } + @Path("/{rid}/battle") + @PUT + public void battle(@PathParam("rid") String rid, @FormParam("hasWon") boolean hasWon) { + getRoom(rid).battle(rid, hasWon); + } + @Path("/{rid}") + @Produces(MediaType.APPLICATION_JSON) + @GET + public Map getRoomValue(@PathParam("rid") String rid) { + return getRoom(rid).getValue(); + } @Path("/{rid}/members/{mno}/name") @Produces(MediaType.APPLICATION_JSON) @GET public String getNameValue(@PathParam("rid") String rid, @PathParam("mno") int mno) { return getRoom(rid).getMembers().getMember(mno).getName(); } - @Path("/{rid}/members") - @Produces(MediaType.APPLICATION_JSON) - @GET - public List getMembersValue(@PathParam("rid") String rid) { - return getRoom(rid).getMembers().getValue(); - } - @POST - public void createRoom(@FormParam("rid") String rid) { - this.value.put(rid,new Room(false)); - } - @Path("/{rid}/battle") - @PUT - public void battle(@PathParam("rid") String rid, @FormParam("hasWon") boolean hasWon) throws JsonProcessingException { - getRoom(rid).battle(rid, hasWon); - } - @Path("/{rid}/members") - @POST - public void addRoomMember(@PathParam("rid") String rid, @FormParam("id") String id) { - getRoom(rid).getMembers().addRoomMember(rid, id); - } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/src/generators/CodeGeneratorFromDataFlowGraph.java b/AlgebraicDataflowArchitectureModel/src/generators/CodeGeneratorFromDataFlowGraph.java index 44f8bbf..470ecb1 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/CodeGeneratorFromDataFlowGraph.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/CodeGeneratorFromDataFlowGraph.java @@ -2215,6 +2215,7 @@ if (!platformSpec.isMonolithic()) { resourcePath = getInputMethodResourcePathAndPathParams(out.getResource(), rootInputParams, platformSpec, langSpec); // Path parameters for the input REST API. if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path resourcePath = resourcePath.substring(resourcePath.indexOf('/')); } else { resourcePath = ""; @@ -2448,6 +2449,7 @@ ArrayList rootInputParams = new ArrayList<>(); String resourcePath = getGetterResourcePathAndPathParams(out.getResource(), rootInputParams, platformSpec, langSpec); if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path resourcePath = resourcePath.substring(resourcePath.indexOf('/')); } else { resourcePath = ""; @@ -2484,7 +2486,7 @@ Expression resExp = getPullAccessor(platformSpec).getDirectStateAccessorFor(out.getResource(), null); List args = new ArrayList<>(); if (resExp instanceof Term) { - // to access the parent + // To access the parent resource if the leaf resource is primitive and cannot declare the input method, or to remove getValue(). if (((Term) resExp).getChildren().size() > 1 && ((Term) resExp).getChild(1) instanceof Variable) { args.add(((Variable)((Term) resExp).getChild(1)).getName()); } @@ -2643,7 +2645,7 @@ Expression resExp = getPullAccessor(platformSpec).getDirectStateAccessorFor(outResPath, outResPath.getRoot()); List args = new ArrayList<>(); if (resExp instanceof Term) { - // to access the parent + // To access the parent resource if the leaf resource is primitive and cannot declare the input method, or to remove getValue(). if (((Term) resExp).getChildren().size() > 1 && ((Term) resExp).getChild(1) instanceof Variable) { args.add(((Variable)((Term) resExp).getChild(1)).getName()); } @@ -3121,6 +3123,7 @@ List mainGetterParams = new ArrayList<>(); String resourcePath = getGetterResourcePathAndPathParams(resourceNode.getPrimaryResourcePath(), mainGetterParams, platformSpec, langSpec); if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path resourcePath = resourcePath.substring(resourcePath.indexOf('/')); } else { resourcePath = ""; @@ -3159,6 +3162,12 @@ VariableDeclaration param; parameters = new ArrayList<>(); String resourcePath = getUpdateResourcePathAndPathParams(dstResPath, parameters, true, platformSpec, langSpec); // Path parameters to identify the self resource. + if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path + resourcePath = resourcePath.substring(resourcePath.indexOf('/')); + } else { + resourcePath = ""; + } ResourcePath resPath = new ResourcePath(dstResPath); for (int i = 0; i < parameters.size(); i++) { Parameter pathParam = new Parameter(parameters.get(i).getName()); @@ -3211,7 +3220,7 @@ Expression resExp = getPullAccessor(platformSpec).getDirectStateAccessorFor(resPath, resPath.getRoot()); List args = new ArrayList<>(); if (resExp instanceof Term) { - // to access the parent + // To access the parent resource if the leaf resource is primitive and cannot declare the update method, or to remove getValue(). if (((Term) resExp).getChildren().size() > 1 && ((Term) resExp).getChild(1) instanceof Variable) { args.add(((Variable)((Term) resExp).getChild(1)).getName()); } diff --git a/AlgebraicDataflowArchitectureModel/src/generators/JavaMethodBodyGenerator.java b/AlgebraicDataflowArchitectureModel/src/generators/JavaMethodBodyGenerator.java index ff28368..8d1fca4 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/JavaMethodBodyGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/JavaMethodBodyGenerator.java @@ -1224,7 +1224,7 @@ Expression resExp = JavaCodeGenerator.pullAccessor.getDirectStateAccessorFor(out.getResource(), null); List args = new ArrayList<>(); if (resExp instanceof Term) { - // to access the parent + // To access the parent resource if the leaf resource is primitive and cannot declare the input method, or to remove getValue(). if (((Term) resExp).getChildren().size() > 1 && ((Term) resExp).getChild(1) instanceof Variable) { args.add(((Variable)((Term) resExp).getChild(1)).getName()); } diff --git a/AlgebraicDataflowArchitectureModel/src/generators/JerseyCodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/generators/JerseyCodeGenerator.java index b744713..7ec7065 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/JerseyCodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/JerseyCodeGenerator.java @@ -445,6 +445,7 @@ List mainGetterParams = new ArrayList<>(); String resourcePath = getGetterResourcePathAndPathParams(resourceNode.getPrimaryResourcePath(), mainGetterParams); if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path resourcePath = resourcePath.substring(resourcePath.indexOf('/')); } else { resourcePath = ""; @@ -794,6 +795,12 @@ String updateMethodName = update.getName(); params = new ArrayList<>(); String resourcePath = getUpdateResourcePathAndPathParams(out.getResource(), params, true); // Path parameters to identify the self resource. + if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path + resourcePath = resourcePath.substring(resourcePath.indexOf('/')); + } else { + resourcePath = ""; + } for (Selector selector: ch.getAllSelectors()) { if (selector.getExpression() instanceof Variable) { Variable selVar = (Variable) selector.getExpression(); @@ -859,6 +866,7 @@ ArrayList rootInputParams = new ArrayList<>(); String resourcePath = getInputMethodResourcePathAndPathParams(cm.getResource(), rootInputParams); // Path parameters for the input REST API. if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path resourcePath = resourcePath.substring(resourcePath.indexOf('/')); } else { resourcePath = ""; @@ -1030,6 +1038,7 @@ ArrayList rootInputParams = new ArrayList<>(); String resourcePath = getGetterResourcePathAndPathParams(cm.getResource(), rootInputParams); if (resourcePath.indexOf('/') > 0) { + // Remove the root resource from the path resourcePath = resourcePath.substring(resourcePath.indexOf('/')); } else { resourcePath = ""; diff --git a/AlgebraicDataflowArchitectureModel/src/generators/JerseyMethodBodyGenerator.java b/AlgebraicDataflowArchitectureModel/src/generators/JerseyMethodBodyGenerator.java index c452d91..e7ef965 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/JerseyMethodBodyGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/JerseyMethodBodyGenerator.java @@ -320,7 +320,7 @@ String args = ""; String delimiter = ""; if (resExp instanceof Term) { - // to access the parent + // To access the parent resource if the leaf resource is primitive and cannot declare the update method, or to remove getValue(). if (((Term) resExp).getChildren().size() > 1 && ((Term) resExp).getChild(1) instanceof Variable) { args += delimiter + ((Variable)((Term) resExp).getChild(1)).getName(); delimiter = ", "; @@ -1339,7 +1339,7 @@ String args = ""; String delimiter = ""; if (resExp instanceof Term) { - // to access the parent + // To access the parent resource if the leaf resource is primitive and cannot declare the input method, or to remove getValue(). if (((Term) resExp).getChildren().size() > 1 && ((Term) resExp).getChild(1) instanceof Variable) { args += delimiter + ((Variable)((Term) resExp).getChild(1)).getName(); delimiter = ", "; diff --git a/AlgebraicDataflowArchitectureModel/src/tests/JAXRSCodeGeneratorTest.java b/AlgebraicDataflowArchitectureModel/src/tests/JAXRSCodeGeneratorTest.java index 8fb7c44..b56b06d 100644 --- a/AlgebraicDataflowArchitectureModel/src/tests/JAXRSCodeGeneratorTest.java +++ b/AlgebraicDataflowArchitectureModel/src/tests/JAXRSCodeGeneratorTest.java @@ -376,90 +376,6 @@ Entry, // arg types Integer>>>>>>> // lines of code exprectedStructure = new HashMap<>(); - exprectedStructure.put("Groups", Map.entry(Set.of("@Path(\"/groups\")","@Component"), - Map.entry(Map.ofEntries(Map.entry("value", "Map")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getGroup", Map.entry(Set.of(), - Map.entry("Group", - Map.entry(List.of("String"), - 1)))), - Map.entry("getMembersValue", Map.entry(Set.of("@Path(\"/{gid}/members\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("List", - Map.entry(List.of("String"), - 1)))), - Map.entry("getMessagesValue", Map.entry(Set.of("@Path(\"/{gid}/messages\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("List", - Map.entry(List.of("String"), - 1)))), - Map.entry("getGroupValue", Map.entry(Set.of("@Path(\"/{gid}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of("String"), - 1)))), - Map.entry("addGroupMember", Map.entry(Set.of("@Path(\"/{gid}/members\")","@POST"), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))), - Map.entry("postMessage", Map.entry(Set.of("@Path(\"/{gid}/messages\")","@POST"), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))), - Map.entry("createGroup", Map.entry(Set.of("@POST"), - Map.entry("void", - Map.entry(List.of("String"), - 1)))))))); - exprectedStructure.put("Account", Map.entry(Set.of(), - Map.entry(Map.ofEntries(Map.entry("notifications", "Map")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getNotifications", Map.entry(Set.of(), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("updateNotificationsFromMessages", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","String","int","List","String"), - 1)))), - Map.entry("hasRead", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))), - Map.entry("Account", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("Map"), - 1)))))))); - exprectedStructure.put("Group", Map.entry(Set.of(), - Map.entry(Map.ofEntries(Map.entry("messages", "List"), - Map.entry("client", "Client"), - Map.entry("members", "List")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getMessages", Map.entry(Set.of(), - Map.entry("List", - Map.entry(List.of(), - 1)))), - Map.entry("getMembers", Map.entry(Set.of(), - Map.entry("List", - Map.entry(List.of(), - 1)))), - Map.entry("postMessage", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","String"), - 6)))), - Map.entry("addGroupMember", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))), - Map.entry("Group", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("List","List"), - 2)))))))); exprectedStructure.put("Accounts", Map.entry(Set.of("@Path(\"/accounts\")","@Component"), Map.entry(Map.ofEntries(Map.entry("value", "Map")), Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), @@ -470,7 +386,15 @@ Map.entry("Account", Map.entry(List.of("String"), 1)))), - Map.entry("updateNotificationsFromMessages", Map.entry(Set.of("@Path(\"accounts/{v1}/notifications\")","@POST"), + Map.entry("signUp", Map.entry(Set.of("@POST"), + Map.entry("void", + Map.entry(List.of("String"), + 1)))), + Map.entry("getAccountValue", Map.entry(Set.of("@Path(\"/{v1}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of("String"), + 1)))), + Map.entry("updateNotificationsFromMessages", Map.entry(Set.of("@Path(\"/{v1}/notifications\")","@POST"), Map.entry("void", Map.entry(List.of("String","String","int","List","String"), 1)))), @@ -478,18 +402,102 @@ Map.entry("Map", Map.entry(List.of("String"), 1)))), - Map.entry("getAccountValue", Map.entry(Set.of("@Path(\"/{v1}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of("String"), - 1)))), Map.entry("hasRead", Map.entry(Set.of("@Path(\"/{aid}/notifications\")","@DELETE"), Map.entry("void", Map.entry(List.of("String","String"), + 1)))))))); + exprectedStructure.put("Account", Map.entry(Set.of(), + Map.entry(Map.ofEntries(Map.entry("notifications", "Map")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), + Map.entry("Map", + Map.entry(List.of(), 1)))), - Map.entry("signUp", Map.entry(Set.of("@POST"), + Map.entry("updateNotificationsFromMessages", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String","String","int","List","String"), + 1)))), + Map.entry("getNotifications", Map.entry(Set.of(), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("hasRead", Map.entry(Set.of(), Map.entry("void", - Map.entry(List.of("String"), + Map.entry(List.of("String","String"), + 1)))), + Map.entry("Account", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("Map"), 1)))))))); + exprectedStructure.put("Group", Map.entry(Set.of(), + Map.entry(Map.ofEntries(Map.entry("members", "List"), + Map.entry("client", "Client"), + Map.entry("messages", "List")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("getMember", Map.entry(Set.of(), + Map.entry("String", + Map.entry(List.of("int"), + 1)))), + Map.entry("getMembers", Map.entry(Set.of(), + Map.entry("List", + Map.entry(List.of(), + 1)))), + Map.entry("addGroupMember", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))), + Map.entry("getMessages", Map.entry(Set.of(), + Map.entry("List", + Map.entry(List.of(), + 1)))), + Map.entry("postMessage", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String","String"), + 6)))), + Map.entry("Group", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("List","List"), + 2)))))))); + exprectedStructure.put("Groups", Map.entry(Set.of("@Path(\"/groups\")","@Component"), + Map.entry(Map.ofEntries(Map.entry("value", "Map")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("getGroup", Map.entry(Set.of(), + Map.entry("Group", + Map.entry(List.of("String"), + 1)))), + Map.entry("getMemberValue", Map.entry(Set.of("@Path(\"/{gid}/members/{mno}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("String", + Map.entry(List.of("String","int"), + 1)))), + Map.entry("getMembersValue", Map.entry(Set.of("@Path(\"/{gid}/members\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("List", + Map.entry(List.of("String"), + 1)))), + Map.entry("addGroupMember", Map.entry(Set.of("@Path(\"/{gid}/members\")","@POST"), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))), + Map.entry("getGroupValue", Map.entry(Set.of("@Path(\"/{gid}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of("String"), + 1)))), + Map.entry("createGroup", Map.entry(Set.of("@POST"), + Map.entry("void", + Map.entry(List.of("String"), + 1)))), + Map.entry("getMessagesValue", Map.entry(Set.of("@Path(\"/{gid}/messages\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("List", + Map.entry(List.of("String"), + 1)))), + Map.entry("postMessage", Map.entry(Set.of("@Path(\"/{gid}/messages\")","@POST"), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))))))); checkStructure(generatedCode, exprectedStructure); // generateCheckCode(generatedCode); @@ -731,102 +739,10 @@ Entry, // arg types Integer>>>>>>> // lines of code exprectedStructure = new HashMap<>(); - exprectedStructure.put("Rooms", Map.entry(Set.of("@Path(\"/rooms\")","@Component"), - Map.entry(Map.ofEntries(Map.entry("value", "Map")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getRoom", Map.entry(Set.of(), - Map.entry("Room", - Map.entry(List.of("String"), - 1)))), - Map.entry("getIdValue", Map.entry(Set.of("@Path(\"/{rid}/members/{mno}/id\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("String", - Map.entry(List.of("String","int"), - 1)))), - Map.entry("getBattleValue", Map.entry(Set.of("@Path(\"/{rid}/battle\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("boolean", - Map.entry(List.of("String"), - 1)))), - Map.entry("getRoomValue", Map.entry(Set.of("@Path(\"/{rid}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of("String"), - 1)))), - Map.entry("getMemberValue", Map.entry(Set.of("@Path(\"/{rid}/members/{mno}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of("String","int"), - 1)))), - Map.entry("getMembersValue", Map.entry(Set.of("@Path(\"/{rid}/members\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("List", - Map.entry(List.of("String"), - 1)))), - Map.entry("getNameValue", Map.entry(Set.of("@Path(\"/{rid}/members/{mno}/name\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("String", - Map.entry(List.of("String","int"), - 1)))), - Map.entry("battle", Map.entry(Set.of("@Path(\"/{rid}/battle\")","@PUT"), - Map.entry("void", - Map.entry(List.of("String","boolean"), - 1)))), - Map.entry("addRoomMember", Map.entry(Set.of("@Path(\"/{rid}/members\")","@POST"), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))), - Map.entry("createRoom", Map.entry(Set.of("@POST"), - Map.entry("void", - Map.entry(List.of("String"), - 1)))))))); - exprectedStructure.put("Member", Map.entry(Set.of(), - Map.entry(Map.ofEntries(Map.entry("id", "String"), - Map.entry("client", "Client")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getId", Map.entry(Set.of(), - Map.entry("String", - Map.entry(List.of(), - 1)))), - Map.entry("getName", Map.entry(Set.of(), - Map.entry("String", - Map.entry(List.of(), - 2)))), - Map.entry("Member", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String"), - 1)))))))); - exprectedStructure.put("Account", Map.entry(Set.of(), - Map.entry(Map.ofEntries(Map.entry("name", "String"), - Map.entry("point", "int")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getName", Map.entry(Set.of(), - Map.entry("String", - Map.entry(List.of(), - 1)))), - Map.entry("getPoint", Map.entry(Set.of(), - Map.entry("int", - Map.entry(List.of(), - 1)))), - Map.entry("updatePointFromBattle", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","String","int","boolean","String"), - 1)))), - Map.entry("changeName", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))), - Map.entry("Account", Map.entry(Set.of(), - Map.entry("void", - Map.entry(List.of("String","int"), - 2)))))))); exprectedStructure.put("Room", Map.entry(Set.of(), Map.entry(Map.ofEntries(Map.entry("members", "Members"), - Map.entry("battle", "boolean"), - Map.entry("client", "Client")), + Map.entry("client", "Client"), + Map.entry("battle", "boolean")), Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), Map.entry("Map", Map.entry(List.of(), @@ -847,40 +763,52 @@ Map.entry("void", Map.entry(List.of("boolean"), 1)))))))); - exprectedStructure.put("Accounts", Map.entry(Set.of("@Path(\"/accounts\")","@Component"), - Map.entry(Map.ofEntries(Map.entry("value", "Map")), - Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of(), - 1)))), - Map.entry("getAccount", Map.entry(Set.of(), - Map.entry("Account", - Map.entry(List.of("String"), - 1)))), - Map.entry("updatePointFromBattle", Map.entry(Set.of("@Path(\"accounts/{mid}/point\")","@POST"), - Map.entry("void", - Map.entry(List.of("String","String","int","boolean","String"), - 1)))), - Map.entry("getAccountValue", Map.entry(Set.of("@Path(\"/{mid}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("Map", - Map.entry(List.of("String"), - 1)))), - Map.entry("getNameValue", Map.entry(Set.of("@Path(\"/{mid}/name\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("String", - Map.entry(List.of("String"), - 1)))), - Map.entry("getPointValue", Map.entry(Set.of("@Path(\"/{mid}/point\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), - Map.entry("int", - Map.entry(List.of("String"), - 1)))), - Map.entry("signUp", Map.entry(Set.of("@POST"), - Map.entry("void", - Map.entry(List.of("String","String"), + exprectedStructure.put("Account", Map.entry(Set.of(), + Map.entry(Map.ofEntries(Map.entry("name", "String"), + Map.entry("point", "int")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("getName", Map.entry(Set.of(), + Map.entry("String", + Map.entry(List.of(), 1)))), - Map.entry("changeName", Map.entry(Set.of("@Path(\"/{aid}/name\")","@PUT"), - Map.entry("void", - Map.entry(List.of("String","String"), - 1)))))))); + Map.entry("changeName", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))), + Map.entry("updatePointFromBattle", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String","String","int","boolean","String"), + 1)))), + Map.entry("getPoint", Map.entry(Set.of(), + Map.entry("int", + Map.entry(List.of(), + 1)))), + Map.entry("Account", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String","int"), + 2)))))))); + exprectedStructure.put("Member", Map.entry(Set.of(), + Map.entry(Map.ofEntries(Map.entry("id", "String"), + Map.entry("client", "Client")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("getId", Map.entry(Set.of(), + Map.entry("String", + Map.entry(List.of(), + 1)))), + Map.entry("getName", Map.entry(Set.of(), + Map.entry("String", + Map.entry(List.of(), + 2)))), + Map.entry("Member", Map.entry(Set.of(), + Map.entry("void", + Map.entry(List.of("String"), + 1)))))))); exprectedStructure.put("Members", Map.entry(Set.of(), Map.entry(Map.ofEntries(Map.entry("value", "List")), Map.ofEntries(Map.entry("getValue", Map.entry(Set.of(), @@ -895,8 +823,88 @@ Map.entry("void", Map.entry(List.of("String","String"), 1)))))))); + exprectedStructure.put("Accounts", Map.entry(Set.of("@Path(\"/accounts\")","@Component"), + Map.entry(Map.ofEntries(Map.entry("value", "Map")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("getAccount", Map.entry(Set.of(), + Map.entry("Account", + Map.entry(List.of("String"), + 1)))), + Map.entry("getNameValue", Map.entry(Set.of("@Path(\"/{mid}/name\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("String", + Map.entry(List.of("String"), + 1)))), + Map.entry("changeName", Map.entry(Set.of("@Path(\"/{aid}/name\")","@PUT"), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))), + Map.entry("getAccountValue", Map.entry(Set.of("@Path(\"/{mid}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of("String"), + 1)))), + Map.entry("updatePointFromBattle", Map.entry(Set.of("@Path(\"/{mid}/point\")","@POST"), + Map.entry("void", + Map.entry(List.of("String","String","int","boolean","String"), + 1)))), + Map.entry("getPointValue", Map.entry(Set.of("@Path(\"/{mid}/point\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("int", + Map.entry(List.of("String"), + 1)))), + Map.entry("signUp", Map.entry(Set.of("@POST"), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))))))); + exprectedStructure.put("Rooms", Map.entry(Set.of("@Path(\"/rooms\")","@Component"), + Map.entry(Map.ofEntries(Map.entry("value", "Map")), + Map.ofEntries(Map.entry("getValue", Map.entry(Set.of("@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of(), + 1)))), + Map.entry("getRoom", Map.entry(Set.of(), + Map.entry("Room", + Map.entry(List.of("String"), + 1)))), + Map.entry("getRoomValue", Map.entry(Set.of("@Path(\"/{rid}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of("String"), + 1)))), + Map.entry("getBattleValue", Map.entry(Set.of("@Path(\"/{rid}/battle\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("boolean", + Map.entry(List.of("String"), + 1)))), + Map.entry("battle", Map.entry(Set.of("@Path(\"/{rid}/battle\")","@PUT"), + Map.entry("void", + Map.entry(List.of("String","boolean"), + 1)))), + Map.entry("getIdValue", Map.entry(Set.of("@Path(\"/{rid}/members/{mno}/id\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("String", + Map.entry(List.of("String","int"), + 1)))), + Map.entry("getNameValue", Map.entry(Set.of("@Path(\"/{rid}/members/{mno}/name\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("String", + Map.entry(List.of("String","int"), + 1)))), + Map.entry("getMemberValue", Map.entry(Set.of("@Path(\"/{rid}/members/{mno}\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("Map", + Map.entry(List.of("String","int"), + 1)))), + Map.entry("getMembersValue", Map.entry(Set.of("@Path(\"/{rid}/members\")","@Produces(MediaType.APPLICATION_JSON)","@GET"), + Map.entry("List", + Map.entry(List.of("String"), + 1)))), + Map.entry("addRoomMember", Map.entry(Set.of("@Path(\"/{rid}/members\")","@POST"), + Map.entry("void", + Map.entry(List.of("String","String"), + 1)))), + Map.entry("createRoom", Map.entry(Set.of("@POST"), + Map.entry("void", + Map.entry(List.of("String"), + 1)))))))); - checkStructure(generatedCode, exprectedStructure); + checkStructure(generatedCode, exprectedStructure); // generateCheckCode(generatedCode); } catch (FileNotFoundException | ExpectedChannel | ExpectedChannelName | ExpectedLeftCurlyBracket | ExpectedInOrOutOrRefOrSubKeyword