- Timestamp:
- 01/28/20 10:19:54 (5 years ago)
- Location:
- party/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
party/src/main/java/geniusweb/party/Capabilities.java
r1 r10 5 5 import com.fasterxml.jackson.annotation.JsonAutoDetect; 6 6 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; 7 8 import geniusweb.references.ProtocolRef;9 10 7 import com.fasterxml.jackson.annotation.JsonCreator; 11 8 import com.fasterxml.jackson.annotation.JsonProperty; … … 19 16 * List of supported protocols 20 17 */ 21 private final Set< ProtocolRef> protocols;18 private final Set<String> behaviours; 22 19 23 20 /** … … 26 23 */ 27 24 @JsonCreator 28 public Capabilities(@JsonProperty(" protocols") Set<ProtocolRef> protocols) {29 if ( protocols == null) {30 throw new IllegalArgumentException(" protocols==null");25 public Capabilities(@JsonProperty("behaviours") Set<String> behaviours) { 26 if (behaviours == null) { 27 throw new IllegalArgumentException("behaviours==null"); 31 28 } 32 this. protocols = protocols;29 this.behaviours = behaviours; 33 30 } 34 31 35 public Set< ProtocolRef> getProtocols() {36 return protocols;32 public Set<String> getBehaviours() { 33 return behaviours; 37 34 } 38 35 … … 42 39 int result = 1; 43 40 result = prime * result 44 + (( protocols == null) ? 0 : protocols.hashCode());41 + ((behaviours == null) ? 0 : behaviours.hashCode()); 45 42 return result; 46 43 } … … 55 52 return false; 56 53 Capabilities other = (Capabilities) obj; 57 if ( protocols == null) {58 if (other. protocols != null)54 if (behaviours == null) { 55 if (other.behaviours != null) 59 56 return false; 60 } else if (! protocols.equals(other.protocols))57 } else if (!behaviours.equals(other.behaviours)) 61 58 return false; 62 59 return true; … … 65 62 @Override 66 63 public String toString() { 67 return "Capabilities[" + " Protocols=" + protocols + "]";64 return "Capabilities[" + "Behaviours=" + behaviours + "]"; 68 65 } 69 66 -
party/src/main/java/geniusweb/party/inform/Inform.java
r1 r10 3 3 import com.fasterxml.jackson.annotation.JsonAutoDetect; 4 4 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; 5 import com.fasterxml.jackson.annotation.JsonSubTypes; 6 import com.fasterxml.jackson.annotation.JsonTypeInfo; 5 7 6 8 import geniusweb.party.Party; 7 8 import com.fasterxml.jackson.annotation.JsonSubTypes;9 import com.fasterxml.jackson.annotation.JsonTypeInfo;10 9 11 10 /** -
party/src/test/java/geniusweb/party/CapabilitiesTest.java
r1 r10 4 4 5 5 import java.io.IOException; 6 import java.net.URI;7 6 import java.net.URISyntaxException; 8 7 import java.util.Arrays; … … 18 17 import com.fasterxml.jackson.databind.ObjectMapper; 19 18 20 import geniusweb.party.Capabilities;21 import geniusweb.references.ProtocolRef;22 19 import tudelft.utilities.junit.GeneralTests; 23 20 … … 26 23 private Capabilities capabilities1, capabilities1a, capabilities2, 27 24 capabilities3; 28 private String asJson = "{\" protocols\":[\"ws:localhost/protocol1\"]}";25 private String asJson = "{\"behaviours\":[\"SAOP\"]}"; 29 26 30 27 @Before 31 28 public void before() throws URISyntaxException { 32 capabilities1 = new Capabilities(Sets 33 .newSet(new ProtocolRef(new URI("ws:localhost/protocol1")))); 34 capabilities1a = new Capabilities(Sets 35 .newSet(new ProtocolRef(new URI("ws:localhost/protocol1")))); 36 capabilities2 = new Capabilities(Sets 37 .newSet(new ProtocolRef(new URI("ws:localhost/protocol2")))); 38 capabilities3 = new Capabilities(Sets 39 .newSet(new ProtocolRef(new URI("ws:localhost/protocol3")))); 29 capabilities1 = new Capabilities(Sets.newSet("SAOP")); 30 capabilities1a = new Capabilities(Sets.newSet("SAOP")); 31 capabilities2 = new Capabilities(Sets.newSet("SEB")); 32 capabilities3 = new Capabilities(Sets.newSet("SEB", "SAOP")); 40 33 } 41 34 … … 48 41 @Override 49 42 public List<String> getGeneralTestStrings() { 50 return Arrays.asList( 51 "Capabilities.*Protocols=.*ProtocolRef.*protocol1.*", 52 "Capabilities.*Protocols=.*ProtocolRef.*protocol2.*", 53 "Capabilities.*Protocols=.*ProtocolRef.*protocol3.*"); 43 return Arrays.asList("Capabilities.*Behaviours=.*SAOP.*", 44 "Capabilities.*Behaviours=.*SEB.*", 45 "Capabilities.*Behaviours=.*SEB.*SAOP.*"); 54 46 } 55 47
Note:
See TracChangeset
for help on using the changeset viewer.