Java Code Examples for mil.nga.geopackage.extension.Extensions#setDefinition()

The following examples show how to use mil.nga.geopackage.extension.Extensions#setDefinition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtensionsUtils.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Test create
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreate(GeoPackage geoPackage) throws SQLException {

	ExtensionsDao dao = geoPackage.getExtensionsDao();

	if (dao.isTableExists()) {
		// Get current count
		long count = dao.countOf();

		// Create new extensions
		String tableName = "CREATE_TABLE_NAME";
		String columnName = "CREATE_COLUMN_NAME";
		String author = "nga";
		String extension = "create_extension";
		String definition = "definition";
		ExtensionScopeType scopeType = ExtensionScopeType.READ_WRITE;

		Extensions extensions = new Extensions();
		extensions.setTableName(tableName);
		extensions.setColumnName(columnName);
		extensions.setExtensionName(author, extension);
		extensions.setDefinition(definition);
		extensions.setScope(scopeType);
		dao.create(extensions);

		// Verify count
		long newCount = dao.countOf();
		TestCase.assertEquals(count + 1, newCount);

		// Verify saved extensions
		Extensions queryExtensions = dao.queryByExtension(
				extensions.getExtensionName(), extensions.getTableName(),
				extensions.getColumnName());
		TestCase.assertNotNull(queryExtensions);
		TestCase.assertEquals(tableName, queryExtensions.getTableName());
		TestCase.assertEquals(columnName, queryExtensions.getColumnName());
		TestCase.assertEquals(author + Extensions.EXTENSION_NAME_DIVIDER
				+ extension, queryExtensions.getExtensionName());
		TestCase.assertEquals(author, queryExtensions.getAuthor());
		TestCase.assertEquals(extension,
				queryExtensions.getExtensionNameNoAuthor());
		TestCase.assertEquals(definition, queryExtensions.getDefinition());
		TestCase.assertEquals(scopeType, queryExtensions.getScope());
	}

}
 
Example 2
Source File: ExtensionsUtils.java    From geopackage-java with MIT License 4 votes vote down vote up
/**
 * Test create
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testCreate(GeoPackage geoPackage) throws SQLException {

	ExtensionsDao dao = geoPackage.getExtensionsDao();

	if (dao.isTableExists()) {
		// Get current count
		long count = dao.countOf();

		// Create new extensions
		String tableName = "CREATE_TABLE_NAME";
		String columnName = "CREATE_COLUMN_NAME";
		String author = "nga";
		String extension = "create_extension";
		String definition = "definition";
		ExtensionScopeType scopeType = ExtensionScopeType.READ_WRITE;

		Extensions extensions = new Extensions();
		extensions.setTableName(tableName);
		extensions.setColumnName(columnName);
		extensions.setExtensionName(author, extension);
		extensions.setDefinition(definition);
		extensions.setScope(scopeType);
		dao.create(extensions);

		// Verify count
		long newCount = dao.countOf();
		TestCase.assertEquals(count + 1, newCount);

		// Verify saved extensions
		Extensions queryExtensions = dao.queryByExtension(
				extensions.getExtensionName(), extensions.getTableName(),
				extensions.getColumnName());
		TestCase.assertNotNull(queryExtensions);
		TestCase.assertEquals(tableName, queryExtensions.getTableName());
		TestCase.assertEquals(columnName, queryExtensions.getColumnName());
		TestCase.assertEquals(author + Extensions.EXTENSION_NAME_DIVIDER
				+ extension, queryExtensions.getExtensionName());
		TestCase.assertEquals(author, queryExtensions.getAuthor());
		TestCase.assertEquals(extension,
				queryExtensions.getExtensionNameNoAuthor());
		TestCase.assertEquals(definition, queryExtensions.getDefinition());
		TestCase.assertEquals(scopeType, queryExtensions.getScope());
	}

}