@@ -15,7 +15,8 @@ public class GenericUtils {
15
15
protected static final String MOCK_ELASTIC_ID = "mockElasticResource" ;
16
16
protected static final String MEDIUM_ELASTIC_ID = "mediumElasticResource" ;
17
17
protected static final String LIGHT_ELASTIC_ID = "lightElasticResource" ;
18
- protected static final String HEAVY_INELASTIC_ID = "heavyInElasRest" ;
18
+ protected static final String HEAVY_INELASTIC_ID = "heavyInElasticResource" ;
19
+ protected static final String LIGHT_INELASTIC_ID = "lightInElasticResource" ;
19
20
20
21
public AccessMode getAccessModeHeavyInElasticResource () {
21
22
return new AccessMode (new AccessModeTypes (READWRITE ), false , 1 , this .getHeavyInelasticResource ());
@@ -79,20 +80,32 @@ public Resource getLightElasticResource() {
79
80
List <Capacity > requiredCapacities = new LinkedList <>();
80
81
requiredCapacities .add (new Capacity ("memory" , 1 ));
81
82
requiredCapacities .add (new Capacity ("processor" , 0.5 ));
82
- return new Resource (LIGHT_ELASTIC_ID , new LinkedList <>(), new LinkedList <>(), getElasticityModelLightElasticResource (),
83
+ List <String > hierarchy = new LinkedList <>();
84
+ hierarchy .add ("elasticParent" );
85
+ List <String > rep =new LinkedList <>();
86
+ rep .add ("lightInElasticResource" );
87
+ return new Resource (LIGHT_ELASTIC_ID , hierarchy , rep , getElasticityModelLightElasticResource (),
83
88
Resource .type .LOGICAL , requiredCapacities , "someplaceholder2[IMG:]someimage" );
84
89
}
85
90
86
91
public Resource getMockElasticResource () {
87
92
List <Capacity > requiredCapacities = new LinkedList <>();
88
- requiredCapacities .add (new Capacity ("memory" , 0.5 ));
89
- requiredCapacities .add (new Capacity ("processor" , 2.0 ));
93
+ requiredCapacities .add (new Capacity ("memory" , 0.2 ));
94
+ requiredCapacities .add (new Capacity ("processor" , 0.5 ));
90
95
91
96
List <String > replaceableResources = new LinkedList <>();
92
97
replaceableResources .add (LIGHT_ELASTIC_ID );
93
98
replaceableResources .add (HEAVY_INELASTIC_ID );
99
+ replaceableResources .add (MEDIUM_ELASTIC_ID );
100
+ replaceableResources .add (LIGHT_INELASTIC_ID );
101
+
102
+
103
+
104
+ List <String > hierarchy = new LinkedList <>();
105
+ hierarchy .add ("elasticParent" );
94
106
95
- return new Resource ("mockElasticResource" , new LinkedList <>(), replaceableResources , this .getElasticityModelMockResource (),
107
+
108
+ return new Resource (MOCK_ELASTIC_ID , hierarchy , replaceableResources , this .getElasticityModelMockResource (),
96
109
Resource .type .LOGICAL , requiredCapacities , "someplaceholder1[IMG:]someimage" );
97
110
}
98
111
@@ -109,9 +122,17 @@ public Resource getMediumInelasticResource() {
109
122
110
123
public Resource getMediumElasticResource () {
111
124
ElasticityModel mediumElasModel = getElasticityModelMockResource ();
112
- mediumElasModel .setElasticityCost (5 );
113
- return new Resource (MEDIUM_ELASTIC_ID , new LinkedList <>(), new LinkedList <>(), mediumElasModel ,
114
- Resource .type .LOGICAL , new LinkedList <>(), "someplaceholder2[IMG:]someimage" );
125
+ mediumElasModel .setElasticityID ("elasModelMediumElasticResource" );
126
+ mediumElasModel .setElasticity (10 );
127
+ mediumElasModel .setElasticityCost (35.0 );
128
+ List <String > hierarchy = new LinkedList <>();
129
+ hierarchy .add ("elasticParent" );
130
+ List <Capacity > listCapacities = new LinkedList <>();
131
+ listCapacities .add (new Capacity ("memory" , 2.5 ));
132
+ listCapacities .add (new Capacity ("processor" , 2 ));
133
+
134
+ return new Resource (MEDIUM_ELASTIC_ID , hierarchy , new LinkedList <>(), mediumElasModel ,
135
+ Resource .type .LOGICAL , listCapacities , "someplaceholder2[IMG:]someimage" );
115
136
}
116
137
117
138
public Resource getHeavyInelasticResource () {
@@ -124,6 +145,21 @@ public Resource getHeavyInelasticResource() {
124
145
return new Resource (HEAVY_INELASTIC_ID , hierarchyParents , new LinkedList <>(), getElasticityModelHeavyInelasticResource (),
125
146
Resource .type .LOGICAL , requiredCapacities , "someplaceholder2[IMG:]someimage" );
126
147
}
148
+ public Resource getLightInelasticResource () {
149
+ Resource res = new Resource (this .getHeavyInelasticResource ());
150
+ res .setResourceID (LIGHT_INELASTIC_ID );
151
+ ElasticityModel elasLight = new ElasticityModel ("elasModelLightInElasticResource" );
152
+ elasLight .setElasticity (1 );
153
+ elasLight .setElasticityCost (50 );
154
+ res .setElasticityModel (elasLight );
155
+ res .setReplaceable (new LinkedList <>());
156
+ res .addReplaceableResource (LIGHT_ELASTIC_ID );
157
+ List <Capacity > requiredCap =new LinkedList <>();
158
+ requiredCap .add (new Capacity ("processor" ,0.5 ));
159
+ requiredCap .add (new Capacity ("memory" ,1 ));
160
+ res .setMinimalCapacities (requiredCap );
161
+ return res ;
162
+ }
127
163
128
164
public Resource getNewMockElasticResource () {
129
165
Resource mockElasticResource = new Resource (this .getMediumElasticResource ());
0 commit comments