-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16b13c0
commit ea25cae
Showing
102 changed files
with
1,053 additions
and
19,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
out | ||
*.class | ||
target |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/test/java/com/blobcity/db/test/integration/data/EntityDataInsertIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.blobcity.db.test.integration.data; | ||
|
||
import com.blobcity.db.Db; | ||
import com.blobcity.db.annotations.Entity; | ||
import com.blobcity.db.config.Credentials; | ||
import com.blobcity.db.enums.CollectionType; | ||
import com.google.gson.JsonObject; | ||
import org.junit.*; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* Created by sanketsarang on 18/11/16. | ||
*/ | ||
public class EntityDataInsertIT { | ||
|
||
@BeforeClass | ||
public static void setUpClass() { | ||
Credentials.init("localhost:10111","root","root","test"); | ||
Assert.assertTrue("Cannot perform data insert tests as datastore creation failed", Db.createDs("test")); | ||
Assert.assertTrue("Cannot perform data insert tests as on-disk collection creation failed", Db.createCollection("disk", CollectionType.ON_DISK)); | ||
Assert.assertTrue("Cannot perform data insert tests as in-memory collection creation failed", Db.createCollection("mem", CollectionType.IN_MEMORY)); | ||
Assert.assertTrue("Cannot perform data insert tests as in-memory-non-durable collection creation failed", Db.createCollection("memnd", CollectionType.IN_MEMORY_NON_DURABLE)); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDownClass() { | ||
Assert.assertTrue("Failed to drop datastore after test completion. Other tests may fail.", Db.dropDs("test")); | ||
Credentials.unInit(); | ||
} | ||
|
||
@Before | ||
public void setUp() { | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
} | ||
|
||
@Test | ||
public void insertEntityOnDisk() { | ||
System.out.println("IT: insertEntityOnDisk"); | ||
|
||
Assert.assertTrue("Cannot perform data insert tests as on-disk collection creation failed", Db.createCollection("User", CollectionType.ON_DISK)); | ||
new User("name1","address1").insert(); | ||
} | ||
|
||
@Test | ||
public void insertJsonInMemory() { | ||
System.out.println("IT: insertJsonInMemory - yet to be implemented"); | ||
} | ||
|
||
@Test | ||
public void insertJsonInMemoryND() { | ||
System.out.println("IT: insertJsonInMemoryND - yet to be implemented"); | ||
} | ||
} | ||
|
||
@Entity(ds = "test", collection = "User") | ||
class User extends Db { | ||
private String name; | ||
private String address; | ||
|
||
public User(final String name, final String address) { | ||
this.name = name; | ||
this.address = address; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getAddress() { | ||
return address; | ||
} | ||
|
||
public void setAddress(String address) { | ||
this.address = address; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/test/java/com/blobcity/db/test/integration/data/JSONDataInsertIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.blobcity.db.test.integration.data; | ||
|
||
import com.blobcity.db.Db; | ||
import com.blobcity.db.config.Credentials; | ||
import com.blobcity.db.enums.CollectionType; | ||
import com.google.gson.JsonObject; | ||
import org.junit.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by sanketsarang on 18/11/16. | ||
*/ | ||
public class JSONDataInsertIT { | ||
|
||
@BeforeClass | ||
public static void setUpClass() { | ||
Credentials.init("localhost:10111","root","root","test"); | ||
Assert.assertTrue("Cannot perform data insert tests as datastore creation failed", Db.createDs("test")); | ||
Assert.assertTrue("Cannot perform data insert tests as on-disk collection creation failed", Db.createCollection("disk", CollectionType.ON_DISK)); | ||
Assert.assertTrue("Cannot perform data insert tests as in-memory collection creation failed", Db.createCollection("mem", CollectionType.IN_MEMORY)); | ||
Assert.assertTrue("Cannot perform data insert tests as in-memory-non-durable collection creation failed", Db.createCollection("memnd", CollectionType.IN_MEMORY_NON_DURABLE)); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDownClass() { | ||
Assert.assertTrue("Failed to drop datastore after test completion. Other tests may fail.", Db.dropDs("test")); | ||
Credentials.unInit(); | ||
} | ||
|
||
@Before | ||
public void setUp() { | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
} | ||
|
||
@Test | ||
public void insertOnDisk() { | ||
System.out.println("IT: insertOnDisk"); | ||
|
||
/* Insert first record */ | ||
JsonObject jsonObject1 = new JsonObject(); | ||
jsonObject1.addProperty("name","name1"); | ||
jsonObject1.addProperty("age",45); | ||
Db.insertJson("disk", jsonObject1); | ||
|
||
/* Insert second record */ | ||
JsonObject jsonObject2 = new JsonObject(); | ||
jsonObject2.addProperty("name","name1"); | ||
jsonObject2.addProperty("age",45); | ||
jsonObject2.addProperty("address","address 1"); | ||
Db.insertJson("disk", jsonObject2); | ||
|
||
/* Insert multiple records */ | ||
Db.insertJson("disk", Arrays.asList(new JsonObject[]{jsonObject1, jsonObject2})); | ||
} | ||
|
||
@Test | ||
public void insertJsonInMemory() { | ||
System.out.println("IT: insertJsonInMemory - yet to be implemented"); | ||
} | ||
|
||
@Test | ||
public void insertJsonInMemoryND() { | ||
System.out.println("IT: insertJsonInMemoryND - yet to be implemented"); | ||
} | ||
} |
Oops, something went wrong.