@Test(timeout = 4000) public void test01() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); workspaceSnapshot0.records = null; List<UpdatableRecord<? extends UpdatableRecord<?>>> list0 = workspaceSnapshot0.getRecords(); assertNull(list0); }
/** * Assigns the tree viewer that I control. * * @param tree my tree viewer */ void setTreeViewer(final TreeViewer tree) { if (this.tree != null) { this.tree.removeSelectionChangedListener(this); } this.tree = tree; if (this.tree != null) { this.tree.addSelectionChangedListener(this); this.tree.setInput(workspace.getWorkingSets()); if (!workspace.getWorkingSets().isEmpty()) { tree.getTree() .getDisplay() .asyncExec( new Runnable() { public void run() { Object initialSelection; ITreeContentProvider content = (ITreeContentProvider) tree.getContentProvider(); if ((initialWorkingSet != null) && Arrays.asList(content.getElements(tree.getInput())) .contains(initialWorkingSet)) { initialSelection = initialWorkingSet; } else { // we have a most-recently-used working set. Just // take the first in tree order initialSelection = tree.getTree().getItem(0).getData(); } Object[] children = content.getChildren(initialSelection); IStructuredSelection sel; if ((children == null) || (children.length == 0)) { // Shouldn't happen: there should at least be the // read-only config. // Can only select the initial working set sel = new StructuredSelection(initialSelection); } else { Object[] toSort = new Object[children.length]; System.arraycopy(children, 0, toSort, 0, children.length); tree.getComparator().sort(tree, toSort); sel = new StructuredSelection(toSort[0]); } // make the selection tree.setSelection(sel, true); } }); } } }
@Test(timeout = 4000) public void test00() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); // Undeclared exception! try { workspaceSnapshot0.deltaFrom((DSLContext) null, (WorkspaceSnapshot) null); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot", e); } }
/** * Updates the display to reflect potential changes in project activation and the resulting * changes in working-set config activation, if any. */ private void updateForActivation() { // update all working-set configs that intersect this config Collection<IWorkingSetProxy.ISnapshot> unaffectedWorkingSets = new java.util.HashSet<IWorkingSetProxy.ISnapshot>(workspace.getWorkingSets()); for (IProject project : currentConfig.getWorkingSet().resolveProjects()) { for (Iterator<IWorkingSetProxy.ISnapshot> iter = unaffectedWorkingSets.iterator(); iter.hasNext(); ) { IWorkingSetProxy.ISnapshot next = iter.next(); if (next.resolveProjects().contains(project)) { iter.remove(); if (next.updateActiveConfigurations()) { // major change. Refresh it altogether tree.refresh(next); } else { // lighter-weight updates of its configs for (IWorkingSetConfiguration config : next.getConfigurations()) { tree.update(config, null); } } } } } updateButtons(); }
@Test public void testSerializeWorkspaceSnapshot() throws Exception { Product definingProduct = RECORDS.newProduct("zee product"); definingProduct.setWorkspace(definingProduct.getId()); definingProduct.insert(); Agency pseudoScientist = RECORDS.newAgency("Behold the Pseudo Scientist!"); pseudoScientist.setWorkspace(definingProduct.getId()); pseudoScientist.insert(); WorkspaceLabelRecord auth = RECORDS.newWorkspaceLabel("Su Su Sudio", definingProduct, pseudoScientist); auth.insert(); WorkspaceSnapshot retrieved = new WorkspaceSnapshot(definingProduct, create); assertEquals(2, retrieved.getRecords().size()); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new CoREModule()); File temp = File.createTempFile("snaptest", "wsp"); temp.deleteOnExit(); try (FileOutputStream os = new FileOutputStream(temp)) { mapper.writeValue(os, retrieved); } WorkspaceSnapshot deserialized; try (FileInputStream is = new FileInputStream(temp)) { deserialized = mapper.readValue(is, WorkspaceSnapshot.class); } assertEquals(2, deserialized.getRecords().size()); assertTrue(deserialized.getRecords().stream().anyMatch(r -> pseudoScientist.equals(r))); assertFalse(deserialized.getRecords().stream().anyMatch(r -> definingProduct.equals(r))); create.configuration().connectionProvider().acquire().rollback(); WorkspaceSnapshot.load(create, temp.toURI().toURL()); }
@Test(timeout = 4000) public void test10() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); Product product0 = new Product(); workspaceSnapshot0.definingProduct = product0; DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext((SQLDialect) null); // Undeclared exception! try { workspaceSnapshot0.load(defaultDSLContext0); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("org.jooq.impl.AbstractScope", e); } }
@Test(timeout = 4000) public void test09() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); Product product0 = new Product(); workspaceSnapshot0.definingProduct = product0; SQLDialect sQLDialect0 = SQLDialect.MARIADB; DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0); // Undeclared exception! try { workspaceSnapshot0.load(defaultDSLContext0); fail("Expecting exception: RuntimeException"); } catch (RuntimeException e) { // // Cannot execute query. No Connection configured // assertThrownBy("org.jooq.impl.AbstractQuery", e); } }
@Test(timeout = 4000) public void test25() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); ByteArrayOutputStream byteArrayOutputStream0 = new ByteArrayOutputStream(); // Undeclared exception! try { workspaceSnapshot0.serializeTo(byteArrayOutputStream0); fail("Expecting exception: VerifyError"); } catch (VerifyError e) { // // Bad type on operand stack // Exception Details: // Location: // com/fasterxml/jackson/databind/ObjectMapper.<clinit>()V @62: invokespecial // Reason: // Type 'com/fasterxml/jackson/databind/util/StdDateFormat' (current frame, stack[8]) is // not assignable to 'java/text/DateFormat' // Current Frame: // bci: @62 // flags: { } // locals: { } // stack: { uninitialized 35, uninitialized 35, null, // 'com/fasterxml/jackson/databind/AnnotationIntrospector', // 'com/fasterxml/jackson/databind/introspect/VisibilityChecker', null, // 'com/fasterxml/jackson/databind/type/TypeFactory', null, // 'com/fasterxml/jackson/databind/util/StdDateFormat', null, 'java/util/Locale', null, // 'com/fasterxml/jackson/core/Base64Variant' } // Bytecode: // 0x0000000: 1304 16b8 06ef b304 14bb 06f1 59b7 06f2 // 0x0000010: b306 e5b8 06f5 b306 e7bb 06f7 59b7 06f8 // 0x0000020: b306 e9bb 0102 5901 b206 e5b2 06e7 01b8 // 0x0000030: 00f7 01b2 06fd 01b8 0703 01b8 0709 b707 // 0x0000040: 0cb3 00fc 1307 0eb8 0713 b113 070e b807 // 0x0000050: 13bf // Exception Handler Table: // bci [0, 75] => handler: 75 // Stackmap Table: // same_locals_1_stack_item_extended(@75,Object[#1587]) // assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot", e); } }
/** Initializes me we an initial working set to select. */ WorkingSetConfigsController( WorkspaceSnapshot workspace, IWorkingSetProxy.ISnapshot initialWorkingSet) { this.workspace = workspace; if (initialWorkingSet != null) { this.initialWorkingSet = initialWorkingSet; } else { IWorkingSet[] recent = WorkingSetConfigurationManager.WS_MGR.getRecentWorkingSets(); if ((recent != null) && (recent.length > 0)) { this.initialWorkingSet = workspace.getWorkingSet(recent[0].getName()); } } }
@Test(timeout = 4000) public void test22() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); Jdbc3SimpleDataSource jdbc3SimpleDataSource0 = new Jdbc3SimpleDataSource(); DataSourceConnectionProvider dataSourceConnectionProvider0 = new DataSourceConnectionProvider(jdbc3SimpleDataSource0); SQLDialect sQLDialect0 = SQLDialect.FIREBIRD; Settings settings0 = new Settings(); DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(dataSourceConnectionProvider0, sQLDialect0, settings0); // Undeclared exception! try { workspaceSnapshot0.load(defaultDSLContext0); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot", e); } }
@Test(timeout = 4000) public void test04() throws Throwable { Product product0 = new Product(); // Undeclared exception! try { WorkspaceSnapshot.selectWorkspaceClosure((DSLContext) null, product0); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot", e); } }
@Test(timeout = 4000) public void test19() throws Throwable { UUID uUID0 = UUID.randomUUID(); // Undeclared exception! try { WorkspaceSnapshot.getAuthorizations(uUID0, (DSLContext) null); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("com.chiralbehaviors.CoRE.workspace.WorkspaceSnapshot", e); } }
@Test(timeout = 4000) public void test05() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); Product product0 = new Product(); workspaceSnapshot0.definingProduct = product0; DefaultConfiguration defaultConfiguration0 = new DefaultConfiguration(); NoConnectionProvider noConnectionProvider0 = (NoConnectionProvider) defaultConfiguration0.connectionProvider(); SQLDialect sQLDialect0 = SQLDialect.SQLITE; Settings settings0 = new Settings(); DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(noConnectionProvider0, sQLDialect0, settings0); // Undeclared exception! try { workspaceSnapshot0.loadDefiningProduct(defaultDSLContext0); fail("Expecting exception: RuntimeException"); } catch (RuntimeException e) { // // Cannot execute query. No Connection configured // assertThrownBy("org.jooq.impl.AbstractQuery", e); } }
/** * Initializes me with the project that I represent and the workspace snapshot. I discover the * currently defined configurations for my project and initially select the one that is * currently active, or the first available if none is active (which would be odd). * * @param parent my parent working set configuration * @param projectConfig the project configuration to copy * @param workspace the current workspace snapshot */ protected Snapshot( IWorkingSetConfiguration parent, IWorkingSetProjectConfiguration projectConfig, WorkspaceSnapshot workspace) { super(parent); this.project = projectConfig.resolveProject(); this.workspace = workspace; String selected = projectConfig.getSelectedConfigurationID(); if (selected == null) { selected = workspace.getActiveConfigurationID(project); } setSelectedConfigurationID(selected); }
@Test(timeout = 4000) public void test02() throws Throwable { SQLDialect sQLDialect0 = SQLDialect.POSTGRES_9_4; DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0); Product product0 = new Product(); // Undeclared exception! try { WorkspaceSnapshot.selectWorkspaceClosure(defaultDSLContext0, product0); fail("Expecting exception: RuntimeException"); } catch (RuntimeException e) { // // Cannot execute query. No Connection configured // assertThrownBy("org.jooq.impl.AbstractQuery", e); } }
@Test(timeout = 4000) public void test11() throws Throwable { UUID uUID0 = UUID.randomUUID(); SQLDialect sQLDialect0 = SQLDialect.MYSQL; DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0); // Undeclared exception! try { WorkspaceSnapshot.getAuthorizations(uUID0, defaultDSLContext0); fail("Expecting exception: RuntimeException"); } catch (RuntimeException e) { // // Cannot execute query. No Connection configured // assertThrownBy("org.jooq.impl.AbstractQuery", e); } }
@Test(timeout = 4000) public void test23() throws Throwable { SQLDialect sQLDialect0 = SQLDialect.SQLITE; DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext((DataSource) null, sQLDialect0, (Settings) null); Product product0 = new Product(); // Undeclared exception! try { WorkspaceSnapshot.selectWorkspaceClosure(defaultDSLContext0, product0); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("org.jooq.impl.DataSourceConnectionProvider", e); } }
@Test(timeout = 4000) public void test13() throws Throwable { UUID uUID0 = new UUID(948L, 0L); SQLDialect sQLDialect0 = SQLDialect.CUBRID; Settings settings0 = new Settings(); DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext((DataSource) null, sQLDialect0, settings0); // Undeclared exception! try { WorkspaceSnapshot.getAuthorizations(uUID0, defaultDSLContext0); fail("Expecting exception: NullPointerException"); } catch (NullPointerException e) { // // no message in exception (getMessage() returned null) // assertThrownBy("org.jooq.impl.DataSourceConnectionProvider", e); } }
@Override public IStatus build(IProgressMonitor monitor) { return workspace.build(resolveProject(), getSelectedConfigurationID(), monitor); }
@Override public void activate() { workspace.activate(resolveProject(), getSelectedConfigurationID()); }
@Override public boolean isActive() { return workspace.isActive(this); }
@Test(timeout = 4000) public void test20() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); List<UpdatableRecord<? extends UpdatableRecord<?>>> list0 = workspaceSnapshot0.getRecords(); assertTrue(list0.isEmpty()); }
@Override public Collection<ICConfigurationDescription> resolveConfigurations() { return workspace.getConfigurations(resolveProject()); }
@Override public ICConfigurationDescription resolveSelectedConfiguration() { return workspace.getConfiguration(resolveProject(), getSelectedConfigurationID()); }
@Test(timeout = 4000) public void test24() throws Throwable { WorkspaceSnapshot workspaceSnapshot0 = new WorkspaceSnapshot(); Product product0 = workspaceSnapshot0.getDefiningProduct(); assertNull(product0); }