Tuukka Norri avatar Tuukka Norri committed 5b826c0

Moved the BaseTen schema -specific test to its own file

Comments (0)

Files changed (5)

UnitTests/Sources/BXMetadataTests.h

+//
+// BXMetadataTests.h
+// BaseTen
+//
+// Copyright (C) 2010 Marko Karppinen & Co. LLC.
+//
+// Before using this software, please review the available licensing options
+// by visiting http://basetenframework.org/licensing/ or by contacting
+// us at sales@karppinen.fi. Without an additional license, this software
+// may be distributed only in compliance with the GNU General Public License.
+//
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2.0,
+// as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// $Id$
+//
+
+#import <SenTestingKit/SenTestingKit.h>
+#import "BXTestCase.h"
+
+@class BXPGDatabaseDescription;
+
+
+@interface BXMetadataTests : BXTestCase
+{
+	BXPGDatabaseDescription* mDatabaseDescription;
+}
+@end

UnitTests/Sources/BXMetadataTests.m

+//
+// BXMetadataTests.m
+// BaseTen
+//
+// Copyright (C) 2010 Marko Karppinen & Co. LLC.
+//
+// Before using this software, please review the available licensing options
+// by visiting http://basetenframework.org/licensing/ or by contacting
+// us at sales@karppinen.fi. Without an additional license, this software
+// may be distributed only in compliance with the GNU General Public License.
+//
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2.0,
+// as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// $Id$
+//
+
+#import "BXMetadataTests.h"
+#import "MKCSenTestCaseAdditions.h"
+#import <BaseTen/BaseTen.h>
+#import <BaseTen/BXPGInterface.h>
+#import <BaseTen/BXPGDatabaseDescription.h>
+#import <BaseTen/PGTSConnection.h>
+#import <BaseTen/PGTSTableDescription.h>
+#import <BaseTen/PGTSIndexDescription.h>
+
+
+
+@implementation BXMetadataTests
+- (void) setUp
+{
+	[super setUp];
+	
+	[BXPGInterface class]; // Run +initialize.
+	
+	NSDictionary* connectionDictionary = [self connectionDictionary];
+	PGTSConnection* connection = [[[PGTSConnection alloc] init] autorelease];
+	BOOL status = [connection connectSync: connectionDictionary];
+	STAssertTrue (status, [[connection connectionError] description]);
+	
+	mDatabaseDescription = (id) [[connection databaseDescription] retain];
+	MKCAssertEqualObjects ([mDatabaseDescription class], [BXPGDatabaseDescription class]);
+	
+	[connection disconnect];
+}
+
+
+- (void) tearDown
+{
+	[mDatabaseDescription release];
+	[super tearDown];
+}
+
+
+- (void) test0SchemaVersion
+{
+	NSNumber *currentVersion = [BXPGVersion currentVersionNumber];
+	NSNumber *currentCompatVersion = [BXPGVersion currentCompatibilityVersionNumber];
+	
+	MKCAssertEqualObjects (currentCompatVersion, [mDatabaseDescription schemaCompatibilityVersion]);
+	MKCAssertEqualObjects (currentVersion, [mDatabaseDescription schemaVersion]);
+}
+
+
+- (void) test1ViewPkey
+{
+	MKCAssertNotNil (mDatabaseDescription);
+	PGTSTableDescription* table = [mDatabaseDescription table: @"test_v" inSchema: @"public"];
+	MKCAssertNotNil (table);
+	PGTSIndexDescription* pkey = [table primaryKey];
+	
+	MKCAssertNotNil (pkey);
+	MKCAssertFalse ([pkey isUnique]);
+	MKCAssertTrue ([pkey isPrimaryKey]);
+	
+	NSSet* columns = [pkey columns];
+	MKCAssertTrue (1 == [columns count]);
+	
+	MKCAssertEqualObjects (@"id", [[columns anyObject] name]);	
+}
+@end

UnitTests/Sources/EntityTests.m

 #import "MKCSenTestCaseAdditions.h"
 #import <BaseTen/BaseTen.h>
 #import <BaseTen/BXEnumerate.h>
-#import <BaseTen/BXDatabaseContextPrivate.h>
-#import <BaseTen/BXPGInterface.h>
-#import <BaseTen/BXPGTransactionHandler.h>
 
 
 @implementation EntityTests
