Java 类org.eclipse.debug.core.model.IStreamsProxy2 实例源码

项目:thym    文件:HybridProjectTest.java   
private CordovaProjectCLI setupMockCLI(HybridProject project) throws CoreException {
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams = mock(IStreamsProxy2.class);
    CordovaProjectCLI mockCLI = spy(CordovaProjectCLI.newCLIforProject(mockProject));

    doReturn(mockProcess).when(mockCLI).startShell(any(IStreamListener.class), any(IProgressMonitor.class),
            any(ILaunchConfiguration.class));

    when(mockProcess.getStreamsProxy()).thenReturn(mockStreams);
    when(mockProcess.isTerminated()).thenReturn(Boolean.TRUE);

    doReturn(mockCLI).when(project).getProjectCLI();
    return mockCLI;
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testAdditionalEnvProperties() throws CoreException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);
    ArgumentCaptor<ILaunchConfiguration> confCaptor = ArgumentCaptor.forClass(ILaunchConfiguration.class);
    mockCLI.prepare(new NullProgressMonitor(), "android");
    verify(mockCLI).startShell(any(IStreamListener.class), any(IProgressMonitor.class), confCaptor.capture());
    Map<String,String> attr = confCaptor.getValue().getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<String,String>)null);
    assertEquals(EnvironmentPropsExt.ENV_VALUE, attr.get(EnvironmentPropsExt.ENV_KEY));
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testGeneratedPrepareCommandCorrectly() throws CoreException, IOException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);
    mockCLI.prepare(new NullProgressMonitor(), "android");
    verify(mockStreams).write("cordova prepare android\n");
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testGeneratedPluginCommandCorrectlyForREMOVE() throws CoreException,IOException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.plugin(Command.REMOVE, new NullProgressMonitor(), "cordova-plugin-console", CordovaProjectCLI.OPTION_SAVE);
    verify(mockStreams).write("cordova plugin remove cordova-plugin-console --save\n");
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testGeneratedPlatformCommandCorrectlyForREMOVE() throws CoreException,IOException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.platform(Command.REMOVE, new NullProgressMonitor(), "ios", CordovaProjectCLI.OPTION_SAVE);
    verify(mockStreams).write("cordova platform remove ios --save\n");
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testGeneratedBuildCommandCorrectly() throws CoreException,IOException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.build(new NullProgressMonitor(), "ios");
    verify(mockStreams).write("cordova build ios\n");
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testGeneratedRunCommandCorrectly() throws CoreException,IOException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.run(new NullProgressMonitor(), "android");
    verify(mockStreams).write("cordova run android\n");
}
项目:thym    文件:CordovaProjectCLITest.java   
@Test
public void testGeneratedEmulateCommandCorrectly() throws CoreException,IOException{
    CordovaProjectCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.emulate(new NullProgressMonitor(), "windows");
    verify(mockStreams).write("cordova emulate windows\n");
}
项目:thym    文件:CordovaCLITest.java   
@Test
  public void testAdditionalEnvProperties() throws CoreException{
CordovaCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);

    ArgumentCaptor<ILaunchConfiguration> confCaptor = ArgumentCaptor.forClass(ILaunchConfiguration.class);
    mockCLI.version(new NullProgressMonitor());
    verify(mockCLI).startShell(any(IStreamListener.class), any(IProgressMonitor.class), confCaptor.capture());
    Map<String,String> attr = confCaptor.getValue().getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<String,String>)null);
    assertEquals(EnvironmentPropsExt.ENV_VALUE, attr.get(EnvironmentPropsExt.ENV_KEY));
  }
项目:thym    文件:CordovaCLITest.java   
@Test
public void testGeneratedVersionCommandCorrectly() throws CoreException,IOException{
    CordovaCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.version(new NullProgressMonitor());
    verify(mockStreams).write("cordova -version\n");
}
项目:thym    文件:CordovaCLITest.java   
@Test
public void testGeneratedNodeVersionCommandCorrectly() throws CoreException,IOException{
    CordovaCLI mockCLI = getMockCLI();
    IProcess mockProcess = mock(IProcess.class);
    IStreamsProxy2 mockStreams  = mock(IStreamsProxy2.class);
    setupMocks(mockCLI, mockProcess, mockStreams);      
    mockCLI.nodeVersion(new NullProgressMonitor());
    verify(mockStreams).write("node -v\n");
}
项目:thym    文件:CordovaProjectCLITest.java   
private void setupMocks(CordovaCLI mockCLI, IProcess mockProcess, IStreamsProxy2 mockStreams) throws CoreException {
    doReturn(mockProcess).when(mockCLI).startShell(any(IStreamListener.class), any(IProgressMonitor.class),any(ILaunchConfiguration.class));
    when(mockProcess.getStreamsProxy()).thenReturn(mockStreams);
    when(mockProcess.isTerminated()).thenReturn(Boolean.TRUE);
}
项目:thym    文件:CordovaCLITest.java   
private void setupMocks(CordovaCLI mockCLI, IProcess mockProcess, IStreamsProxy2 mockStreams) throws CoreException {
    doReturn(mockProcess).when(mockCLI).startShell(any(IStreamListener.class), any(IProgressMonitor.class),any(ILaunchConfiguration.class));
    when(mockProcess.getStreamsProxy()).thenReturn(mockStreams);
    when(mockProcess.isTerminated()).thenReturn(Boolean.TRUE);
}