projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Actually remove trust when setting it null.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
WebOfTrustUpdater.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
b/src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
index
dd3de58
..
9ad6478
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
+++ b/
src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdater.java
@@
-34,6
+34,7
@@
import net.pterodactylus.sone.freenet.wot.WebOfTrustException;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.service.AbstractService;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.service.AbstractService;
+import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Inject;
/**
import com.google.inject.Inject;
/**
@@
-258,7
+259,8
@@
public class WebOfTrustUpdater extends AbstractService {
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- private class WebOfTrustUpdateJob {
+ @VisibleForTesting
+ class WebOfTrustUpdateJob implements Runnable {
/** Object for synchronization. */
@SuppressWarnings("hiding")
/** Object for synchronization. */
@SuppressWarnings("hiding")
@@
-279,6
+281,7
@@
public class WebOfTrustUpdater extends AbstractService {
* <p/>
* The implementation of this class does nothing.
*/
* <p/>
* The implementation of this class does nothing.
*/
+ @Override
public void run() {
/* does nothing. */
}
public void run() {
/* does nothing. */
}
@@
-369,14
+372,10
@@
public class WebOfTrustUpdater extends AbstractService {
public void run() {
try {
if (score != null) {
public void run() {
try {
if (score != null) {
- if (trustee instanceof DefaultIdentity) {
- ((DefaultIdentity) trustee).setTrust(truster, new Trust(score, null, 0));
- }
+ trustee.setTrust(truster, new Trust(score, null, 0));
webOfTrustConnector.setTrust(truster, trustee, score, comment);
} else {
webOfTrustConnector.setTrust(truster, trustee, score, comment);
} else {
- if (trustee instanceof DefaultIdentity) {
- ((DefaultIdentity) trustee).setTrust(truster, null);
- }
+ trustee.removeTrust(truster);
webOfTrustConnector.removeTrust(truster, trustee);
}
finish(true);
webOfTrustConnector.removeTrust(truster, trustee);
}
finish(true);
@@
-419,7
+418,8
@@
public class WebOfTrustUpdater extends AbstractService {
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- private class WebOfTrustContextUpdateJob extends WebOfTrustUpdateJob {
+ @VisibleForTesting
+ class WebOfTrustContextUpdateJob extends WebOfTrustUpdateJob {
/** The own identity whose contexts to manage. */
protected final OwnIdentity ownIdentity;
/** The own identity whose contexts to manage. */
protected final OwnIdentity ownIdentity;
@@
-474,7
+474,8
@@
public class WebOfTrustUpdater extends AbstractService {
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- private class AddContextJob extends WebOfTrustContextUpdateJob {
+ @VisibleForTesting
+ class AddContextJob extends WebOfTrustContextUpdateJob {
/**
* Creates a new add-context job.
/**
* Creates a new add-context job.
@@
-509,7
+510,8
@@
public class WebOfTrustUpdater extends AbstractService {
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- private class RemoveContextJob extends WebOfTrustContextUpdateJob {
+ @VisibleForTesting
+ class RemoveContextJob extends WebOfTrustContextUpdateJob {
/**
* Creates a new remove-context job.
/**
* Creates a new remove-context job.
@@
-544,7
+546,8
@@
public class WebOfTrustUpdater extends AbstractService {
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
- private class SetPropertyJob extends WebOfTrustUpdateJob {
+ @VisibleForTesting
+ class SetPropertyJob extends WebOfTrustUpdateJob {
/** The own identity to update properties on. */
private final OwnIdentity ownIdentity;
/** The own identity to update properties on. */
private final OwnIdentity ownIdentity;