Skip to content

Instantly share code, notes, and snippets.

@xcesco
xcesco / designer.html
Last active August 29, 2015 14:15
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title><![CDATA[BBC News - Home]]></title>
<description><![CDATA[BBC News - Home]]></description>
<link>http://www.bbc.co.uk/news/</link>
<image>
@BindDataSource(
daoSet = { DaoPerson.class },
typeAdapters = { @BindSqlAdapter(adapter = Date2Long.class) },
fileName = "person.db")
public interface PersonDataSource {
}
public class Date2Long implements SqlTypeAdapter<Date, Long> {
@Override
public Date toJava(Long dataValue) {
if (dataValue != null) { return new Date(2); }
return null;
}
@Override
public Long toData(Date javaValue) {
if (javaValue != null) { return javaValue.getTime(); }
return null;
@BindSqlType
public class Person {
public long id;
@BindSqlColumn(columnAffinity=ColumnAffinityType.BLOB)
public String name;
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"kripton.schemaLocation": "${projectDir}/schemas".toString()]
}
}
@Test
public void testMigration() throws Exception {
// Context of the app under test.
Context testContext = InstrumentationRegistry.getContext();
Context context = InstrumentationRegistry.getTargetContext();
KriptonLibrary.init(context);
InputStream schema1 = testContext.getAssets().open("xeno_schema_1.sql");
InputStream schema2 = testContext.getAssets().open("xeno_schema_2.sql");
InputStream finalSchema1 = testContext.getAssets().open("xeno_schema_1.sql");
InputStream finalSchema2 = testContext.getAssets().open("xeno_schema_2.sql");
@BindDataSourceOptions(
logEnabled = true,
populator = PersonPopulator.class,
cursorFactory = PersonCursorFactory.class,
databaseLifecycleHandler = PersonLifecycleHandler.class,
updateTasks = {
@BindDataSourceUpdateTask(version = 2, task = PersonUpdateTask.class) })
@BindDataSource(daoSet = { DaoPerson.class }, fileName = "app.db")
public interface AppWithConfigDataSource {
// create data source
BindAppWithConfigDataSource ds = BindAppWithConfigDataSource.getInstance();
@BindType("item")
@BindSqlType(name = "articles")
public class Article extends Entity {
public String title;
public String description;
public URL link;