use of elemental.json.JsonObject in project che by eclipse.
the class AppStateManagerTest method shouldStoreStateByWsId.
@Test
public void shouldStoreStateByWsId() throws Exception {
appStateManager.persistWorkspaceState(WS_ID);
verify(preferencesManager).setValue(preferenceArgumentCaptor.capture(), jsonArgumentCaptor.capture());
assertThat(preferenceArgumentCaptor.getValue()).isNotNull();
assertThat(preferenceArgumentCaptor.getValue()).isNotNull();
JsonObject object = Json.parse(jsonArgumentCaptor.getValue());
assertThat(object.hasKey(WS_ID)).isTrue();
}
use of elemental.json.JsonObject in project che by eclipse.
the class AbstractPerspectivePersistenceTest method shouldNotStoreEditorPartStack.
@Test
public void shouldNotStoreEditorPartStack() throws Exception {
JsonObject state = perspective.getState();
JsonObject partStacks = state.getObject("PART_STACKS");
String[] keys = partStacks.keys();
assertThat(keys).containsOnly("INFORMATION", "NAVIGATION", "TOOLING");
}
use of elemental.json.JsonObject in project che by eclipse.
the class WorkspacePresenterPersistenceTest method shouldStorePerspectives.
@Test
public void shouldStorePerspectives() throws Exception {
when(perspective1.getState()).thenReturn(Json.createObject());
when(perspective2.getState()).thenReturn(Json.createObject());
JsonObject state = presenter.getState();
JsonObject perspectives = state.getObject("perspectives");
assertThat(perspectives).isNotNull();
assertThat(perspectives.getObject("perspective1")).isNotNull();
}
use of elemental.json.JsonObject in project che by eclipse.
the class WorkspacePresenterPersistenceTest method shouldRestoreStorePerspectives.
@Test
public void shouldRestoreStorePerspectives() throws Exception {
JsonObject state = Json.createObject();
state.put("currentPerspectiveId", "perspective2");
JsonObject perspectives = Json.createObject();
state.put("perspectives", perspectives);
JsonObject perspective1State = Json.createObject();
perspectives.put("perspective1", perspective1State);
presenter.loadState(state);
verify(perspective1).loadState(perspective1State);
}
use of elemental.json.JsonObject in project che by eclipse.
the class AbstractPerspective method getState.
@Override
public JsonObject getState() {
JsonObject state = Json.createObject();
JsonObject partStacks = Json.createObject();
state.put("ACTIVE_PART", activePart.getClass().getName());
state.put("PART_STACKS", partStacks);
partStacks.put(PartStackType.INFORMATION.name(), getPartStackState(this.partStacks.get(INFORMATION), belowPartController));
partStacks.put(PartStackType.NAVIGATION.name(), getPartStackState(this.partStacks.get(NAVIGATION), leftPartController));
partStacks.put(PartStackType.TOOLING.name(), getPartStackState(this.partStacks.get(TOOLING), rightPartController));
return state;
}
Aggregations