diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java index 6aa36f4..f0a5587 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Account.java @@ -3,14 +3,14 @@ public class Account { private Map notifications; public Map getValue() { - Map temp_nil5 = new HashMap<>(); - temp_nil5.put("notifications",this.getNotifications()); - return temp_nil5; + Map temp_nil1 = new HashMap<>(); + temp_nil1.put("notifications",this.getNotifications()); + return temp_nil1; } public Map getNotifications() { return new HashMap<>(notifications); } - public void updateNotificationsFromMessages(String gid, int mno, List messages, String members) { + public void updateNotificationsFromMessages(String self, String gid, int mno, List messages, String member) { this.notifications.put(gid,true); } public void hasRead(String aid, String gid) { diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java index 7a9159a..4498ead 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Group.java @@ -6,10 +6,10 @@ private Account account; private Accounts accounts; public Map getValue() { - Map temp_nil4 = new HashMap<>(); - temp_nil4.put("messages",this.getMessages()); - temp_nil4.put("members",this.getMembers()); - return temp_nil4; + Map temp_nil0 = new HashMap<>(); + temp_nil0.put("members",this.getMembers()); + temp_nil0.put("messages",this.getMessages()); + return temp_nil0; } public List getMembers() { return this.members; diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java index 201f338..eefc010 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/GroupChat.java @@ -5,7 +5,7 @@ private Groups groups; public GroupChat() { accounts = new Accounts(); - groups = new Groups(); + groups = new Groups(accounts); } public List getMembers(String gid) { return this.groups.getGroup(gid).getMembers(); @@ -13,15 +13,6 @@ public void addGroupMember(String gid, String aid) { this.groups.getGroup(gid).addGroupMember(gid, aid); } - public Map getNotifications(String v1) { - return this.accounts.getAccount(m.get(mno)).getNotifications(); - } - public void hasRead(String aid, String gid) { - this.accounts.getAccount(aid).hasRead(aid, gid); - } - public Map getGroup(String gid) { - return this.groups.getGroup(gid).getValue(); - } public List getMessages(String gid) { return this.groups.getGroup(gid).getMessages(); } @@ -34,8 +25,20 @@ public void signUp(String aid) { this.accounts.signUp(aid); } + public Map getNotifications(String aid) { + return this.accounts.getAccount(aid).getNotifications(); + } + public void hasRead(String aid, String gid) { + this.accounts.getAccount(aid).hasRead(aid, gid); + } + public Map getGroup(String gid) { + return this.groups.getGroup(gid).getValue(); + } + public String getMember(String gid, int mno) { + return this.groups.getGroup(gid).getMember(mno); + } public Map getAccount(String v1) { - return this.accounts.getAccount(m.get(mno)).getValue(); + return this.accounts.getAccount(v1).getValue(); } public Map getGroups() { return this.groups.getValue(); @@ -43,7 +46,4 @@ public void createGroup(String gid) { this.groups.createGroup(gid); } - public String getMember(String gid, int mno) { - return this.groups.getGroup(gid).getMember(mno); - } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java index 014bc27..3749120 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PULL-first/Groups.java @@ -2,6 +2,7 @@ public class Groups { private Map value = new HashMap<>(); + private Accounts accounts; public Map getValue() { return new HashMap<>(value); } @@ -11,4 +12,7 @@ public void createGroup(String gid) { this.value.put(gid,new Group(new ArrayList<>(), new ArrayList<>(), accounts)); } + public Groups(Accounts accounts) { + this.accounts = accounts; + } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java index 830c8ce..f648219 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Account.java @@ -3,14 +3,14 @@ public class Account { private Map notifications; public Map getValue() { - Map temp_nil7 = new HashMap<>(); - temp_nil7.put("notifications",this.getNotifications()); - return temp_nil7; + Map temp_nil3 = new HashMap<>(); + temp_nil3.put("notifications",this.getNotifications()); + return temp_nil3; } public Map getNotifications() { return new HashMap<>(notifications); } - public void updateNotificationsFromMessages(String gid, int mno, List messages, String members) { + public void updateNotificationsFromMessages(String self, String gid, int mno, List messages, String member) { this.notifications.put(gid,true); } public void hasRead(String aid, String gid) { diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java index 660e433..ed8f277 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Group.java @@ -6,10 +6,10 @@ private Account account; private Accounts accounts; public Map getValue() { - Map temp_nil6 = new HashMap<>(); - temp_nil6.put("messages",this.getMessages()); - temp_nil6.put("members",this.getMembers()); - return temp_nil6; + 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; diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java index 201f338..eefc010 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/GroupChat.java @@ -5,7 +5,7 @@ private Groups groups; public GroupChat() { accounts = new Accounts(); - groups = new Groups(); + groups = new Groups(accounts); } public List getMembers(String gid) { return this.groups.getGroup(gid).getMembers(); @@ -13,15 +13,6 @@ public void addGroupMember(String gid, String aid) { this.groups.getGroup(gid).addGroupMember(gid, aid); } - public Map getNotifications(String v1) { - return this.accounts.getAccount(m.get(mno)).getNotifications(); - } - public void hasRead(String aid, String gid) { - this.accounts.getAccount(aid).hasRead(aid, gid); - } - public Map getGroup(String gid) { - return this.groups.getGroup(gid).getValue(); - } public List getMessages(String gid) { return this.groups.getGroup(gid).getMessages(); } @@ -34,8 +25,20 @@ public void signUp(String aid) { this.accounts.signUp(aid); } + public Map getNotifications(String aid) { + return this.accounts.getAccount(aid).getNotifications(); + } + public void hasRead(String aid, String gid) { + this.accounts.getAccount(aid).hasRead(aid, gid); + } + public Map getGroup(String gid) { + return this.groups.getGroup(gid).getValue(); + } + public String getMember(String gid, int mno) { + return this.groups.getGroup(gid).getMember(mno); + } public Map getAccount(String v1) { - return this.accounts.getAccount(m.get(mno)).getValue(); + return this.accounts.getAccount(v1).getValue(); } public Map getGroups() { return this.groups.getValue(); @@ -43,7 +46,4 @@ public void createGroup(String gid) { this.groups.createGroup(gid); } - public String getMember(String gid, int mno) { - return this.groups.getGroup(gid).getMember(mno); - } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java index 014bc27..3749120 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/GroupChat/PUSH-first/Groups.java @@ -2,6 +2,7 @@ public class Groups { private Map value = new HashMap<>(); + private Accounts accounts; public Map getValue() { return new HashMap<>(value); } @@ -11,4 +12,7 @@ public void createGroup(String gid) { this.value.put(gid,new Group(new ArrayList<>(), new ArrayList<>(), accounts)); } + public Groups(Accounts accounts) { + this.accounts = accounts; + } } \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/Account.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/Account.java index 7dec970..605d6c1 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/Account.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/Account.java @@ -3,9 +3,9 @@ public class Account { private String vote; public Map getValue() { - Map temp_nil1 = new HashMap<>(); - temp_nil1.put("vote",this.getVote()); - return temp_nil1; + Map temp_nil4 = new HashMap<>(); + temp_nil4.put("vote",this.getVote()); + return temp_nil4; } public String getVote() { return this.vote; diff --git a/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/VotingSystem.java b/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/VotingSystem.java index 50ae847..27950ce 100644 --- a/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/VotingSystem.java +++ b/AlgebraicDataflowArchitectureModel/prototypes/Java/VotingSystem/VotingSystem.java @@ -1,14 +1,11 @@ import java.util.*; public class VotingSystem { - private Counts counts; private Accounts accounts; + private Counts counts; public VotingSystem() { - counts = new Counts(); accounts = new Accounts(); - } - public Map getCounts() { - return this.counts.getValue(); + counts = new Counts(accounts); } public Map getAccount(String aid) { return this.accounts.getAccount(aid).getValue(); @@ -19,6 +16,9 @@ public void signUp(String name, String aid) { this.accounts.signUp(name, aid); } + public Map getCounts() { + return this.counts.getValue(); + } public String getVote(String aid) { return this.accounts.getAccount(aid).getVote(); } diff --git a/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java index 0ba11ba..b23a6a3 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/CodeGenerator.java @@ -169,16 +169,9 @@ private static Map> getDependedRootComponentGraph(DataTransferModel model) { Map> dependedComponentGraph = new HashMap<>(); for (Channel ch: model.getChannels()) { - DataTransferChannel dtCh = (DataTransferChannel) ch; Set inRes = new HashSet<>(); Set outRes = new HashSet<>(); - for (ChannelMember cm: dtCh.getChannelMembers()) { - if (cm.isOutside()) { - outRes.add(cm.getResource().getResourceHierarchy()); - } else { - inRes.add(cm.getResource().getResourceHierarchy()); - } - } + getDependedRootComponentGraphSub(ch, inRes, outRes, true); if (outRes.size() > 0 && inRes.size() > 0) { for (ResourceHierarchy out: outRes) { for (ResourceHierarchy in: inRes) { @@ -187,13 +180,32 @@ dependings = new HashSet<>(); dependedComponentGraph.put(out.getRoot(), dependings); } - dependings.add(in.getRoot()); + if (!out.getRoot().equals(in.getRoot())) { + dependings.add(in.getRoot()); + } } } } } return dependedComponentGraph; } + + private static void getDependedRootComponentGraphSub(Channel ch, Set inRes, Set outRes, boolean isRoot) { + DataTransferChannel dtCh = (DataTransferChannel) ch; + for (ChannelMember cm: dtCh.getChannelMembers()) { + if (!isRoot && !cm.isOutside()) { + outRes.add(cm.getResource().getResourceHierarchy()); // dependency to a descendant channel resource. + } + if (cm.isOutside()) { + outRes.add(cm.getResource().getResourceHierarchy()); // dependency to an outside resource. + } else { + inRes.add(cm.getResource().getResourceHierarchy()); // dependency from an inside resource. + } + } + for (Channel childCh: ch.getChildren()) { + getDependedRootComponentGraphSub(childCh, inRes, outRes, false); + } + } private static ArrayList determineComponentOrder(DataFlowGraph graph, Map> dependedRootComponentGraph) { ArrayList objects = new ArrayList<>(); @@ -288,7 +300,9 @@ } if (constructor.getParameters() != null) { for (VariableDeclaration var: constructor.getParameters()) { - parameters.add(var.getName()); + if (!parameters.contains(var.getName())) { + parameters.add(var.getName()); + } } } diff --git a/AlgebraicDataflowArchitectureModel/src/generators/JavaCodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/generators/JavaCodeGenerator.java index a5389bf..b362030 100644 --- a/AlgebraicDataflowArchitectureModel/src/generators/JavaCodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/generators/JavaCodeGenerator.java @@ -667,7 +667,16 @@ VariableDeclaration refVar = new VariableDeclaration(new Type(resName, resName), toVariableName(resName)); if (component != null) { // A component is created for this resource. - component.addField(refField); + boolean existsField = false; + for (FieldDeclaration field: component.getFields()) { + if (field.getName().equals(refVar.getName())) { + existsField = true; + break; + } + } + if (!existsField) { + component.addField(refField); + } constructorParams.add(new AbstractMap.SimpleEntry<>(resourceNode.getResourceHierarchy(), refVar)); } else { // No component is created for this resource. @@ -974,16 +983,9 @@ private static Map> getDependedRootComponentGraph(DataTransferModel model) { Map> dependedComponentGraph = new HashMap<>(); for (Channel ch: model.getChannels()) { - DataTransferChannel dtCh = (DataTransferChannel) ch; Set inRes = new HashSet<>(); Set outRes = new HashSet<>(); - for (ChannelMember cm: dtCh.getChannelMembers()) { - if (cm.isOutside()) { - outRes.add(cm.getResource().getResourceHierarchy()); - } else { - inRes.add(cm.getResource().getResourceHierarchy()); - } - } + getDependedRootComponentGraphSub(ch, inRes, outRes, true); if (outRes.size() > 0 && inRes.size() > 0) { for (ResourceHierarchy out: outRes) { for (ResourceHierarchy in: inRes) { @@ -992,7 +994,9 @@ dependings = new HashSet<>(); dependedComponentGraph.put(out.getRoot(), dependings); } - dependings.add(in.getRoot()); + if (!out.getRoot().equals(in.getRoot())) { + dependings.add(in.getRoot()); + } } } } @@ -1000,7 +1004,24 @@ return dependedComponentGraph; } - static private ArrayList determineResourceOrder(DataFlowGraph graph, Map> dependedRootComponentGraph) { + private static void getDependedRootComponentGraphSub(Channel ch, Set inRes, Set outRes, boolean isRoot) { + DataTransferChannel dtCh = (DataTransferChannel) ch; + for (ChannelMember cm: dtCh.getChannelMembers()) { + if (!isRoot && !cm.isOutside()) { + outRes.add(cm.getResource().getResourceHierarchy()); // dependency to a descendant channel resource. + } + if (cm.isOutside()) { + outRes.add(cm.getResource().getResourceHierarchy()); // dependency to an outside resource. + } else { + inRes.add(cm.getResource().getResourceHierarchy()); // dependency from an inside resource. + } + } + for (Channel childCh: ch.getChildren()) { + getDependedRootComponentGraphSub(childCh, inRes, outRes, false); + } + } + + private static ArrayList determineResourceOrder(DataFlowGraph graph, Map> dependedRootComponentGraph) { ArrayList resources = new ArrayList<>(); Set visited = new HashSet<>(); for (Node n : graph.getResourceNodes()) { diff --git a/AlgebraicDataflowArchitectureModel/src/tests/JavaCodeGeneratorTest.java b/AlgebraicDataflowArchitectureModel/src/tests/JavaCodeGeneratorTest.java index 82f252a..dd02f23 100644 --- a/AlgebraicDataflowArchitectureModel/src/tests/JavaCodeGeneratorTest.java +++ b/AlgebraicDataflowArchitectureModel/src/tests/JavaCodeGeneratorTest.java @@ -396,66 +396,50 @@ Entry, // arg types Integer>>>>> // lines of code exprectedStructure = new HashMap<>(); - exprectedStructure.put("Main", Map.entry(Map.ofEntries(Map.entry("groups", "Groups"), - Map.entry("accounts", "Accounts")), + exprectedStructure.put("Main", Map.entry(Map.ofEntries(Map.entry("accounts", "Accounts"), + Map.entry("groups", "Groups")), Map.ofEntries(Map.entry("Main", Map.entry("void", Map.entry(List.of(), 2))), - Map.entry("getAccount", Map.entry("Map", - Map.entry(List.of("String"), - 1))), - Map.entry("getMessages", Map.entry("List", - Map.entry(List.of("String"), - 1))), - Map.entry("postMessage", Map.entry("void", - Map.entry(List.of("String","String"), - 1))), - Map.entry("getNotifications", Map.entry("Map", - Map.entry(List.of("String"), - 1))), - Map.entry("hasRead", Map.entry("void", - Map.entry(List.of("String","String"), - 1))), Map.entry("getAccounts", Map.entry("Map", Map.entry(List.of(), 1))), Map.entry("signUp", Map.entry("void", Map.entry(List.of("String"), 1))), + Map.entry("getGroup", Map.entry("Map", + Map.entry(List.of("String"), + 1))), + Map.entry("getMessages", Map.entry("List", + Map.entry(List.of("String"), + 1))), + Map.entry("postMessage", Map.entry("void", + Map.entry(List.of("String","String"), + 1))), + Map.entry("getAccount", Map.entry("Map", + Map.entry(List.of("String"), + 1))), + Map.entry("getMember", Map.entry("String", + Map.entry(List.of("String","int"), + 1))), + Map.entry("getNotifications", Map.entry("Map", + Map.entry(List.of("String"), + 1))), + Map.entry("hasRead", Map.entry("void", + Map.entry(List.of("String","String"), + 1))), Map.entry("getMembers", Map.entry("List", Map.entry(List.of("String"), 1))), Map.entry("addGroupMember", Map.entry("void", Map.entry(List.of("String","String"), 1))), - Map.entry("getGroup", Map.entry("Map", - Map.entry(List.of("String"), - 1))), - Map.entry("getMember", Map.entry("String", - Map.entry(List.of("String","int"), - 1))), Map.entry("getGroups", Map.entry("Map", Map.entry(List.of(), 1))), Map.entry("createGroup", Map.entry("void", Map.entry(List.of("String"), 1)))))); - exprectedStructure.put("Account", Map.entry(Map.ofEntries(), - Map.ofEntries(Map.entry("getValue", Map.entry("Map", - Map.entry(List.of(), - 1))), - Map.entry("getNotifications", Map.entry("Map", - Map.entry(List.of(), - 1))), - Map.entry("updateNotificationsFromMessages", Map.entry("void", - Map.entry(List.of("String","int","List","String"), - 1))), - Map.entry("hasRead", Map.entry("void", - Map.entry(List.of("String","String"), - 1))), - Map.entry("Account", Map.entry("void", - Map.entry(List.of("Map"), - 1)))))); exprectedStructure.put("Accounts", Map.entry(Map.ofEntries(), Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), @@ -466,22 +450,22 @@ Map.entry("signUp", Map.entry("void", Map.entry(List.of("String"), 1)))))); - exprectedStructure.put("Group", Map.entry(Map.ofEntries(Map.entry("members", "List"), - Map.entry("messages", "List"), + exprectedStructure.put("Group", Map.entry(Map.ofEntries(Map.entry("messages", "List"), Map.entry("account", "Account"), - Map.entry("accounts", "Accounts")), + Map.entry("accounts", "Accounts"), + Map.entry("members", "List")), Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), 1))), Map.entry("getMessages", Map.entry("List", Map.entry(List.of(), 1))), - Map.entry("getMembers", Map.entry("List", - Map.entry(List.of(), - 1))), Map.entry("getMember", Map.entry("String", Map.entry(List.of("int"), 1))), + Map.entry("getMembers", Map.entry("List", + Map.entry(List.of(), + 1))), Map.entry("postMessage", Map.entry("void", Map.entry(List.of("String","String"), 6))), @@ -491,7 +475,24 @@ Map.entry("Group", Map.entry("void", Map.entry(List.of("List","Accounts","List"), 3)))))); - exprectedStructure.put("Groups", Map.entry(Map.ofEntries(), + exprectedStructure.put("Account", Map.entry(Map.ofEntries(), + Map.ofEntries(Map.entry("getValue", Map.entry("Map", + Map.entry(List.of(), + 1))), + Map.entry("getNotifications", Map.entry("Map", + Map.entry(List.of(), + 1))), + Map.entry("updateNotificationsFromMessages", Map.entry("void", + Map.entry(List.of("String","String","int","List","String"), + 1))), + Map.entry("hasRead", Map.entry("void", + Map.entry(List.of("String","String"), + 1))), + Map.entry("Account", Map.entry("void", + Map.entry(List.of("Map"), + 1)))))); + exprectedStructure.put("Groups", Map.entry(Map.ofEntries(Map.entry("value", "Map"), + Map.entry("accounts", "Accounts")), Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), 1))), @@ -500,7 +501,10 @@ 1))), Map.entry("createGroup", Map.entry("void", Map.entry(List.of("String"), - 1)))))); + 1))), + Map.entry("Groups", Map.entry("void", + Map.entry(List.of("Accounts"), + 1)))))); checkStructure(generatedCode, exprectedStructure); // generateCheckCode(generatedCode); @@ -513,12 +517,27 @@ Map.ofEntries(Map.entry("Main", Map.entry("void", Map.entry(List.of(), 2))), + Map.entry("getMembers", Map.entry("List", + Map.entry(List.of("String"), + 1))), + Map.entry("addGroupMember", Map.entry("void", + Map.entry(List.of("String","String"), + 1))), Map.entry("getMessages", Map.entry("List", Map.entry(List.of("String"), 1))), Map.entry("postMessage", Map.entry("void", Map.entry(List.of("String","String"), 1))), + Map.entry("getMember", Map.entry("String", + Map.entry(List.of("String","int"), + 1))), + Map.entry("getNotifications", Map.entry("Map", + Map.entry(List.of("String"), + 1))), + Map.entry("hasRead", Map.entry("void", + Map.entry(List.of("String","String"), + 1))), Map.entry("getGroup", Map.entry("Map", Map.entry(List.of("String"), 1))), @@ -531,27 +550,12 @@ Map.entry("getAccount", Map.entry("Map", Map.entry(List.of("String"), 1))), - Map.entry("getNotifications", Map.entry("Map", - Map.entry(List.of("String"), - 1))), - Map.entry("hasRead", Map.entry("void", - Map.entry(List.of("String","String"), - 1))), Map.entry("getGroups", Map.entry("Map", Map.entry(List.of(), 1))), Map.entry("createGroup", Map.entry("void", Map.entry(List.of("String"), - 1))), - Map.entry("getMembers", Map.entry("List", - Map.entry(List.of("String"), - 1))), - Map.entry("addGroupMember", Map.entry("void", - Map.entry(List.of("String","String"), - 1))), - Map.entry("getMember", Map.entry("String", - Map.entry(List.of("String","int"), - 1)))))); + 1)))))); exprectedStructure.put("Group", Map.entry(Map.ofEntries(Map.entry("members", "List"), Map.entry("messages", "List"), Map.entry("account", "Account"), @@ -559,12 +563,12 @@ Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), 1))), - Map.entry("getMessages", Map.entry("List", - Map.entry(List.of(), - 1))), Map.entry("getMembers", Map.entry("List", Map.entry(List.of(), 1))), + Map.entry("getMessages", Map.entry("List", + Map.entry(List.of(), + 1))), Map.entry("getMember", Map.entry("String", Map.entry(List.of("int"), 1))), @@ -575,7 +579,7 @@ Map.entry(List.of("String","String"), 1))), Map.entry("Group", Map.entry("void", - Map.entry(List.of("List","Accounts","List"), + Map.entry(List.of("List","List","Accounts"), 3)))))); exprectedStructure.put("Accounts", Map.entry(Map.ofEntries(), Map.ofEntries(Map.entry("getValue", Map.entry("Map", @@ -595,7 +599,7 @@ Map.entry(List.of(), 1))), Map.entry("updateNotificationsFromMessages", Map.entry("void", - Map.entry(List.of("String","int","List","String"), + Map.entry(List.of("String","String","int","List","String"), 1))), Map.entry("hasRead", Map.entry("void", Map.entry(List.of("String","String"), @@ -603,7 +607,8 @@ Map.entry("Account", Map.entry("void", Map.entry(List.of("Map"), 1)))))); - exprectedStructure.put("Groups", Map.entry(Map.ofEntries(), + exprectedStructure.put("Groups", Map.entry(Map.ofEntries(Map.entry("value", "Map"), + Map.entry("accounts", "Accounts")), Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), 1))), @@ -612,7 +617,10 @@ 1))), Map.entry("createGroup", Map.entry("void", Map.entry(List.of("String"), - 1)))))); + 1))), + Map.entry("Groups", Map.entry("void", + Map.entry(List.of("Accounts"), + 1)))))); checkStructure(generatedCode, exprectedStructure); // generateCheckCode(generatedCode); @@ -1499,12 +1507,12 @@ Map.entry("cast", Map.entry("void", Map.entry(List.of("String","String"), 1))), - Map.entry("getCounts", Map.entry("Map", - Map.entry(List.of(), - 1))), Map.entry("getAccount", Map.entry("Map", Map.entry(List.of("String"), - 1)))))); + 1))), + Map.entry("getCounts", Map.entry("Map", + Map.entry(List.of(), + 1)))))); exprectedStructure.put("Accounts", Map.entry(Map.ofEntries(), Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), @@ -1515,15 +1523,6 @@ Map.entry("signUp", Map.entry("void", Map.entry(List.of("String","String"), 1)))))); - exprectedStructure.put("Counts", Map.entry(Map.ofEntries(Map.entry("value", "Map"), - Map.entry("account", "Account"), - Map.entry("accounts", "Accounts")), - Map.ofEntries(Map.entry("getValue", Map.entry("Map", - Map.entry(List.of(), - 6))), - Map.entry("Counts", Map.entry("void", - Map.entry(List.of("Accounts"), - 1)))))); exprectedStructure.put("Account", Map.entry(Map.ofEntries(), Map.ofEntries(Map.entry("getValue", Map.entry("Map", Map.entry(List.of(), @@ -1537,6 +1536,15 @@ Map.entry("Account", Map.entry("void", Map.entry(List.of("String"), 1)))))); + exprectedStructure.put("Counts", Map.entry(Map.ofEntries(Map.entry("value", "Map"), + Map.entry("account", "Account"), + Map.entry("accounts", "Accounts")), + Map.ofEntries(Map.entry("getValue", Map.entry("Map", + Map.entry(List.of(), + 6))), + Map.entry("Counts", Map.entry("void", + Map.entry(List.of("Accounts"), + 1)))))); checkStructure(generatedCode, exprectedStructure); // generateCheckCode(generatedCode);