Exemple #1
0
// ContextQuadStore returns the qstest QuadStore stored in ctx or nil if there
// is no QuadStore.
func ContextQuadStore(ctx context.Context) graph.QuadStore {
	vars := testrunner.ContextVars(ctx)
	if vars == nil {
		return nil
	}
	return getQuadStore(vars)
}
Exemple #2
0
// Setup call NewArgs and creates a graph.QuadStore from the result using the call
//		graph.NewQuadStore(impl.Name, path, opt)
func (impl *QuadStoreImpl) Setup(ctx context.Context, name string) (err error) {
	path, opt, err := impl.NewArgs(ctx, name)
	if err != nil {
		return fmt.Errorf("initializing %s: %v", name, err)
	}

	qs, err := graph.NewQuadStore(impl.Name, path, opt)
	if err != nil {
		impl.Teardown(ctx, name)
		return err
	}

	vars := testrunner.ContextVars(ctx)
	setQuadStore(vars, qs)

	return nil
}