@@ -46,7 +46,7 @@ public class TestClustersPlugin implements Plugin<Project> {
46
46
47
47
@ Override
48
48
public void apply (Project project ) {
49
- NamedDomainObjectContainer <? extends ElasticsearchConfiguration > container = project .container (
49
+ NamedDomainObjectContainer <? extends ElasticsearchNode > container = project .container (
50
50
ElasticsearchNode .class ,
51
51
(name ) -> new ElasticsearchNode (name , GradleServicesAdapter .getInstance (project ))
52
52
);
@@ -56,12 +56,12 @@ public void apply(Project project) {
56
56
listTask .setGroup ("ES cluster formation" );
57
57
listTask .setDescription ("Lists all ES clusters configured for this project" );
58
58
listTask .doLast ((Task task ) ->
59
- container .forEach ((ElasticsearchConfiguration cluster ) ->
59
+ container .forEach ((ElasticsearchNode cluster ) ->
60
60
logger .lifecycle (" * {}: {}" , cluster .getName (), cluster .getDistribution ())
61
61
)
62
62
);
63
63
64
- Map <Task , List <ElasticsearchConfiguration >> taskToCluster = new HashMap <>();
64
+ Map <Task , List <ElasticsearchNode >> taskToCluster = new HashMap <>();
65
65
66
66
// register an extension for all current and future tasks, so that any task can declare that it wants to use a
67
67
// specific cluster.
@@ -70,7 +70,7 @@ public void apply(Project project) {
70
70
.set (
71
71
"useCluster" ,
72
72
new Closure <Void >(this , this ) {
73
- public void doCall (ElasticsearchConfiguration conf ) {
73
+ public void doCall (ElasticsearchNode conf ) {
74
74
taskToCluster .computeIfAbsent (task , k -> new ArrayList <>()).add (conf );
75
75
}
76
76
})
@@ -79,15 +79,15 @@ public void doCall(ElasticsearchConfiguration conf) {
79
79
project .getGradle ().getTaskGraph ().whenReady (taskExecutionGraph ->
80
80
taskExecutionGraph .getAllTasks ()
81
81
.forEach (task ->
82
- taskToCluster .getOrDefault (task , Collections .emptyList ()).forEach (ElasticsearchConfiguration ::claim )
82
+ taskToCluster .getOrDefault (task , Collections .emptyList ()).forEach (ElasticsearchNode ::claim )
83
83
)
84
84
);
85
85
project .getGradle ().addListener (
86
86
new TaskActionListener () {
87
87
@ Override
88
88
public void beforeActions (Task task ) {
89
89
// we only start the cluster before the actions, so we'll not start it if the task is up-to-date
90
- taskToCluster .getOrDefault (task , new ArrayList <>()).forEach (ElasticsearchConfiguration ::start );
90
+ taskToCluster .getOrDefault (task , new ArrayList <>()).forEach (ElasticsearchNode ::start );
91
91
}
92
92
@ Override
93
93
public void afterActions (Task task ) {}
@@ -99,7 +99,7 @@ public void afterActions(Task task) {}
99
99
public void afterExecute (Task task , TaskState state ) {
100
100
// always un-claim the cluster, even if _this_ task is up-to-date, as others might not have been and caused the
101
101
// cluster to start.
102
- taskToCluster .getOrDefault (task , new ArrayList <>()).forEach (ElasticsearchConfiguration ::unClaimAndStop );
102
+ taskToCluster .getOrDefault (task , new ArrayList <>()).forEach (ElasticsearchNode ::unClaimAndStop );
103
103
}
104
104
@ Override
105
105
public void beforeExecute (Task task ) {}
0 commit comments