use of org.apache.ignite.resources.FileSystemResource in project ignite by apache.
the class IgfsSecondaryFileSystemInjectionSelfTest method testInjectPrimaryByField.
/**
* @throws Exception If failed.
*/
@SuppressWarnings({ "UnusedDeclaration" })
public void testInjectPrimaryByField() throws Exception {
secondary = new TestBaseSecondaryFsMock() {
@FileSystemResource
private IgfsImpl igfs;
@LoggerResource
private IgniteLogger log;
@IgniteInstanceResource
private Ignite ig;
@Override
boolean checkInjection(Ignite ignite, IgniteFileSystem primary) {
return igfs == primary && log instanceof IgniteLogger && ig == ignite;
}
};
Ignite ig = startGrid(0);
IgniteFileSystem igfs = ig.fileSystem(IGFS_NAME);
assert secondary.checkInjection(ig, igfs);
}
use of org.apache.ignite.resources.FileSystemResource in project ignite by apache.
the class IgfsSecondaryFileSystemInjectionSelfTest method testInjectPrimaryByMethods.
/**
* @throws Exception If failed.
*/
@SuppressWarnings({ "UnusedDeclaration" })
public void testInjectPrimaryByMethods() throws Exception {
secondary = new TestBaseSecondaryFsMock() {
/** Ignite instance. */
private Ignite ig;
/** IGFS instance. */
private IgniteFileSystem igfs;
/** Logger injected flag */
private boolean logSet;
/**
* @param igfs Primary IGFS.
*/
@FileSystemResource
void setPrimaryIgfs(IgfsImpl igfs) {
this.igfs = igfs;
}
/**
* @param log Ignite logger.
*/
@LoggerResource
void setIgLogger(IgniteLogger log) {
logSet = log instanceof IgniteLogger;
}
/**
* @param ig Ignite instance.
*/
@IgniteInstanceResource
void setIgniteInst(Ignite ig) {
this.ig = ig;
}
@Override
boolean checkInjection(Ignite ignite, IgniteFileSystem primary) {
return ignite == ig && primary == igfs && logSet;
}
};
Ignite ig = startGrid(0);
IgniteFileSystem igfs = ig.fileSystem(IGFS_NAME);
assert secondary.checkInjection(ig, igfs);
}
Aggregations