use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.
the class PoolSelectionUnitTest method testSelectForP2PIPv6.
/*
* test case: check that we do not select read-only pools as p2p
* destinations.
*/
@Test
public void testSelectForP2PIPv6() throws CommandException {
_ci.command("psu set allpoolsactive on");
_ci.command("psu set pool h1-read rdonly");
FileAttributes fileAttributes = new FileAttributes();
StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
PoolPreferenceLevel[] preference = // operation
_psu.match(// operation
DirectionType.P2P, // net unit
"2001:638:700::f00:ba", // protocol
null, fileAttributes, // linkGroup
null, defaultExclude);
List<String> pools = new ArrayList<>();
for (PoolPreferenceLevel level : preference) {
pools.addAll(level.getPoolList());
}
assertEquals("More than expected pools selected", 1, pools.size());
assertEquals("Unexpected pool selected", "default-read", pools.get(0));
}
use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.
the class PoolSelectionUnitTest method testAllPoolsOfflineIPv6.
/*
* test case: check that if all pools is ofline, no pools returned
*/
@Test
public void testAllPoolsOfflineIPv6() throws CommandException {
_ci.command("psu set allpoolsactive off");
FileAttributes fileAttributes = new FileAttributes();
StorageInfos.injectInto(GenericStorageInfo.valueOf("*", "*"), fileAttributes);
PoolPreferenceLevel[] preference = _psu.match(// operation
DirectionType.READ, // net unit
"2001:638:700::f00:ba", // protocol
null, fileAttributes, // linkGroup
null, defaultExclude);
int found = 0;
for (PoolPreferenceLevel level : preference) {
found += level.getPoolList().size();
}
assertEquals(0, found);
}
use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.
the class PoolSelectionUnitTest method testSelectPoolByLinkGroup.
/*
@Test
public void testSelectPoolWithoutGroup() throws CommandException {
_ci.command("psu set allpoolsactive on");
_ci.command(new Args("psu create linkGroup h1-link-group"));
_ci.command(new Args("psu addto linkGroup h1-link-group h1-read-link"));
PoolPreferenceLevel[] preference = _psu.match(
"read", // operation
"h1:u1@osm", // storage unit
null, // dCache unit
"131.169.214.149", // net unit
null, // protocol
null, // map
null); // linkGroup
assertEquals("Only default read link have to be triggered", 1, preference.length);
assertEquals("Only default read pool with attracion 0", 1, preference[0].getPoolList().size());
assertEquals("Only default read pool with attracion 0 (default-read)", "default-read", preference[0].getPoolList().get(0));
}
*/
/*
* test case: check that we do not get pools from LinkGroup
*/
@Test
public void testSelectPoolByLinkGroup() throws CommandException {
_ci.command("psu set allpoolsactive on");
_ci.command(new Args("psu create linkGroup h1-link-group"));
_ci.command(new Args("psu addto linkGroup h1-link-group h1-read-link"));
FileAttributes fileAttributes = new FileAttributes();
StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
PoolPreferenceLevel[] preference = _psu.match(// operation
DirectionType.READ, // net unit
"131.169.214.149", // protocol
null, fileAttributes, // linkGroup
"h1-link-group", defaultExclude);
assertEquals("Only h1 read link have to be triggered", 1, preference.length);
assertEquals("Only h1 read pool with attracion 0", 1, preference[0].getPoolList().size());
assertEquals("Only h1 read pool with attracion 0 (h1-read)", "h1-read", preference[0].getPoolList().get(0));
}
use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.
the class PoolSelectionUnitTest method testSelectForP2P.
/*
* test case: check that we do not select read-only pools as p2p
* destinations.
*/
@Test
public void testSelectForP2P() throws CommandException {
_ci.command("psu set allpoolsactive on");
_ci.command("psu set pool h1-read rdonly");
FileAttributes fileAttributes = new FileAttributes();
StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
PoolPreferenceLevel[] preference = // operation
_psu.match(// operation
DirectionType.P2P, // net unit
"131.169.214.149", // protocol
null, fileAttributes, null, // linkGroup
defaultExclude);
List<String> pools = new ArrayList<>();
for (PoolPreferenceLevel level : preference) {
pools.addAll(level.getPoolList());
}
assertEquals("More than expected pools selected", 1, pools.size());
assertEquals("Unexpected pool selected", "default-read", pools.get(0));
}
use of diskCacheV111.poolManager.PoolPreferenceLevel in project dcache by dCache.
the class PoolSelectionUnitTest method testH1ReadFallback.
/*
* test case: check that if he pool is down, we get default pool
*/
@Test
public void testH1ReadFallback() throws CommandException {
_ci.command("psu set allpoolsactive on");
_ci.command("psu set disabled h1-read");
FileAttributes fileAttributes = new FileAttributes();
StorageInfos.injectInto(GenericStorageInfo.valueOf("h1:u1@osm", "*"), fileAttributes);
PoolPreferenceLevel[] preference = _psu.match(// operation
DirectionType.READ, // net unit
"131.169.214.149", // protocol
null, fileAttributes, // linkGroup
null, defaultExclude);
assertEquals("H1 read link and default read link have to be triggered", 2, preference.length);
assertEquals("No h1 pool when it's disabled with attracion 0", 0, preference[0].getPoolList().size());
assertEquals("Only default read pool with attracion 0", 1, preference[1].getPoolList().size());
assertEquals("Only default read pool with attracion 0 (default-read)", "default-read", preference[1].getPoolList().get(0));
}
Aggregations