DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Objects.SqlLongStringTests Class Reference

Public Member Functions

void TestSetUp ()
 
void TestTearDown ()
 
void Create_Unicode_Uncompressed ()
 
void WriteAndRead_Unicode ()
 

Private Member Functions

ILargeObject CreateLargeObject (long size, bool compressed)
 
ILargeObject GetLargeObject (ObjectId id)
 
void WriteToObject (ILargeObject obj, Encoding encoding, string text)
 

Private Attributes

InMemoryStorageSystem storageSystem
 
InMemoryStore testStore
 
ObjectStore objStore
 

Detailed Description

Definition at line 26 of file SqlLongStringTests.cs.

Member Function Documentation

void Deveel.Data.Sql.Objects.SqlLongStringTests.Create_Unicode_Uncompressed ( )
inline

Definition at line 64 of file SqlLongStringTests.cs.

64  {
65  var obj = CreateLargeObject(2048, false);
66  var stringObj = SqlLongString.Unicode(obj);
67  Assert.IsNotNull(stringObj);
68  Assert.IsFalse(stringObj.IsNull);
69  }
ILargeObject CreateLargeObject(long size, bool compressed)
ILargeObject Deveel.Data.Sql.Objects.SqlLongStringTests.CreateLargeObject ( long  size,
bool  compressed 
)
inlineprivate

Definition at line 31 of file SqlLongStringTests.cs.

31  {
32  return objStore.CreateNewObject(size, compressed);
33  }
ILargeObject CreateNewObject(long maxSize, bool compressed)
Creates a new large object returning a reference to it.
Definition: ObjectStore.cs:178
ILargeObject Deveel.Data.Sql.Objects.SqlLongStringTests.GetLargeObject ( ObjectId  id)
inlineprivate

Definition at line 35 of file SqlLongStringTests.cs.

35  {
36  return objStore.GetObject(id);
37  }
ILargeObject GetObject(ObjectId id)
Gets an object that was previously created for the given unique identifier.
Definition: ObjectStore.cs:490
void Deveel.Data.Sql.Objects.SqlLongStringTests.TestSetUp ( )
inline
void Deveel.Data.Sql.Objects.SqlLongStringTests.TestTearDown ( )
inline

Definition at line 57 of file SqlLongStringTests.cs.

57  {
60  storageSystem = null;
61  }
bool IStoreSystem. DeleteStore(IStore store)
Permanently deletes a store from the system - use with care!
void Deveel.Data.Sql.Objects.SqlLongStringTests.WriteAndRead_Unicode ( )
inline

Definition at line 72 of file SqlLongStringTests.cs.

72  {
73  const string testLine = "A simple test string that can span several characters, " +
74  "that is trying to be the longest possible, just to prove" +
75  "the capacity of a LONG VARCHAR to handle very long strings. " +
76  "Anyway it is virtually impossible to reach the maximum size " +
77  "of a long object, that is organized in 64k byte pages and " +
78  "spans within the local system without any constraint of size. " +
79  "For sake of memory anyway, the maximum size of the test object " +
80  "is set to just 2048 bytes.";
81 
82  var obj = CreateLargeObject(2048, false);
83 
84  WriteToObject(obj, Encoding.Unicode, testLine);
85 
86  obj.Complete();
87 
88  var objId = obj.Id;
89 
90  var stringObj = SqlLongString.Unicode(obj);
91  Assert.IsNotNull(stringObj);
92  Assert.IsFalse(stringObj.IsNull);
93 
94  obj = GetLargeObject(objId);
95  Assert.IsTrue(obj.IsComplete);
96  Assert.IsFalse(obj.IsCompressed);
97 
98  stringObj = SqlLongString.Unicode(obj);
99  var reader = stringObj.GetInput(Encoding.Unicode);
100  Assert.IsNotNull(reader);
101 
102  string line = null;
103  Assert.DoesNotThrow(() => line = reader.ReadLine());
104  Assert.IsNotNull(line);
105  Assert.IsNotEmpty(line);
106 
107  Assert.AreEqual(testLine, line);
108  }
ILargeObject CreateLargeObject(long size, bool compressed)
void WriteToObject(ILargeObject obj, Encoding encoding, string text)
void Deveel.Data.Sql.Objects.SqlLongStringTests.WriteToObject ( ILargeObject  obj,
Encoding  encoding,
string  text 
)
inlineprivate

Definition at line 39 of file SqlLongStringTests.cs.

39  {
40  using (var stream = new ObjectStream(obj)) {
41  using (var streamWriter = new StreamWriter(stream, encoding)) {
42  streamWriter.Write(text);
43  streamWriter.Flush();
44  }
45  }
46  }

Member Data Documentation

ObjectStore Deveel.Data.Sql.Objects.SqlLongStringTests.objStore
private

Definition at line 29 of file SqlLongStringTests.cs.

InMemoryStorageSystem Deveel.Data.Sql.Objects.SqlLongStringTests.storageSystem
private

Definition at line 27 of file SqlLongStringTests.cs.

InMemoryStore Deveel.Data.Sql.Objects.SqlLongStringTests.testStore
private

Definition at line 28 of file SqlLongStringTests.cs.


The documentation for this class was generated from the following file: