use of org.jboss.tools.openshift.internal.ui.models.ConnectionWrapper in project jbosstools-openshift by jbosstools.
the class ConnectionWrapperTest method prepareData.
@Before
public void prepareData() throws Exception {
this.project = mock(IProject.class);
when(project.getName()).thenReturn(NAMESPACE);
when(project.getNamespaceName()).thenReturn(NAMESPACE);
IOpenShiftConnection connection = mock(IOpenShiftConnection.class);
when(connection.isDefaultHost()).thenReturn(true);
when(connection.getUsername()).thenReturn("bdshadow");
when(connection.getResources(eq(ResourceKind.PROJECT))).thenReturn(Arrays.asList(new IResource[] { project }));
// by doing this we call a protected OpenshiftUIModel constructor, which adds listener to the
OpenshiftUIModel.getInstance();
// ConnectionsRegistrySingleton
ConnectionsRegistrySingleton.getInstance().add(connection);
ConnectionWrapper connectionWrapper = OpenshiftUIModel.getInstance().getConnectionWrapperForConnection(connection);
connectionWrapper.refresh();
this.projectWrapper = (ProjectWrapper) connectionWrapper.getResources().iterator().next();
this.resource = mock(IBuildConfig.class);
when(this.resource.getKind()).thenReturn(ResourceKind.BUILD_CONFIG);
when(this.resource.getNamespaceName()).thenReturn(NAMESPACE);
when(this.resource.getProject()).thenReturn(project);
this.watchListener = new WatchListenerTestable(WatchManager.getInstance(), project, connection, ResourceKind.BUILD_CONFIG, 0, 0);
watchListener.setState("CONNECTED");
}
use of org.jboss.tools.openshift.internal.ui.models.ConnectionWrapper in project jbosstools-openshift by jbosstools.
the class ProjectWrapperTest method initilize.
@Before
public void initilize() {
this.connection = mock(IOpenShiftConnection.class);
this.connectionWrapper = new ConnectionWrapper(mock(OpenshiftUIModel.class), connection);
this.project = mock(IProject.class);
when(project.getNamespaceName()).thenReturn("namespace");
this.projectWrapper = new ProjectWrapper(connectionWrapper, project);
WatchManager.getInstance()._getWatches().clear();
}
Aggregations