@@ -72,15 +72,21 @@ public long duration() {
7272 @ Test
7373 public void openInMemoryStoreSucceeds () throws Exception {
7474 Mentat mentat = new Mentat ();
75- assertNotNull (mentat );
75+ assertNotNull (mentat . validPointer () );
7676 }
7777
7878 @ Test
7979 public void openStoreInLocationSucceeds () throws Exception {
8080 Context context = InstrumentationRegistry .getTargetContext ();
8181 String path = context .getDatabasePath ("test.db" ).getAbsolutePath ();
8282 Mentat mentat = new Mentat (path );
83- assertNotNull (mentat );
83+ assertNotNull (mentat .validPointer ());
84+ }
85+
86+ @ Test
87+ public void openNamedInMemoryStoreSucceeds () throws Exception {
88+ Mentat mentat = Mentat .namedInMemoryStore ("openNamedInMemoryStoreSucceeds" );
89+ assertNotNull (mentat .validPointer ());
8490 }
8591
8692 public String readFile (String fileName ) {
@@ -112,9 +118,9 @@ public TxReport transactSeattleData(Mentat mentat) {
112118 return mentat .transact (seattleData );
113119 }
114120
115- public Mentat openAndInitializeCitiesStore () {
121+ public Mentat openAndInitializeCitiesStore (String name ) {
116122 if (this .mentat == null ) {
117- this .mentat = new Mentat ( );
123+ this .mentat = Mentat . namedInMemoryStore ( name );
118124 this .transactCitiesSchema (mentat );
119125 this .transactSeattleData (mentat );
120126 }
@@ -177,15 +183,15 @@ public DBSetupResult populateWithTypesSchema(Mentat mentat) {
177183
178184 @ Test
179185 public void transactingVocabularySucceeds () {
180- Mentat mentat = new Mentat ( );
186+ Mentat mentat = Mentat . namedInMemoryStore ( "transactingVocabularySucceeds" );
181187 TxReport schemaReport = this .transactCitiesSchema (mentat );
182188 assertNotNull (schemaReport );
183189 assertTrue (schemaReport .getTxId () > 0 );
184190 }
185191
186192 @ Test
187193 public void transactingEntitiesSucceeds () {
188- Mentat mentat = new Mentat ( );
194+ Mentat mentat = Mentat . namedInMemoryStore ( "transactingEntitiesSucceeds" );
189195 this .transactCitiesSchema (mentat );
190196 TxReport dataReport = this .transactSeattleData (mentat );
191197 assertNotNull (dataReport );
@@ -196,7 +202,7 @@ public void transactingEntitiesSucceeds() {
196202
197203 @ Test
198204 public void runScalarSucceeds () throws InterruptedException {
199- Mentat mentat = openAndInitializeCitiesStore ();
205+ Mentat mentat = openAndInitializeCitiesStore ("runScalarSucceeds" );
200206 String query = "[:find ?n . :in ?name :where [(fulltext $ :community/name ?name) [[?e ?n]]]]" ;
201207 final Expectation expectation = new Expectation ();
202208 mentat .query (query ).bind ("?name" , "Wallingford" ).run (new ScalarResultHandler () {
@@ -215,7 +221,7 @@ public void handleValue(TypedValue value) {
215221
216222 @ Test
217223 public void runCollSucceeds () throws InterruptedException {
218- Mentat mentat = openAndInitializeCitiesStore ();
224+ Mentat mentat = openAndInitializeCitiesStore ("runCollSucceeds" );
219225 String query = "[:find [?when ...] :where [_ :db/txInstant ?when] :order (asc ?when)]" ;
220226 final Expectation expectation = new Expectation ();
221227 mentat .query (query ).run (new CollResultHandler () {
@@ -236,7 +242,7 @@ public void handleList(CollResult list) {
236242
237243 @ Test
238244 public void runCollResultIteratorSucceeds () throws InterruptedException {
239- Mentat mentat = openAndInitializeCitiesStore ();
245+ Mentat mentat = openAndInitializeCitiesStore ("runCollResultIteratorSucceeds" );
240246 String query = "[:find [?when ...] :where [_ :db/txInstant ?when] :order (asc ?when)]" ;
241247 final Expectation expectation = new Expectation ();
242248 mentat .query (query ).run (new CollResultHandler () {
@@ -258,7 +264,7 @@ public void handleList(CollResult list) {
258264
259265 @ Test
260266 public void runTupleSucceeds () throws InterruptedException {
261- Mentat mentat = openAndInitializeCitiesStore ();
267+ Mentat mentat = openAndInitializeCitiesStore ("runTupleSucceeds" );
262268 String query = "[:find [?name ?cat]\n " +
263269 " :where\n " +
264270 " [?c :community/name ?name]\n " +
@@ -284,7 +290,7 @@ public void handleRow(TupleResult row) {
284290
285291 @ Test
286292 public void runRelIteratorSucceeds () throws InterruptedException {
287- Mentat mentat = openAndInitializeCitiesStore ();
293+ Mentat mentat = openAndInitializeCitiesStore ("runRelIteratorSucceeds" );
288294 String query = "[:find ?name ?cat\n " +
289295 " :where\n " +
290296 " [?c :community/name ?name]\n " +
@@ -324,7 +330,7 @@ public void handleRows(RelResult rows) {
324330
325331 @ Test
326332 public void runRelSucceeds () throws InterruptedException {
327- Mentat mentat = openAndInitializeCitiesStore ();
333+ Mentat mentat = openAndInitializeCitiesStore ("runRelSucceeds" );
328334 String query = "[:find ?name ?cat\n " +
329335 " :where\n " +
330336 " [?c :community/name ?name]\n " +
@@ -363,7 +369,7 @@ public void handleRows(RelResult rows) {
363369
364370 @ Test
365371 public void bindingLongValueSucceeds () throws InterruptedException {
366- Mentat mentat = new Mentat ( );
372+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingLongValueSucceeds" );
367373 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
368374 final Long aEntid = report .getEntidForTempId ("a" );
369375 String query = "[:find ?e . :in ?long :where [?e :foo/long ?long]]" ;
@@ -384,7 +390,7 @@ public void handleValue(TypedValue value) {
384390
385391 @ Test
386392 public void bindingRefValueSucceeds () throws InterruptedException {
387- Mentat mentat = new Mentat ( );
393+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingRefValueSucceeds" );
388394 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
389395 long stringEntid = mentat .entIdForAttribute (":foo/string" );
390396 final Long bEntid = report .getEntidForTempId ("b" );
@@ -406,7 +412,7 @@ public void handleValue(TypedValue value) {
406412
407413 @ Test
408414 public void bindingRefKwValueSucceeds () throws InterruptedException {
409- Mentat mentat = new Mentat ( );
415+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingRefKwValueSucceeds" );
410416 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
411417 String refKeyword = ":foo/string" ;
412418 final Long bEntid = report .getEntidForTempId ("b" );
@@ -428,7 +434,7 @@ public void handleValue(TypedValue value) {
428434
429435 @ Test
430436 public void bindingKwValueSucceeds () throws InterruptedException {
431- Mentat mentat = new Mentat ( );
437+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingKwValueSucceeds" );
432438 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
433439 final Long aEntid = report .getEntidForTempId ("a" );
434440 String query = "[:find ?e . :in ?kw :where [?e :foo/keyword ?kw]]" ;
@@ -449,7 +455,7 @@ public void handleValue(TypedValue value) {
449455
450456 @ Test
451457 public void bindingDateValueSucceeds () throws InterruptedException , ParseException {
452- Mentat mentat = new Mentat ( );
458+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingDateValueSucceeds" );
453459 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
454460 final Long aEntid = report .getEntidForTempId ("a" );
455461
@@ -474,7 +480,7 @@ public void handleRow(TupleResult row) {
474480
475481 @ Test
476482 public void bindingStringValueSucceeds () throws InterruptedException {
477- Mentat mentat = this .openAndInitializeCitiesStore ();
483+ Mentat mentat = this .openAndInitializeCitiesStore ("bindingStringValueSucceeds" );
478484 String query = "[:find ?n . :in ?name :where [(fulltext $ :community/name ?name) [[?e ?n]]]]" ;
479485 final Expectation expectation = new Expectation ();
480486 mentat .query (query ).bind ("?name" , "Wallingford" ).run (new ScalarResultHandler () {
@@ -493,7 +499,7 @@ public void handleValue(TypedValue value) {
493499
494500 @ Test
495501 public void bindingUuidValueSucceeds () throws InterruptedException {
496- Mentat mentat = new Mentat ( );
502+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingUuidValueSucceeds" );
497503 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
498504 final Long aEntid = report .getEntidForTempId ("a" );
499505 String query = "[:find ?e . :in ?uuid :where [?e :foo/uuid ?uuid]]" ;
@@ -515,7 +521,7 @@ public void handleValue(TypedValue value) {
515521
516522 @ Test
517523 public void bindingBooleanValueSucceeds () throws InterruptedException {
518- Mentat mentat = new Mentat ( );
524+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingBooleanValueSucceeds" );
519525 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
520526 final Long aEntid = report .getEntidForTempId ("a" );
521527 String query = "[:find ?e . :in ?bool :where [?e :foo/boolean ?bool]]" ;
@@ -537,7 +543,7 @@ public void handleValue(TypedValue value) {
537543
538544 @ Test
539545 public void bindingDoubleValueSucceeds () throws InterruptedException {
540- Mentat mentat = new Mentat ( );
546+ Mentat mentat = Mentat . namedInMemoryStore ( "bindingDoubleValueSucceeds" );
541547 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
542548 final Long aEntid = report .getEntidForTempId ("a" );
543549 String query = "[:find ?e . :in ?double :where [?e :foo/double ?double]]" ;
@@ -558,7 +564,7 @@ public void handleValue(TypedValue value) {
558564
559565 @ Test
560566 public void typedValueConvertsToLong () throws InterruptedException {
561- Mentat mentat = new Mentat ( );
567+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToLong" );
562568 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
563569 final Long aEntid = report .getEntidForTempId ("a" );
564570 String query = "[:find ?v . :in ?e :where [?e :foo/long ?v]]" ;
@@ -580,7 +586,7 @@ public void handleValue(TypedValue value) {
580586
581587 @ Test
582588 public void typedValueConvertsToRef () throws InterruptedException {
583- Mentat mentat = new Mentat ( );
589+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToRef" );
584590 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
585591 final Long aEntid = report .getEntidForTempId ("a" );
586592 String query = "[:find ?e . :where [?e :foo/long 25]]" ;
@@ -602,7 +608,7 @@ public void handleValue(TypedValue value) {
602608
603609 @ Test
604610 public void typedValueConvertsToKeyword () throws InterruptedException {
605- Mentat mentat = new Mentat ( );
611+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToKeyword" );
606612 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
607613 final Long aEntid = report .getEntidForTempId ("a" );
608614 String query = "[:find ?v . :in ?e :where [?e :foo/keyword ?v]]" ;
@@ -624,7 +630,7 @@ public void handleValue(TypedValue value) {
624630
625631 @ Test
626632 public void typedValueConvertsToBoolean () throws InterruptedException {
627- Mentat mentat = new Mentat ( );
633+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToBoolean" );
628634 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
629635 final Long aEntid = report .getEntidForTempId ("a" );
630636 String query = "[:find ?v . :in ?e :where [?e :foo/boolean ?v]]" ;
@@ -646,7 +652,7 @@ public void handleValue(TypedValue value) {
646652
647653 @ Test
648654 public void typedValueConvertsToDouble () throws InterruptedException {
649- Mentat mentat = new Mentat ( );
655+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToDouble" );
650656 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
651657 final Long aEntid = report .getEntidForTempId ("a" );
652658 String query = "[:find ?v . :in ?e :where [?e :foo/double ?v]]" ;
@@ -668,7 +674,7 @@ public void handleValue(TypedValue value) {
668674
669675 @ Test
670676 public void typedValueConvertsToDate () throws InterruptedException , ParseException {
671- Mentat mentat = new Mentat ( );
677+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToDate" );
672678 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
673679 final Long aEntid = report .getEntidForTempId ("a" );
674680 String query = "[:find ?v . :in ?e :where [?e :foo/instant ?v]]" ;
@@ -693,7 +699,7 @@ public void handleValue(TypedValue value) {
693699
694700 @ Test
695701 public void typedValueConvertsToString () throws InterruptedException {
696- Mentat mentat = new Mentat ( );
702+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToString" );
697703 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
698704 final Long aEntid = report .getEntidForTempId ("a" );
699705 String query = "[:find ?v . :in ?e :where [?e :foo/string ?v]]" ;
@@ -715,7 +721,7 @@ public void handleValue(TypedValue value) {
715721
716722 @ Test
717723 public void typedValueConvertsToUUID () throws InterruptedException {
718- Mentat mentat = new Mentat ( );
724+ Mentat mentat = Mentat . namedInMemoryStore ( "typedValueConvertsToUUID" );
719725 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
720726 final Long aEntid = report .getEntidForTempId ("a" );
721727 String query = "[:find ?v . :in ?e :where [?e :foo/uuid ?v]]" ;
@@ -738,7 +744,7 @@ public void handleValue(TypedValue value) {
738744
739745 @ Test
740746 public void valueForAttributeOfEntitySucceeds () throws InterruptedException {
741- Mentat mentat = new Mentat ( );
747+ Mentat mentat = Mentat . namedInMemoryStore ( "valueForAttributeOfEntitySucceeds" );
742748 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
743749 final Long aEntid = report .getEntidForTempId ("a" );
744750 TypedValue value = mentat .valueForAttributeOfEntity (":foo/long" , aEntid );
@@ -756,15 +762,15 @@ public void entidForAttributeSucceeds() {
756762
757763 @ Test
758764 public void testInProgressTransact () {
759- Mentat mentat = new Mentat ( );
765+ Mentat mentat = Mentat . namedInMemoryStore ( "testInProgressTransact" );
760766 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
761767 assertNotNull (report );
762768
763769 }
764770
765771 @ Test
766772 public void testInProgressRollback () {
767- Mentat mentat = new Mentat ( );
773+ Mentat mentat = Mentat . namedInMemoryStore ( "testInProgressRollback" );
768774 TxReport report = this .populateWithTypesSchema (mentat ).dataReport ;
769775 assertNotNull (report );
770776 long aEntid = report .getEntidForTempId ("a" );
@@ -782,7 +788,7 @@ public void testInProgressRollback() {
782788
783789 @ Test
784790 public void testInProgressEntityBuilder () throws InterruptedException {
785- Mentat mentat = new Mentat ( );
791+ Mentat mentat = Mentat . namedInMemoryStore ( "testInProgressEntityBuilder" );
786792 DBSetupResult reports = this .populateWithTypesSchema (mentat );
787793 long bEntid = reports .dataReport .getEntidForTempId ("b" );
788794 final long longEntid = reports .schemaReport .getEntidForTempId ("l" );
@@ -862,7 +868,7 @@ public void handleRow(TupleResult row) {
862868
863869 @ Test
864870 public void testEntityBuilderForEntid () throws InterruptedException {
865- Mentat mentat = new Mentat ( );
871+ Mentat mentat = Mentat . namedInMemoryStore ( "testEntityBuilderForEntid" );
866872 DBSetupResult reports = this .populateWithTypesSchema (mentat );
867873 long bEntid = reports .dataReport .getEntidForTempId ("b" );
868874 final long longEntid = reports .schemaReport .getEntidForTempId ("l" );
@@ -942,7 +948,7 @@ public void handleRow(TupleResult row) {
942948
943949 @ Test
944950 public void testEntityBuilderForTempid () throws InterruptedException {
945- Mentat mentat = new Mentat ( );
951+ Mentat mentat = Mentat . namedInMemoryStore ( "testEntityBuilderForTempid" );
946952 DBSetupResult reports = this .populateWithTypesSchema (mentat );
947953 final long longEntid = reports .schemaReport .getEntidForTempId ("l" );
948954
@@ -998,7 +1004,7 @@ public void handleRow(TupleResult row) {
9981004
9991005 @ Test
10001006 public void testInProgressBuilderTransact () throws InterruptedException {
1001- Mentat mentat = new Mentat ( );
1007+ Mentat mentat = Mentat . namedInMemoryStore ( "testInProgressBuilderTransact" );
10021008 DBSetupResult reports = this .populateWithTypesSchema (mentat );
10031009 long aEntid = reports .dataReport .getEntidForTempId ("a" );
10041010 long bEntid = reports .dataReport .getEntidForTempId ("b" );
@@ -1063,7 +1069,7 @@ public void handleRow(TupleResult row) {
10631069
10641070 @ Test
10651071 public void testEntityBuilderTransact () throws InterruptedException {
1066- Mentat mentat = new Mentat ( );
1072+ Mentat mentat = Mentat . namedInMemoryStore ( "testEntityBuilderTransact" );
10671073 DBSetupResult reports = this .populateWithTypesSchema (mentat );
10681074 long aEntid = reports .dataReport .getEntidForTempId ("a" );
10691075 long bEntid = reports .dataReport .getEntidForTempId ("b" );
@@ -1129,7 +1135,7 @@ public void handleRow(TupleResult row) {
11291135
11301136 @ Test
11311137 public void testEntityBuilderRetract () throws InterruptedException {
1132- Mentat mentat = new Mentat ( );
1138+ Mentat mentat = Mentat . namedInMemoryStore ( "testEntityBuilderRetract" );
11331139 DBSetupResult reports = this .populateWithTypesSchema (mentat );
11341140 long bEntid = reports .dataReport .getEntidForTempId ("b" );
11351141 final long longEntid = reports .schemaReport .getEntidForTempId ("l" );
@@ -1199,7 +1205,7 @@ public void handleRow(TupleResult row) {
11991205
12001206 @ Test
12011207 public void testInProgressBuilderRetract () throws InterruptedException {
1202- Mentat mentat = new Mentat ( );
1208+ Mentat mentat = Mentat . namedInMemoryStore ( "testInProgressBuilderRetract" );
12031209 DBSetupResult reports = this .populateWithTypesSchema (mentat );
12041210 long bEntid = reports .dataReport .getEntidForTempId ("b" );
12051211 final long longEntid = reports .schemaReport .getEntidForTempId ("l" );
@@ -1274,7 +1280,7 @@ public void testCaching() throws InterruptedException {
12741280 " [?neighborhood :neighborhood/district ?d]\n " +
12751281 " [?d :district/name ?district]]" ;
12761282
1277- Mentat mentat = openAndInitializeCitiesStore ();
1283+ Mentat mentat = openAndInitializeCitiesStore ("testCaching" );
12781284
12791285 final Expectation expectation1 = new Expectation ();
12801286 final QueryTimer uncachedTimer = new QueryTimer ();
0 commit comments