@Test public void testAddSpec() throws Exception { this.specStore.addSpec(this.flowSpec1); this.specStore.addSpec(this.flowSpec2); Assert.assertTrue(this.specStore.exists(this.uri1)); Assert.assertTrue(this.specStore.exists(this.uri2)); Assert.assertFalse(this.specStore.exists(URI.create("dummy"))); }
public void addSpec(Spec spec, String tagValue) throws IOException { try (Connection connection = this.dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(String.format(INSERT_STATEMENT, this.tableName))) { setAddPreparedStatement(statement, spec, tagValue); statement.executeUpdate(); connection.commit(); } catch (SQLException | SpecSerDeException e) { throw new IOException(e); } }
MysqlSpecStore extends InstrumentedSpecStore { public void addSpec(Spec spec, String tagValue) throws IOException { try (Connection connection = this.dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(String.format(INSERT_STATEMENT, this.tableName))) { setAddPreparedStatement(statement, spec, tagValue); statement.executeUpdate(); connection.commit(); } catch (SQLException | SpecSerDeException e) { throw new IOException(e); } } }
MysqlSpecStore extends InstrumentedSpecStore { public void addSpec(Spec spec, String tagValue) throws IOException { try (Connection connection = this.dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(String.format(INSERT_STATEMENT, this.tableName))) { setAddPreparedStatement(statement, spec, tagValue); statement.executeUpdate(); connection.commit(); } catch (SQLException | SpecSerDeException e) { throw new IOException(e); } } MysqlSpecStore(Config config, SpecSerDe specSerDe); }
MysqlSpecStore extends InstrumentedSpecStore { public void addSpec(Spec spec, String tagValue) throws IOException { try (Connection connection = this.dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(String.format(INSERT_STATEMENT, this.tableName))) { setAddPreparedStatement(statement, spec, tagValue); statement.executeUpdate(); connection.commit(); } catch (SQLException | SpecSerDeException e) { throw new IOException(e); } } MysqlSpecStore(Config config, SpecSerDe specSerDe); @Override boolean existsImpl(URI specUri); @Override void addSpecImpl(Spec spec); void addSpec(Spec spec, String tagValue); @Override boolean deleteSpec(Spec spec); @Override boolean deleteSpecImpl(URI specUri); @Override boolean deleteSpec(URI specUri, String version); @Override // TODO : this method is not doing what the contract is in the SpecStore interface Spec updateSpecImpl(Spec spec); @Override Spec getSpecImpl(URI specUri); Collection<Spec> getSpecsImpl(SpecSearchObject specSearchObject); @Override Spec getSpec(URI specUri, String version); @Override Collection<Spec> getAllVersionsOfSpec(URI specUri); @Override Collection<Spec> getSpecsImpl(); @Override Iterator<URI> getSpecURIsImpl(); @Override Iterator<URI> getSpecURIsWithTag(String tag); @Override Optional<URI> getSpecStoreURI(); }
MysqlSpecStore extends InstrumentedSpecStore { public void addSpec(Spec spec, String tagValue) throws IOException { try (Connection connection = this.dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(String.format(INSERT_STATEMENT, this.tableName))) { setAddPreparedStatement(statement, spec, tagValue); statement.executeUpdate(); connection.commit(); } catch (SQLException | SpecSerDeException e) { throw new IOException(e); } } MysqlSpecStore(Config config, SpecSerDe specSerDe); @Override boolean existsImpl(URI specUri); @Override void addSpecImpl(Spec spec); void addSpec(Spec spec, String tagValue); @Override boolean deleteSpec(Spec spec); @Override boolean deleteSpecImpl(URI specUri); @Override boolean deleteSpec(URI specUri, String version); @Override // TODO : this method is not doing what the contract is in the SpecStore interface Spec updateSpecImpl(Spec spec); @Override Spec getSpecImpl(URI specUri); Collection<Spec> getSpecsImpl(SpecSearchObject specSearchObject); @Override Spec getSpec(URI specUri, String version); @Override Collection<Spec> getAllVersionsOfSpec(URI specUri); @Override Collection<Spec> getSpecsImpl(); @Override Iterator<URI> getSpecURIsImpl(); @Override Iterator<URI> getSpecURIsWithTag(String tag); @Override Optional<URI> getSpecStoreURI(); static final String CONFIG_PREFIX; static final String DEFAULT_TAG_VALUE; }