* if an I/O error occurs
* @throws FcpException
* if an FCP error occurs
+ * @deprecated Use {@link #getOwnIdentities()} instead
*/
+ @Deprecated
public Set<OwnIdentity> getOwnIdentites() throws IOException, FcpException {
+ return getOwnIdentities();
+ }
+
+ /**
+ * Returns all own identities of the web-of-trust plugins. Almost all other
+ * commands require an {@link OwnIdentity} to return meaningful values.
+ *
+ * @return All own identities of the web-of-trust plugin
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws FcpException
+ * if an FCP error occurs
+ */
+ public Set<OwnIdentity> getOwnIdentities() throws IOException, FcpException {
Map<String, String> replies = fcpClient.sendPluginMessage(webOfTrustPluginName, createParameters("Message", "GetOwnIdentities"));
if (!replies.get("Message").equals("OwnIdentities")) {
throw new FcpException("WebOfTrust Plugin did not reply with “OwnIdentities” message!");
public void gettingOwnIdentitiesSendsCorrectMessage() throws Exception {
TestFcpConnection fcpConnection = createConnectionThatDeliversOwnIdentities();
WebOfTrustPlugin webOfTrustPlugin = createWebOfTrustPlugin(fcpConnection);
- webOfTrustPlugin.getOwnIdentites();
+ webOfTrustPlugin.getOwnIdentities();
assertThat(fcpConnection.sentMessages.get(0), allOf(
isNamed(equalTo("FCPPluginMessage")),
hasField("Identifier", not(nullValue())),
public void gettingOwnIdentitiesParsesOwnIdentitiesCorrectly() throws Exception {
TestFcpConnection fcpConnection = createConnectionThatDeliversOwnIdentities();
WebOfTrustPlugin webOfTrustPlugin = createWebOfTrustPlugin(fcpConnection);
+ Set<OwnIdentity> ownIdentities = webOfTrustPlugin.getOwnIdentities();
+ assertThat(ownIdentities, containsInAnyOrder(
+ allOf(isOwnIdentity(equalTo("identity-0"), equalTo("Nick 0"), equalTo("request-uri-0"), equalTo("insert-uri-0")),
+ hasContexts(containsInAnyOrder("test-context-1", "test-context-2")),
+ hasProperties(allOf(aMapWithSize(2), hasEntry("prop1", "value1"), hasEntry("prop2", "value2")))),
+ allOf(isOwnIdentity(equalTo("identity-1"), equalTo("Nick 1"), equalTo("request-uri-1"), equalTo("insert-uri-1")),
+ hasContexts(containsInAnyOrder("test-context-2", "test-context-3")),
+ hasProperties(allOf(aMapWithSize(2), hasEntry("prop3", "value3"), hasEntry("prop4", "value4"))))
+ ));
+ }
+
+ @Test
+ public void gettingOwnIdentitiesUsingDeprecatedMethodSendsCorrectMessage() throws Exception {
+ TestFcpConnection fcpConnection = createConnectionThatDeliversOwnIdentities();
+ WebOfTrustPlugin webOfTrustPlugin = createWebOfTrustPlugin(fcpConnection);
+ webOfTrustPlugin.getOwnIdentites();
+ assertThat(fcpConnection.sentMessages.get(0), allOf(
+ isNamed(equalTo("FCPPluginMessage")),
+ hasField("Identifier", not(nullValue())),
+ hasField("PluginName", equalTo("plugins.WebOfTrust.WebOfTrust")),
+ hasField("Param.Message", equalTo("GetOwnIdentities"))
+ ));
+ }
+
+ @Test
+ public void gettingOwnIdentitiesUsingDeprecatedMethodParsesOwnIdentitiesCorrectly() throws Exception {
+ TestFcpConnection fcpConnection = createConnectionThatDeliversOwnIdentities();
+ WebOfTrustPlugin webOfTrustPlugin = createWebOfTrustPlugin(fcpConnection);
Set<OwnIdentity> ownIdentities = webOfTrustPlugin.getOwnIdentites();
assertThat(ownIdentities, containsInAnyOrder(
allOf(isOwnIdentity(equalTo("identity-0"), equalTo("Nick 0"), equalTo("request-uri-0"), equalTo("insert-uri-0")),