Fragment fragment = null; FragmentManager frgManager; FragmentTransaction ft; fragment = new Overview(); ft = frgManager.beginTransaction(); ft.replace(R.id.frame_content, fragment); ft.addToBackStack(null); ft.commitAllowingStateLoss();
public void selectFrag(View view){ Fragment fr; if (view == findViewById(R.id.txt_highlite)) { fr = (Fragment) new Highlight(); } else{ fr = (Fragment) new Overview(); } FragmentManager fm = getFragmentManager(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.replace(R.id.place_holder, fr); fragmentTransaction.commit(); }
public void selectFrag(View view){ Fragment fr; if (view.getId() == R.id.txt_highlite) { fr = new Highlight(); } else{ fr = new Overview(); } FragmentManager fm = getFragmentManager(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.replace(R.id.place_holder, fr); fragmentTransaction.commit(); }
public Overview loadOverview(final Path path) { final Overview overview = new Overview(); try { // Some older versions in our example do not have metadata. This should be impossible in any kie-wb version overview.setMetadata(metadataService.getMetadata(path)); } catch (Exception e) { logger.warn("No metadata found for file: " + path.getFileName() + ", full path [" + path.toString() + "]"); } //Some resources are not within a Module (e.g. categories.xml) so don't assume we can set the module name final KieModule module = moduleService.resolveModule(path); if (module == null) { logger.info("File: " + path.getFileName() + ", full path [" + path.toString() + "] was not within a Module. Module Name cannot be set."); } else { try { overview.setProjectName(projectService.resolveProject(module.getRootPath()).getName()); } catch (Throwable t) { logger.debug("File: " + path.getFileName() + ", full path [" + path.toString() + "] was not within a Project. Project name cannot be set.", t); } } return overview; } }
@Test public void onRunTest() throws Exception { doReturn(new ScenarioSimulationModelContent(model, new Overview(), new PackageDataModelOracleBaselinePayload())).when(scenarioSimulationServiceMock).loadContent(any()); when(scenarioSimulationServiceMock.runScenario(any(), any())).thenReturn(mock(ScenarioSimulationModel.class)); presenter.onStartup(mock(ObservablePath.class), mock(PlaceRequest.class)); presenter.onRunScenario(); verify(scenarioSimulationServiceMock).runScenario(any(), eq(model)); verify(scenarioGridModelMock, times(1)).resetErrors(); verify(scenarioSimulationViewMock, times(1)).refreshContent(any()); verify(scenarioSimulationDocksHandlerMock).expandTestResultsDock(); }
@Before public void setup() { model = new DeploymentDescriptorModel(); model.setOverview(new Overview()); ddConfigUpdater = new DDConfigUpdater(ddEditorService, projectService, ioService, configUpdaterHelper); Path rootPath = Mockito.mock(Path.class); when(rootPath.toURI()).thenReturn("default://project"); KieProject project = Mockito.mock(KieProject.class); when(project.getRootPath()).thenReturn(rootPath); when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true); when(configUpdaterHelper.isPersistenceFile(any(Path.class))).thenReturn(true); when(configUpdaterHelper.buildJPAMarshallingStrategyValue(any(KieProject.class))).thenReturn(JPA_MARSHALLING_STRATEGY); when(projectService.resolveProject(any(Path.class))).thenReturn(project); when(ddEditorService.load(any(Path.class))).thenReturn(model); }
@Test public void testSaveModel() { doReturn(mock(Path.class)).when(ddEditorService).save(any(), any(), any(), any()); final DeploymentDescriptorModel model = new DeploymentDescriptorModel(); model.setOverview(new Overview()); presenter.model = model; presenter.save("Test comment").catch_(i -> { Assert.fail("Promise should've been resolved!"); return promises.resolve(); }); verify(ddEditorService).save(any(), any(), any(), eq("Test comment")); } }
@Before public void setup() { model = new DeploymentDescriptorModel(); model.setOverview(new Overview()); ddConfigUpdater = new DDConfigUpdater(ddEditorService, moduleService, configUpdaterHelper); Path rootPath = Mockito.mock(Path.class); when(rootPath.toURI()).thenReturn("default://"); KieModule module = Mockito.mock(KieModule.class); when(module.getRootPath()).thenReturn(rootPath); when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true); when(configUpdaterHelper.isPersistenceFile(any(Path.class))).thenReturn(true); when(configUpdaterHelper.buildJPAMarshallingStrategyValue(any(KieModule.class))).thenReturn(JPA_MARSHALLING_STRATEGY); when(moduleService.resolveModule(any(Path.class))).thenReturn(module); when(ddEditorService.load(any(Path.class))).thenReturn(model); doNothing().when(ddEditorService).createIfNotExists(any()); }
@Test public void testSaveModel() { doReturn(mock(Path.class)).when(ddEditorService).save(any(), any(), any(), any()); final DeploymentDescriptorModel model = new DeploymentDescriptorModel(); model.setOverview(new Overview()); presenter.model = model; presenter.save("Test comment").catch_(i -> { Assert.fail("Promise should've been resolved!"); return promises.resolve(); }); verify(ddEditorService).save(any(), any(), any(), eq("Test comment")); } }
@Before public void setup() { model = new DeploymentDescriptorModel(); model.setOverview(new Overview()); ddConfigUpdater = new DDConfigUpdater(ddEditorService, moduleService, configUpdaterHelper); Path rootPath = Mockito.mock(Path.class); when(rootPath.toURI()).thenReturn("default://"); KieModule module = Mockito.mock(KieModule.class); when(module.getRootPath()).thenReturn(rootPath); when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true); when(configUpdaterHelper.isPersistenceFile(any(Path.class))).thenReturn(true); when(configUpdaterHelper.buildJPAMarshallingStrategyValue(any(KieModule.class))).thenReturn(JPA_MARSHALLING_STRATEGY); when(moduleService.resolveModule(any(Path.class))).thenReturn(module); when(ddEditorService.load(any(Path.class))).thenReturn(model); doNothing().when(ddEditorService).createIfNotExists(any()); }
public FormModelerContent serviceLoad() { content = spy(new FormModelerContent()); content.setDefinition(form); content.setOverview(new Overview()); content.setPath(path); content.setSynchronizationResult(synchronizationResult); return content; }
overview = new Overview();
overview = new Overview();
content.setOverview(new Overview());
private PersistenceDescriptorEditorContent newPersistenceDescriptorEditorContent() { final PersistenceDescriptorEditorContent content = new PersistenceDescriptorEditorContent(); final PersistenceDescriptorModel model = new PersistenceDescriptorModel(); model.setVersion("2.0"); final PersistenceUnitModel unitModel = new PersistenceUnitModel(); model.setPersistenceUnit(unitModel); unitModel.setName("UnitName"); unitModel.setTransactionType(TransactionType.JTA); unitModel.setProvider("ProviderClass"); unitModel.setJtaDataSource("JTADataSource"); unitModel.setClasses(Arrays.asList(new PersistableDataObject("Class1"), new PersistableDataObject("Class2"))); content.setDescriptorModel(model); content.setOverview(new Overview()); return content; } }