@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 test21() throws Throwable { SQLDialect sQLDialect0 = SQLDialect.POSTGRES_9_5; DefaultDSLContext defaultDSLContext0 = new DefaultDSLContext(sQLDialect0); URL uRL0 = MockURL.getHttpExample(); // Undeclared exception! try { WorkspaceSnapshot.load(defaultDSLContext0, uRL0); 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); } }
@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 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); } }