Examples of ResponseGenerator


Examples of org.apache.cloudstack.api.ResponseGenerator

                    .thenReturn(userVm);
        }catch (Exception e){
            Assert.fail("Received exception when success expected " +e.getMessage());
        }

        ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
        scaleVMCmd._responseGenerator = responseGenerator;

        UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
        //List<UserVmResponse> list = Mockito.mock(UserVmResponse.class);
        //list.add(userVmResponse);
        //LinkedList<UserVmResponse> mockedList = Mockito.mock(LinkedList.class);
        //Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);

        List<UserVmResponse> list = new LinkedList<UserVmResponse>();
        list.add(userVmResponse);

        Mockito.when(responseGenerator.createUserVmResponse("virtualmachine", userVm)).thenReturn(
                list);

        scaleVMCmd._userVmService = userVmService;

        scaleVMCmd.execute();
View Full Code Here

Examples of org.apache.cloudstack.api.ResponseGenerator

        ImageStore store = Mockito.mock(ImageStore.class);

        Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
                .thenReturn(store);

        ResponseGenerator responseGenerator = Mockito
                .mock(ResponseGenerator.class);
        addImageStoreCmd._responseGenerator = responseGenerator;

        ImageStoreResponse responseHost = new ImageStoreResponse();
        responseHost.setName("Test");

        Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(
                responseHost);

        addImageStoreCmd.execute();

        Mockito.verify(responseGenerator).createImageStoreResponse(store);
View Full Code Here

Examples of org.apache.cloudstack.api.ResponseGenerator

            Mockito.when(userVmService.upgradeVirtualMachine(scaleVMCmd)).thenReturn(userVm);
        } catch (Exception e) {
            Assert.fail("Received exception when success expected " + e.getMessage());
        }

        ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
        scaleVMCmd._responseGenerator = responseGenerator;

        UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
        //List<UserVmResponse> list = Mockito.mock(UserVmResponse.class);
        //list.add(userVmResponse);
        //LinkedList<UserVmResponse> mockedList = Mockito.mock(LinkedList.class);
        //Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);

        List<UserVmResponse> list = new LinkedList<UserVmResponse>();
        list.add(userVmResponse);

        Mockito.when(responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", userVm)).thenReturn(
                list);

        scaleVMCmd._userVmService = userVmService;

        scaleVMCmd.execute();
View Full Code Here

Examples of org.apache.cloudstack.api.ResponseGenerator

        ImageStore store = Mockito.mock(ImageStore.class);

        Mockito.when(resourceService.discoverImageStore(anyString(), anyString(), anyString(), anyLong(), (Map)anyObject()))
                .thenReturn(store);

        ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
        addImageStoreCmd._responseGenerator = responseGenerator;

        ImageStoreResponse responseHost = new ImageStoreResponse();
        responseHost.setName("Test");

        Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(responseHost);

        addImageStoreCmd.execute();

        Mockito.verify(responseGenerator).createImageStoreResponse(store);
View Full Code Here

Examples of org.apache.cloudstack.api.ResponseGenerator

                    .thenReturn(swift);
        } catch (DiscoveryException e) {
            e.printStackTrace();
        }

        ResponseGenerator responseGenerator = Mockito
                .mock(ResponseGenerator.class);
        addSwiftCmd._responseGenerator = responseGenerator;

        SwiftResponse swiftResponse = Mockito.mock(SwiftResponse.class);

        Mockito.when(responseGenerator.createSwiftResponse(swift)).thenReturn(
                swiftResponse);

        addSwiftCmd.execute();

    }
View Full Code Here

Examples of org.apache.cloudstack.api.ResponseGenerator

        Host[] mockHosts = new Host[] { host };

        Mockito.when(resourceService.discoverHosts(addSecondaryStorageCmd))
                .thenReturn(Arrays.asList(mockHosts));

        ResponseGenerator responseGenerator = Mockito
                .mock(ResponseGenerator.class);
        addSecondaryStorageCmd._responseGenerator = responseGenerator;

        HostResponse responseHost = new HostResponse();
        responseHost.setName("Test");

        Mockito.when(responseGenerator.createHostResponse(host)).thenReturn(
                responseHost);

        addSecondaryStorageCmd.execute();

        Mockito.verify(responseGenerator).createHostResponse(host);
View Full Code Here

Examples of org.apache.cloudstack.api.ResponseGenerator

        ImageStore store = Mockito.mock(ImageStore.class);

        Mockito.when(resourceService.discoverImageStore(anyString(), anyString(), anyString(), anyLong(), (Map)anyObject()))
                .thenReturn(store);

        ResponseGenerator responseGenerator = Mockito
                .mock(ResponseGenerator.class);
        addImageStoreCmd._responseGenerator = responseGenerator;

        ImageStoreResponse responseHost = new ImageStoreResponse();
        responseHost.setName("Test");

        Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(
                responseHost);

        addImageStoreCmd.execute();

        Mockito.verify(responseGenerator).createImageStoreResponse(store);
View Full Code Here

Examples of org.infinispan.remoting.responses.ResponseGenerator

      // initialize this command with components specific to the intended cache instance
      commandsFactory.initializeReplicableCommand(cmd, true);

      try {
         log.tracef("Calling perform() on %s", cmd);
         ResponseGenerator respGen = cr.getComponent(ResponseGenerator.class);
         Object retval = cmd.perform(null);
         return respGen.getResponse(cmd, retval);
      } catch (Exception e) {
         return new ExceptionResponse(e);
      }
   }
View Full Code Here

Examples of org.infinispan.remoting.responses.ResponseGenerator

      // initialize this command with components specific to the intended cache instance
      commandsFactory.initializeReplicableCommand(cmd, true);
      try {
         if (trace) log.tracef("Calling perform() on %s", cmd);
         ResponseGenerator respGen = cr.getResponseGenerator();
         if(cmd instanceof CancellableCommand){
            cancelService.register(Thread.currentThread(), ((CancellableCommand)cmd).getUUID());
         }
         Object retval = cmd.perform(null);
         Response response = respGen.getResponse(cmd, retval);
         log.tracef("About to send back response %s for command %s", response, cmd);
         return response;
      } catch (Exception e) {
         log.trace("Exception executing command", e);
         return new ExceptionResponse(e);
View Full Code Here

Examples of org.infinispan.remoting.responses.ResponseGenerator

      // initialize this command with components specific to the intended cache instance
      commandsFactory.initializeReplicableCommand(cmd, true);

      try {
         log.tracef("Calling perform() on %s", cmd);
         ResponseGenerator respGen = cr.getComponent(ResponseGenerator.class);
         Object retval = cmd.perform(null);
         return respGen.getResponse(cmd, retval);
      } catch (Exception e) {
         return new ExceptionResponse(e);
      }
   }
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.