MCPcopy Create free account
hub / github.com/apache/mesos / main

Method main

src/examples/java/TestFramework.java:208–300  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

206 }
207
208 public static void main(String[] args) throws Exception {
209 if (args.length < 1 || args.length > 2) {
210 usage();
211 System.exit(1);
212 }
213
214 String uri = new File("./test-executor").getCanonicalPath();
215
216 ExecutorInfo executor = ExecutorInfo.newBuilder()
217 .setExecutorId(ExecutorID.newBuilder().setValue("default"))
218 .setCommand(CommandInfo.newBuilder().setValue(uri))
219 .setName("Test Executor (Java)")
220 .setSource("java_test")
221 .build();
222
223 String role = "*";
224
225 FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder()
226 .setUser("") // Have Mesos fill in the current user.
227 .setName("Test Framework (Java)")
228 .setCheckpoint(true)
229 .setRole(role);
230
231 boolean implicitAcknowledgements = true;
232
233 if (System.getenv("MESOS_EXPLICIT_ACKNOWLEDGEMENTS") != null) {
234 System.out.println("Enabling explicit acknowledgements for status updates");
235 implicitAcknowledgements = false;
236 }
237
238 int totalTasks = args.length == 1 ? 5: Integer.parseInt(args[1]);
239 Scheduler scheduler = null;
240
241 // The framework subscribes with all roles suppressed
242 // to test unsuppression via 'updateFramework()'
243 List<String> suppressedRoles = new ArrayList<String>();
244 suppressedRoles.add(role);
245
246 MesosSchedulerDriver driver = null;
247 if (System.getenv("MESOS_EXAMPLE_AUTHENTICATE") != null) {
248 System.out.println("Enabling authentication for the framework");
249
250 if (System.getenv("MESOS_EXAMPLE_PRINCIPAL") == null) {
251 System.err.println("Expecting authentication principal in the environment");
252 System.exit(1);
253 }
254
255 Credential.Builder credentialBuilder = Credential.newBuilder()
256 .setPrincipal(System.getenv("MESOS_EXAMPLE_PRINCIPAL"));
257
258 if (System.getenv("MESOS_EXAMPLE_SECRET") != null) {
259 credentialBuilder.setSecret(System.getenv("MESOS_EXAMPLE_SECRET"));
260 }
261
262 frameworkBuilder.setPrincipal(System.getenv("MESOS_EXAMPLE_PRINCIPAL"));
263 FrameworkInfo framework = frameworkBuilder.build();
264 scheduler = new TestScheduler(
265 implicitAcknowledgements, executor, framework, totalTasks);

Callers

nothing calls this directly

Calls 6

usageMethod · 0.95
runMethod · 0.95
stopMethod · 0.95
exitMethod · 0.80
sleepMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected