Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public void setAnnotation(String name, String value) {
ModelNode annotations = get(ANNOTATIONS);
annotations.get(name).set(value);
}

@Override
public void removeAnnotation(String name) {
ModelNode annotations = get(ANNOTATIONS);
annotations.remove(name);
}

@Override
public boolean isAnnotatedWith(String key) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/openshift/restclient/model/IResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ public interface IResource extends ICapable {
*/
void setAnnotation(String key, String value);

/**
* Removes the resource annotation
* @param key
*/
void removeAnnotation(String key);

/**
* Retrieves the annotations associated with the resource
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static com.openshift.internal.util.JBossDmrExtentions.*;

Expand Down Expand Up @@ -78,6 +79,12 @@ public void testSetAnnoation() {
public void testGetAnnotation() {
assertEquals("bar", resource.getAnnotation("foo"));
}

@Test
public void removeAnnotation() {
resource.removeAnnotation("foo");
assertNull(resource.getAnnotation("foo"));
}

@Test
public void isAnnotatedReturnsTrueForKnownAnnotation() {
Expand Down