Changeset 8 for references/src


Ignore:
Timestamp:
09/30/19 15:37:05 (5 years ago)
Author:
bart
Message:

Added parameter support

Location:
references/src
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • references/src/main/java/geniusweb/references/PartyWithProfile.java

    r1 r8  
    88@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
    99public class PartyWithProfile {
    10         private final PartyRef party;
     10        private final PartyWithParameters party;
    1111        private final ProfileRef profile;
    1212
    1313        @JsonCreator
    14         public PartyWithProfile(@JsonProperty("party") PartyRef party,
     14        public PartyWithProfile(@JsonProperty("party") PartyWithParameters party,
    1515                        @JsonProperty("profile") ProfileRef profile) {
    1616                if (party == null || profile == null) {
     
    2222        }
    2323
    24         public PartyRef getParty() {
     24        public PartyWithParameters getParty() {
    2525                return party;
    2626
  • references/src/test/java/geniusweb/references/PartyWithProfileTest.java

    r1 r8  
    1717import com.fasterxml.jackson.databind.ObjectMapper;
    1818
    19 import geniusweb.references.PartyRef;
    20 import geniusweb.references.PartyWithProfile;
    21 import geniusweb.references.ProfileRef;
    2219import tudelft.utilities.junit.GeneralTests;
    2320
     
    2623        private PartyRef party1, party1a, party2, party3;
    2724        private ProfileRef profile1, profile2;
    28         private PartyWithProfile partyprof1, partyprof1a, partyprof2, partyprof3;
    29         private final String serialized = "{\"party\":\"ws:party1\",\"profile\":\"ws:profile1\"}";
     25        private PartyWithProfile partyprof1, partyprof1a, partyprof2, partyprof3,
     26                        partyprof4;
     27        private final String serialized = "{\"party\":{\"partyref\":\"ws:party1\",\"parameters\":{}},\"profile\":\"ws:profile1\"}";
    3028
    3129        @Before
     
    3937                profile2 = new ProfileRef(new URI("ws:profile2"));
    4038
    41                 partyprof1 = new PartyWithProfile(party1, profile1);
    42                 partyprof1a = new PartyWithProfile(party1, profile1);
    43                 partyprof2 = new PartyWithProfile(party2, profile1);
    44                 partyprof3 = new PartyWithProfile(party1, profile2);
     39                Parameters settings1 = new Parameters();
     40                Parameters settings2 = new Parameters();
     41                settings2.put("a", 1);
     42
     43                PartyWithParameters party1withparams1 = new PartyWithParameters(party1,
     44                                settings1);
     45                PartyWithParameters party1withparams2 = new PartyWithParameters(party1,
     46                                settings2);
     47                PartyWithParameters party2withparams1 = new PartyWithParameters(party2,
     48                                settings1);
     49
     50                partyprof1 = new PartyWithProfile(party1withparams1, profile1);
     51                partyprof1a = new PartyWithProfile(party1withparams1, profile1);
     52                partyprof2 = new PartyWithProfile(party2withparams1, profile1);
     53                partyprof3 = new PartyWithProfile(party1withparams1, profile2);
     54                partyprof4 = new PartyWithProfile(party1withparams2, profile1);
    4555
    4656        }
     
    4959        public List<List<PartyWithProfile>> getGeneralTestData() {
    5060                return Arrays.asList(Arrays.asList(partyprof1, partyprof1a),
    51                                 Arrays.asList(partyprof2), Arrays.asList(partyprof3));
     61                                Arrays.asList(partyprof2), Arrays.asList(partyprof3),
     62                                Arrays.asList(partyprof4));
    5263        }
    5364
     
    5566        public List<String> getGeneralTestStrings() {
    5667                return Arrays.asList(
    57                                 "PartyWithProfile.PartyRef.ws:party1.,ProfileRef.ws:profile1..",
    58                                 "PartyWithProfile.PartyRef.ws:party2.,ProfileRef.ws:profile1..",
    59                                 "PartyWithProfile.PartyRef.ws:party1.,ProfileRef.ws:profile2..");
     68                                "PartyWithProfile.PartyRef.ws:party1.,ProfileRef.ws:profile1.*",
     69                                "PartyWithProfile.PartyRef.ws:party2.,ProfileRef.ws:profile1.*",
     70                                "PartyWithProfile.PartyRef.ws:party1.,ProfileRef.ws:profile2.*",
     71                                "PartyWithProfile.PartyRef.ws:party1.\\{a=1\\},ProfileRef.ws:profile1.*");
    6072        }
    6173
     
    6678        @Test(expected = IllegalArgumentException.class)
    6779        public void nullTest() throws URISyntaxException {
    68                 new PartyWithProfile((PartyRef) null, (ProfileRef) null);
     80                new PartyWithProfile((PartyWithParameters) null, (ProfileRef) null);
    6981        }
    7082
Note: See TracChangeset for help on using the changeset viewer.