Examples of MethodAction


Examples of com.vmware.vim25.MethodAction

 
  static ScheduledTaskSpec createOneTimeSchedulerSpec(
      String taskName, Calendar runTime)
  {
    // specify the action
    MethodAction action = new MethodAction();
    action.setName("PowerOffVM_Task");
    action.setArgument(new MethodActionArgument[] { });

    // specify the schedule
    runTime.add(Calendar.MINUTE, 01);
    OnceTaskScheduler scheduler = new OnceTaskScheduler();
    scheduler.setRunAt(runTime);
View Full Code Here

Examples of com.vmware.vim25.MethodAction

 
  static ScheduledTaskSpec createWeeklySchedulerSpec(
    String taskName)
  {
    // create an action to take snapshot
    MethodAction action = new MethodAction();
    action.setName("CreateSnapshot_Task");
    MethodActionArgument nameArg = new MethodActionArgument();
    nameArg.setValue("My Snapshot");
    MethodActionArgument descArg = new MethodActionArgument();
    descArg.setValue("My Description");
    MethodActionArgument memArg = new MethodActionArgument();
    memArg.setValue(true);
    MethodActionArgument quieArg = new MethodActionArgument();
    quieArg.setValue(true);
    action.setArgument(new MethodActionArgument[]
      {nameArg, descArg, memArg, quieArg });
   
    // run the task only once every week at Saturday midnight
    WeeklyTaskScheduler scheduler = new WeeklyTaskScheduler();
    scheduler.setSaturday(true);
View Full Code Here

Examples of com.vmware.vim25.MethodAction

    return expression;
  }

  static MethodAction createPowerOnAction()
  {
    MethodAction action = new MethodAction();
    action.setName("PowerOnVM_Task");
    MethodActionArgument argument = new MethodActionArgument();
    argument.setValue(null);
    action.setArgument(new MethodActionArgument[] { argument });
    return action;
  }
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        final MockFactory mf = MockFactory.getDefaultInstance();

        // use a vector as we need to return an enumeration for calls to
        // getHeaderNames()
        final Map params = new HashMap();
        request.fuzzy.getParameter(mf.expectsAny()).does(new MethodAction(){
            public Object perform(MethodActionEvent event) throws Throwable {
                return params.get(event.getArguments()[0]);
            }
        }).any();

        StringBuffer url = new StringBuffer(pathInfo);
        char c = '?';
        if (parameters != null) {
            url.append('/');
            for (int i = 0; i < parameters.length; i++) {
                if (parameters[i].length != 2) {
                    throw new IllegalArgumentException(
                        "Supplied parameter " +
                        i +
                        " has incorrect " +
                        "length: expected 2 got " +
                        parameters[i].length);
                }
                url.append(c).append(parameters[i][0]).append("=").append(parameters[i][1]);
                c = '&';
                params.put(parameters[i][0], parameters[i][1]);
            }
        }

        // Hack to enable gif support without having a config file.
        if (enableGif) {
            params.put("v.gifEnabled", "true");
            url.append(c).append("v.gifEnabled=true");
        }

        request.expects.getParameterNames().does(new MethodAction() {
            public Object perform(MethodActionEvent event) throws Throwable {
                return Collections.enumeration(params.keySet());
            }
        }).any();
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        }

        // Perform the action here, rather than while processing events so
        // that the expectation will be satisfied before any additional
        // events are generated by this action.
        MethodAction action = ((MethodInvocationEvent) methodCall).getAction();
        if (action != null) {
            return action.perform(methodCall);
        }

        return null;
    }
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        //   Set Expectations
        // =====================================================================

        final String ref = "ref";
        contextMock.fuzzy.setProperty(Script.class,
                mockFactory.expectsAny(), Boolean.FALSE).does(new MethodAction() {
                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        Script script = (Script) event.getArgument("value",
                                Object.class);
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

    protected void expectAddSimpleElementProcess(
            final DerivableHTTPMessageEntity entity) {

        dynamicProcessMock.fuzzy.addProcess(mockFactory.expectsAny())
                .does(new MethodAction() {
                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        SimpleElementProcess process =
                                (SimpleElementProcess)
                                event.getArgument(XMLProcess.class);
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

     * Add an expectation that the dynamic process will receive an error and
     * throw it.
     */
    protected void addExpectErrorAndThrow() {
        dynamicProcessMock.fuzzy.error(mockFactory.expectsAny())
                .does(new MethodAction() {
                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        Throwable t = (Throwable) event.getArgument(
                                SAXParseException.class);
                        throw t;
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        // ==================================================================
        // Create expectations.
        // ==================================================================

        // Create an action which fakes the iteration.
        MethodAction action = new OutputStylesIterateMethodAction() {
            public void iterate(PseudoStylePathIteratee iteratee) {
                iteratee.next(pseudoStylePathMock);
            }
        };
        outputStylesMock.fuzzy.iterate(mockFactory.expectsInstanceOf(
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        //
        // For piece of mind we will get our WritableCSSEntityMock to actually
        // write something to its supplied writer. That way we know for sure
        // that the servlet works end to end.
        //
        writableCSSEntityMock.expects.write(printWriter).does(new MethodAction() {
            public Object perform(MethodActionEvent event) throws Throwable {
                Writer pw = (Writer) event.getArgument(Writer.class);
                pw.write("foo");
                return null;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.