예제 #1
0
func (s *MetadataStorageSuite) TestMetadataStorageMetadata(c *gc.C) {
	stor := filestorage.NewMetadataStorage()
	id, err := stor.AddDoc(s.original)
	c.Assert(err, gc.IsNil)

	meta, err := stor.Metadata(id)
	c.Assert(err, gc.IsNil)
	c.Check(meta, gc.DeepEquals, s.original)
}
예제 #2
0
func (s *WrapperSuite) SetUpTest(c *gc.C) {
	s.IsolationSuite.SetUpTest(c)

	var err error
	s.rawstor, err = filestorage.NewRawFileStorage(c.MkDir())
	c.Assert(err, gc.IsNil)
	s.metastor = filestorage.NewMetadataStorage()
	s.original = filestorage.NewMetadata(nil)
	s.original.SetFile(10, "", "")
}
예제 #3
0
func (s *MetadataStorageSuite) TestMetadataStorageRemoveDoc(c *gc.C) {
	stor := filestorage.NewMetadataStorage()
	id, err := stor.AddDoc(s.original)
	c.Assert(err, gc.IsNil)

	err = stor.RemoveDoc(id)
	c.Assert(err, gc.IsNil)
	_, err = stor.Metadata(id)
	c.Assert(err, gc.NotNil)
}
예제 #4
0
func (s *MetadataStorageSuite) TestMetadataStorageListMetadata(c *gc.C) {
	stor := filestorage.NewMetadataStorage()
	id, err := stor.AddDoc(s.original)
	c.Assert(err, gc.IsNil)

	list, err := stor.ListMetadata()
	c.Assert(err, gc.IsNil)
	c.Assert(list, gc.HasLen, 1)
	c.Assert(list[0], gc.NotNil)
	c.Check(list[0].ID(), gc.Equals, id)
}
예제 #5
0
func (s *MetadataStorageSuite) TestMetadataStorageDoc(c *gc.C) {
	stor := filestorage.NewMetadataStorage()
	id, err := stor.AddDoc(s.original)
	c.Assert(err, gc.IsNil)

	doc, err := stor.Doc(id)
	c.Assert(err, gc.IsNil)
	meta, ok := doc.(filestorage.Metadata)
	c.Assert(ok, gc.Equals, true)
	c.Check(meta, gc.DeepEquals, s.original)
}
예제 #6
0
func (s *MetadataStorageSuite) TestMetadataStorageListDocs(c *gc.C) {
	stor := filestorage.NewMetadataStorage()
	id, err := stor.AddDoc(s.original)
	c.Assert(err, gc.IsNil)

	list, err := stor.ListDocs()
	c.Assert(err, gc.IsNil)
	c.Assert(list, gc.HasLen, 1)
	c.Assert(list[0], gc.NotNil)
	meta, ok := list[0].(filestorage.Metadata)
	c.Assert(ok, gc.Equals, true)
	c.Check(meta.ID(), gc.Equals, id)
}
예제 #7
0
func (s *MetadataStorageSuite) TestMetadataStorageSetStored(c *gc.C) {
	stor := filestorage.NewMetadataStorage()
	id, err := stor.AddDoc(s.original)
	c.Assert(err, gc.IsNil)
	meta, err := stor.Metadata(id)
	c.Assert(err, gc.IsNil)
	c.Check(meta.Stored(), gc.Equals, false)

	err = stor.SetStored(meta)
	c.Assert(err, gc.IsNil)
	meta, err = stor.Metadata(id)
	c.Assert(err, gc.IsNil)
	c.Check(meta.Stored(), gc.Equals, true)
}
예제 #8
0
func (s *MetadataStorageSuite) TestMetadataStorageNewMetadataStorage(c *gc.C) {
	stor := filestorage.NewMetadataStorage()

	c.Check(stor, gc.NotNil)
}
예제 #9
0
func (s *MetadataStorageSuite) TestMetadataStorageNew(c *gc.C) {
	stor := filestorage.NewMetadataStorage()

	meta := stor.New()
	c.Assert(meta.ID(), gc.Equals, "")
}