-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blob Handle #4
Labels
Comments
private RepositoryImpl r;
private ReadSession session;
@Override
protected void setUp() throws Exception {
super.setUp();
this.r = RepositoryImpl.create() ;
r.defineConfig("test.node", new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC).invocationBatching().enable().clustering()
.sync().replTimeout(20000)
.loaders().preload(true).shared(false).passivation(false).addCacheLoader().cacheLoader(new FastFileCacheStore()).addProperty("location","./resource/store/test")
.purgeOnStartup(false).ignoreModifications(false).fetchPersistentState(true).async().enabled(false).build()) ;
r.defineConfig("test.blobdata", new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC)
.sync().replTimeout(20000)
.loaders().preload(true).shared(false).passivation(false).addCacheLoader().cacheLoader(new FastFileCacheStore()).addProperty("location","./resource/store/test")
.purgeOnStartup(false).ignoreModifications(false).fetchPersistentState(true).async().enabled(false).build()) ;
r.defineConfig("test.blobmeta", new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC)
.sync().replTimeout(20000)
.loaders().preload(true).shared(false).passivation(false).addCacheLoader().cacheLoader(new FastFileCacheStore()).addProperty("location","./resource/store/test")
.purgeOnStartup(false).ignoreModifications(false).fetchPersistentState(true).async().enabled(false).build()) ;
this.session = r.testLogin("test") ;
}
@Override
protected void tearDown() throws Exception {
r.shutdown() ;
super.tearDown();
}
public void testSave() throws Exception {
session.tranSync(new TransactionJob<Void>() {
@Override
public Void handle(WriteSession wsession) {
WriteNode bleujin = wsession.pathBy("/bleujin").blob("config", new File("./resource/config/server-simple.xml"));
Debug.line(bleujin.property("config").asBlob().toFile()) ;
return null;
}
}) ;
Debug.line(session.pathBy("/bleujin").property("config").asBlob().toFile()) ;
}
public void testRead() throws Exception {
final PropertyValue property = session.pathBy("/bleujin").property("config");
Debug.line(property.stringValue()) ;
final BlobValue blob = property.asBlob();
final File file = blob.toFile();
Debug.line(file, file.getParentFile(), file.isDirectory()) ;
// Debug.debug(IOUtil.toString(blob.toInputStream())) ;
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: