Skip to content

Commit 3f1a75b

Browse files
committed
wip
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 8c44cd5 commit 3f1a75b

File tree

2 files changed

+71
-70
lines changed

2 files changed

+71
-70
lines changed

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/alleventmode/AbstractAllEventReconciler.java

Lines changed: 14 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,12 @@ public class AbstractAllEventReconciler {
99
public static final String NO_MORE_EXCEPTION_ANNOTATION_KEY = "no.more.exception";
1010

1111
protected volatile boolean useFinalizer = true;
12-
protected volatile boolean throwExceptionOnFirstDeleteEvent = false;
13-
protected volatile boolean throwExceptionIfNoAnnotation = false;
1412

15-
protected volatile boolean waitAfterFirstRetry = false;
16-
protected volatile boolean continuerOnRetryWait = false;
17-
protected volatile boolean waiting = false;
18-
19-
protected volatile boolean isFirstDeleteEvent = true;
13+
private final AtomicInteger eventCounter = new AtomicInteger(0);
2014

21-
private boolean resourceEventPresent = false;
2215
private boolean deleteEventPresent = false;
2316
private boolean eventOnMarkedForDeletion = false;
24-
25-
private final AtomicInteger eventCounter = new AtomicInteger(0);
26-
27-
public boolean isResourceEventPresent() {
28-
return resourceEventPresent;
29-
}
30-
31-
public void setResourceEventPresent(boolean resourceEventPresent) {
32-
this.resourceEventPresent = resourceEventPresent;
33-
}
34-
35-
public boolean isDeleteEventPresent() {
36-
return deleteEventPresent;
37-
}
38-
39-
public void setDeleteEventPresent(boolean deleteEventPresent) {
40-
this.deleteEventPresent = deleteEventPresent;
41-
}
42-
43-
public boolean isEventOnMarkedForDeletion() {
44-
return eventOnMarkedForDeletion;
45-
}
46-
47-
public void setEventOnMarkedForDeletion(boolean eventOnMarkedForDeletion) {
48-
this.eventOnMarkedForDeletion = eventOnMarkedForDeletion;
49-
}
17+
private boolean resourceEventPresent = false;
5018

5119
public int getEventCount() {
5220
return eventCounter.get();
@@ -64,51 +32,27 @@ public void setUseFinalizer(boolean useFinalizer) {
6432
this.useFinalizer = useFinalizer;
6533
}
6634

67-
public boolean isFirstDeleteEvent() {
68-
return isFirstDeleteEvent;
69-
}
70-
71-
public void setFirstDeleteEvent(boolean firstDeleteEvent) {
72-
isFirstDeleteEvent = firstDeleteEvent;
73-
}
74-
75-
public boolean isThrowExceptionOnFirstDeleteEvent() {
76-
return throwExceptionOnFirstDeleteEvent;
77-
}
78-
79-
public void setThrowExceptionOnFirstDeleteEvent(boolean throwExceptionOnFirstDeleteEvent) {
80-
this.throwExceptionOnFirstDeleteEvent = throwExceptionOnFirstDeleteEvent;
81-
}
82-
83-
public boolean isThrowExceptionIfNoAnnotation() {
84-
return throwExceptionIfNoAnnotation;
85-
}
86-
87-
public void setThrowExceptionIfNoAnnotation(boolean throwExceptionIfNoAnnotation) {
88-
this.throwExceptionIfNoAnnotation = throwExceptionIfNoAnnotation;
89-
}
90-
91-
public boolean isWaitAfterFirstRetry() {
92-
return waitAfterFirstRetry;
35+
public boolean isDeleteEventPresent() {
36+
return deleteEventPresent;
9337
}
9438

95-
public void setWaitAfterFirstRetry(boolean waitAfterFirstRetry) {
96-
this.waitAfterFirstRetry = waitAfterFirstRetry;
39+
public void setDeleteEventPresent(boolean deleteEventPresent) {
40+
this.deleteEventPresent = deleteEventPresent;
9741
}
9842

99-
public boolean isContinuerOnRetryWait() {
100-
return continuerOnRetryWait;
43+
public boolean isEventOnMarkedForDeletion() {
44+
return eventOnMarkedForDeletion;
10145
}
10246

103-
public void setContinuerOnRetryWait(boolean continuerOnRetryWait) {
104-
this.continuerOnRetryWait = continuerOnRetryWait;
47+
public void setEventOnMarkedForDeletion(boolean eventOnMarkedForDeletion) {
48+
this.eventOnMarkedForDeletion = eventOnMarkedForDeletion;
10549
}
10650

107-
public boolean isWaiting() {
108-
return waiting;
51+
public boolean isResourceEventPresent() {
52+
return resourceEventPresent;
10953
}
11054

111-
public void setWaiting(boolean waiting) {
112-
this.waiting = waiting;
55+
public void setResourceEventPresent(boolean resourceEventPresent) {
56+
this.resourceEventPresent = resourceEventPresent;
11357
}
11458
}

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/alleventmode/onlyreconcile/AllEventReconciler.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ public class AllEventReconciler extends AbstractAllEventReconciler
1919

2020
private static final Logger log = LoggerFactory.getLogger(AllEventReconciler.class);
2121

22+
private volatile boolean throwExceptionOnFirstDeleteEvent = false;
23+
private volatile boolean throwExceptionIfNoAnnotation = false;
24+
25+
private volatile boolean waitAfterFirstRetry = false;
26+
private volatile boolean continuerOnRetryWait = false;
27+
private volatile boolean waiting = false;
28+
29+
private volatile boolean isFirstDeleteEvent = true;
30+
2231
@Override
2332
public UpdateControl<AllEventCustomResource> reconcile(
2433
AllEventCustomResource primary, Context<AllEventCustomResource> context)
@@ -72,4 +81,52 @@ && isThrowExceptionOnFirstDeleteEvent()) {
7281
log.info("Reconciliation finished");
7382
return UpdateControl.noUpdate();
7483
}
84+
85+
public boolean isFirstDeleteEvent() {
86+
return isFirstDeleteEvent;
87+
}
88+
89+
public void setFirstDeleteEvent(boolean firstDeleteEvent) {
90+
isFirstDeleteEvent = firstDeleteEvent;
91+
}
92+
93+
public boolean isThrowExceptionOnFirstDeleteEvent() {
94+
return throwExceptionOnFirstDeleteEvent;
95+
}
96+
97+
public void setThrowExceptionOnFirstDeleteEvent(boolean throwExceptionOnFirstDeleteEvent) {
98+
this.throwExceptionOnFirstDeleteEvent = throwExceptionOnFirstDeleteEvent;
99+
}
100+
101+
public boolean isThrowExceptionIfNoAnnotation() {
102+
return throwExceptionIfNoAnnotation;
103+
}
104+
105+
public void setThrowExceptionIfNoAnnotation(boolean throwExceptionIfNoAnnotation) {
106+
this.throwExceptionIfNoAnnotation = throwExceptionIfNoAnnotation;
107+
}
108+
109+
public boolean isWaitAfterFirstRetry() {
110+
return waitAfterFirstRetry;
111+
}
112+
113+
public void setWaitAfterFirstRetry(boolean waitAfterFirstRetry) {
114+
this.waitAfterFirstRetry = waitAfterFirstRetry;
115+
}
116+
117+
public boolean isContinuerOnRetryWait() {
118+
return continuerOnRetryWait;
119+
}
120+
121+
public void setContinuerOnRetryWait(boolean continuerOnRetryWait) {
122+
this.continuerOnRetryWait = continuerOnRetryWait;
123+
}
124+
125+
public boolean isWaiting() {
126+
return waiting;
127+
}
128+
129+
public void setWaiting(boolean waiting) {
130+
this.waiting = waiting;
131+
}
75132
}

0 commit comments

Comments
 (0)