-- (void) test0SchemaVersion
-{
-	NSNumber *currentVersion = [BXPGVersion currentVersionNumber];
-	NSNumber *currentCompatVersion = [BXPGVersion currentCompatibilityVersionNumber];
-	
-	NSError *error = nil;
-	STAssertTrue ([mContext connectSync: &error], [error description]);
-	
-	BXPGInterface *interface = (id) [mContext databaseInterface];
-	BXPGTransactionHandler *handler = [interface transactionHandler];
-	BXPGDatabaseDescription *desc = [handler databaseDescription];
-	
-	MKCAssertEqualObjects (currentCompatVersion, [desc schemaCompatibilityVersion]);
-	MKCAssertEqualObjects (currentVersion, [desc schemaVersion]);
-}
-
-
 - (void) test1ValidName
 {
 	NSError* error = nil;

UnitTests/Sources/PGTSMetadataTests.m

 {
 	[super setUp];
 	
-	[BXPGInterface class]; // Run +initialize.
-	
 	NSDictionary* connectionDictionary = [self connectionDictionary];
 	PGTSConnection* connection = [[[PGTSConnection alloc] init] autorelease];
 	BOOL status = [connection connectSync: connectionDictionary];
 	
 	MKCAssertEqualObjects (@"id", [[columns anyObject] name]);
 }
-
-- (void) test4ViewPkey
-{
-	MKCAssertNotNil (mDatabaseDescription);
-	PGTSTableDescription* table = [mDatabaseDescription table: @"test_v" inSchema: @"public"];
-	MKCAssertNotNil (table);
-	PGTSIndexDescription* pkey = [table primaryKey];
-	
-	MKCAssertNotNil (pkey);
-	MKCAssertFalse ([pkey isUnique]);
-	MKCAssertTrue ([pkey isPrimaryKey]);
-	
-	NSSet* columns = [pkey columns];
-	MKCAssertTrue (1 == [columns count]);
-	
-	MKCAssertEqualObjects (@"id", [[columns anyObject] name]);	
-}
 @end

UnitTests/UnitTests.xcodeproj/project.pbxproj

 		53C4C61711943369003FB842 /* PGTSInvocationRecorderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 53C4C61611943369003FB842 /* PGTSInvocationRecorderTests.m */; };
 		53C4C61C119439BF003FB842 /* NSArray+BaseTenAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 53C4C61B119439BF003FB842 /* NSArray+BaseTenAdditionsTests.m */; };
 		53C4C62111943C8E003FB842 /* NSPredicate+BaseTenAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 53C4C62011943C8E003FB842 /* NSPredicate+BaseTenAdditionsTests.m */; };
+		53C4C67B119443E1003FB842 /* BXMetadataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 53C4C67A119443E1003FB842 /* BXMetadataTests.m */; };
 		53C98A140CF0803A00D6A0A7 /* TestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 535059B30CDA1CFC00DA25EC /* TestLoader.m */; };
 		53CC51500EC45F0B003D33BF /* ToOneChangeNotificationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 53CC514F0EC45F0B003D33BF /* ToOneChangeNotificationTests.m */; };
 		53D03BA90DE828CB002D14C4 /* BaseTen.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 538B40F50D634EA40009005B /* BaseTen.framework */; };
 		53C4C61B119439BF003FB842 /* NSArray+BaseTenAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+BaseTenAdditionsTests.m"; path = "Sources/NSArray+BaseTenAdditionsTests.m"; sourceTree = "<group>"; };
 		53C4C61F11943C8E003FB842 /* NSPredicate+BaseTenAdditionsTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSPredicate+BaseTenAdditionsTests.h"; path = "Sources/NSPredicate+BaseTenAdditionsTests.h"; sourceTree = "<group>"; };
 		53C4C62011943C8E003FB842 /* NSPredicate+BaseTenAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSPredicate+BaseTenAdditionsTests.m"; path = "Sources/NSPredicate+BaseTenAdditionsTests.m"; sourceTree = "<group>"; };
+		53C4C679119443E1003FB842 /* BXMetadataTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BXMetadataTests.h; path = Sources/BXMetadataTests.h; sourceTree = "<group>"; };
+		53C4C67A119443E1003FB842 /* BXMetadataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BXMetadataTests.m; path = Sources/BXMetadataTests.m; sourceTree = "<group>"; };
 		53CC514E0EC45F0B003D33BF /* ToOneChangeNotificationTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToOneChangeNotificationTests.h; path = Sources/ToOneChangeNotificationTests.h; sourceTree = "<group>"; };
 		53CC514F0EC45F0B003D33BF /* ToOneChangeNotificationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ToOneChangeNotificationTests.m; path = Sources/ToOneChangeNotificationTests.m; sourceTree = "<group>"; };
 		53CEB9EF0B28516F007DAF0D /* MKCSenTestCaseAdditions.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = MKCSenTestCaseAdditions.h; path = Sources/MKCSenTestCaseAdditions.h; sourceTree = "<group>"; };
 				530A439E0A5C114E00A4722B /* ConnectTest.m */,
 				5392E6610FC1B0C70056DF6A /* BXSSLConnectionTests.h */,
 				5392E6620FC1B0C70056DF6A /* BXSSLConnectionTests.m */,
+				53C4C679119443E1003FB842 /* BXMetadataTests.h */,
+				53C4C67A119443E1003FB842 /* BXMetadataTests.m */,
 				530925270FA89023000DC21C /* BXDataModelTests.h */,
 				530925280FA89023000DC21C /* BXDataModelTests.m */,
 				537E32C30FAF078600539A83 /* BXSQLTests.h */,
 				53C4C61711943369003FB842 /* PGTSInvocationRecorderTests.m in Sources */,
 				53C4C61C119439BF003FB842 /* NSArray+BaseTenAdditionsTests.m in Sources */,
 				53C4C62111943C8E003FB842 /* NSPredicate+BaseTenAdditionsTests.m in Sources */,
+				53C4C67B119443E1003FB842 /* BXMetadataTests.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.