From c1eed0c0cdf912eb849282aae810d4c801301609 Mon Sep 17 00:00:00 2001 From: Gerd Behrmann Date: Mon, 16 Dec 2013 14:05:44 +0100 Subject: [PATCH] poolmanager: Replace StorageInfo by FileAttributes in PSU Also avoid the use of the legacy StoageInfo#toString method. Target: trunk Require-notes: no Require-book: no Acked-by: Albert Rossir Patch: http://rb.dcache.org/r/6357/ --- .../doors/DCapDoorInterpreterV3.java | 2 +- .../dataaccess/impl/StandardPoolsDAO.java | 7 +- .../poolManager/PoolManagerV5.java | 2 +- .../poolManager/PoolMonitorV5.java | 10 +- .../poolManager/PoolSelectionUnit.java | 5 +- .../poolManager/PoolSelectionUnitV2.java | 30 +++--- .../diskCacheV111/services/space/Manager.java | 2 +- .../vehicles/PoolMgrQueryPoolsMsg.java | 30 +++--- .../poolmanager/PoolSelectionUnitTest.java | 99 +++++++++++-------- 9 files changed, 108 insertions(+), 79 deletions(-) diff --git a/modules/dcache-dcap/src/main/java/diskCacheV111/doors/DCapDoorInterpreterV3.java b/modules/dcache-dcap/src/main/java/diskCacheV111/doors/DCapDoorInterpreterV3.java index b8a3bf77dc8..b59d43b81b1 100644 --- a/modules/dcache-dcap/src/main/java/diskCacheV111/doors/DCapDoorInterpreterV3.java +++ b/modules/dcache-dcap/src/main/java/diskCacheV111/doors/DCapDoorInterpreterV3.java @@ -1734,7 +1734,7 @@ public void fileAttributesAvailable(){ new PoolMgrQueryPoolsMsg(DirectionType.READ, _protocolName , _destination , - _fileAttributes.getStorageInfo()); + _fileAttributes); CellMessage checkMessage = new CellMessage( _poolMgrPath , query ) ; setStatus("Waiting for reply from PoolManager"); diff --git a/modules/dcache-webadmin/src/main/java/org/dcache/webadmin/model/dataaccess/impl/StandardPoolsDAO.java b/modules/dcache-webadmin/src/main/java/org/dcache/webadmin/model/dataaccess/impl/StandardPoolsDAO.java index 09acaf4ee88..c8425c9216c 100644 --- a/modules/dcache-webadmin/src/main/java/org/dcache/webadmin/model/dataaccess/impl/StandardPoolsDAO.java +++ b/modules/dcache-webadmin/src/main/java/org/dcache/webadmin/model/dataaccess/impl/StandardPoolsDAO.java @@ -23,10 +23,10 @@ import diskCacheV111.pools.PoolCostInfo; import diskCacheV111.pools.PoolV2Mode; import diskCacheV111.vehicles.GenericStorageInfo; -import diskCacheV111.vehicles.StorageInfo; import org.dcache.poolmanager.Partition; import org.dcache.poolmanager.PoolMonitor; +import org.dcache.vehicles.FileAttributes; import org.dcache.webadmin.model.businessobjects.Pool; import org.dcache.webadmin.model.dataaccess.PoolsDAO; import org.dcache.webadmin.model.dataaccess.communication.CellMessageGenerator; @@ -226,9 +226,10 @@ public PoolPreferenceLevel[] match(DirectionType type, String netUnitName, String protocolUnitName, String hsm, String storageClass, String linkGroupName) throws DAOException { try { - StorageInfo storageInfo = new GenericStorageInfo(hsm, storageClass); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(new GenericStorageInfo(hsm, storageClass)); return getPoolSelectionUnit().match(type, netUnitName, - protocolUnitName, storageInfo, linkGroupName); + protocolUnitName, fileAttributes, linkGroupName); } catch (NoSuchContextException ex) { throw new DAOException("Data not available yet - PoolManger up already?", ex); } catch (IllegalArgumentException ex) { diff --git a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolManagerV5.java b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolManagerV5.java index 04a6d5efb86..f00089b7bf2 100644 --- a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolManagerV5.java +++ b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolManagerV5.java @@ -529,7 +529,7 @@ public String apply(PoolSelectionUnit.SelectionPool pool) { _selectionUnit.match(accessType, msg.getNetUnitName(), msg.getProtocolUnitName(), - msg.getStorageInfo(), + msg.getFileAttributes(), null))); msg.setSucceeded(); return msg; diff --git a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolMonitorV5.java b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolMonitorV5.java index d12981c5279..efa3a0dfa0b 100644 --- a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolMonitorV5.java +++ b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolMonitorV5.java @@ -34,7 +34,6 @@ import diskCacheV111.vehicles.IpProtocolInfo; import diskCacheV111.vehicles.PoolManagerPoolInformation; import diskCacheV111.vehicles.ProtocolInfo; -import diskCacheV111.vehicles.StorageInfo; import diskCacheV111.vehicles.StorageInfos; import dmg.cells.nucleus.CellMessage; @@ -149,7 +148,7 @@ private PoolPreferenceLevel[] match(DirectionType direction) return _selectionUnit.match(direction, hostName, protocol, - StorageInfos.extractFrom(_fileAttributes), + _fileAttributes, _linkGroup); } @@ -517,24 +516,23 @@ public static Set getRequiredAttributesForFileLocality() return FileLocality.NONE; } - StorageInfo storageInfo = StorageInfos.extractFrom(attributes); PoolPreferenceLevel[] levels = _selectionUnit.match(DirectionType.READ, hostName, "*/*", - storageInfo, + attributes, null); Collection locations = attributes.getLocations(); for (PoolPreferenceLevel level: levels) { if (!Collections.disjoint(level.getPoolList(), locations)) { - return (storageInfo.isStored() + return (attributes.getStorageInfo().isStored() ? FileLocality.ONLINE_AND_NEARLINE : FileLocality.ONLINE); } } - if (storageInfo.isStored()) { + if (attributes.getStorageInfo().isStored()) { return FileLocality.NEARLINE; } diff --git a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnit.java b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnit.java index 1cebc4836b0..bc8670f6390 100644 --- a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnit.java +++ b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnit.java @@ -7,10 +7,11 @@ import java.util.Set; import diskCacheV111.pools.PoolV2Mode; -import diskCacheV111.vehicles.StorageInfo; import dmg.cells.nucleus.CellAddressCore; +import org.dcache.vehicles.FileAttributes; + public interface PoolSelectionUnit { /** @@ -184,7 +185,7 @@ public interface SelectionUnitGroup extends SelectionEntity { public SelectionLink getLinkByName( String linkName ) throws NoSuchElementException ; public PoolPreferenceLevel [] match( DirectionType type, String net , String protocol, - StorageInfo info, String linkGroup ) ; + FileAttributes fileAttributes, String linkGroup ) ; public String [] getActivePools() ; public String [] getDefinedPools( boolean enabledOnly ) ; public String getVersion() ; diff --git a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnitV2.java b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnitV2.java index 281bea76c2a..4c4073123a9 100644 --- a/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnitV2.java +++ b/modules/dcache/src/main/java/diskCacheV111/poolManager/PoolSelectionUnitV2.java @@ -28,12 +28,13 @@ import diskCacheV111.vehicles.GenericStorageInfo; import diskCacheV111.vehicles.StorageInfo; +import dmg.cells.nucleus.CellCommandListener; +import dmg.cells.nucleus.CellSetupProvider; import dmg.util.Args; import dmg.util.CommandSyntaxException; -import dmg.cells.nucleus.CellCommandListener; -import dmg.cells.nucleus.CellSetupProvider; import org.dcache.util.Glob; +import org.dcache.vehicles.FileAttributes; public class PoolSelectionUnitV2 implements Serializable, @@ -443,21 +444,21 @@ private LinkMap match(LinkMap linkMap, Unit unit, LinkGroup linkGroup, return linkMap; } - /** - * @Guarded by _psuReadLock - */ @Override public PoolPreferenceLevel[] match(DirectionType type, String netUnitName, String protocolUnitName, - StorageInfo storageInfo, String linkGroupName) { + FileAttributes fileAttributes, String linkGroupName) { + StorageInfo storageInfo = fileAttributes.getStorageInfo(); String storeUnitName = storageInfo.getStorageClass()+"@"+storageInfo.getHsm(); String dCacheUnitName = storageInfo.getCacheClass(); - _log.debug("running match: type={} store={} dCacheUnit={} net={} protocol={} SI={} linkGoup={}", type, - storeUnitName, dCacheUnitName, netUnitName, protocolUnitName, storageInfo, linkGroupName); - Map variableMap = storageInfo.getMap(); + _log.debug("running match: type={} store={} dCacheUnit={} net={} protocol={} keys={} locations={} linkGroup={}", + type, storeUnitName, dCacheUnitName, netUnitName, protocolUnitName, + variableMap, storageInfo.locations(), linkGroupName); + + PoolPreferenceLevel[] result = null; _psuReadLock.lock(); try { @@ -907,12 +908,13 @@ public Map match(Unit unit, LinkGroup linkGroup, DirectionType iot try { long start = System.currentTimeMillis(); - StorageInfo si = GenericStorageInfo.valueOf(args.argv(1), args.argv(2)); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf(args.argv(1), args.argv(2))); PoolPreferenceLevel[] list = match(args.argv(0).equals("*") ? DirectionType.ANY : DirectionType.valueOf(args.argv(0).toUpperCase()), args.argv(3).equals("*") ? null : args.argv(3), args - .argv(4).equals("*") ? null : args.argv(4), si, + .argv(4).equals("*") ? null : args.argv(4), fileAttributes, args.getOpt("linkGroup")); start = System.currentTimeMillis() - start; @@ -1525,12 +1527,12 @@ private Object[] fillLinkProperties(Link link, boolean resolve) { public Object ac_psux_match_$_5(Args args) { - - StorageInfo si = GenericStorageInfo.valueOf(args.argv(1), args.argv(2)); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf(args.argv(1), args.argv(2))); PoolPreferenceLevel[] list = match(DirectionType.valueOf(args.argv(0).toUpperCase()), args.argv(3).equals("*") ? null : args.argv(3), - args.argv(4).equals("*") ? null : args.argv(4), si, args.getOpt("linkGroup")); + args.argv(4).equals("*") ? null : args.argv(4), fileAttributes, args.getOpt("linkGroup")); return list; } diff --git a/modules/dcache/src/main/java/diskCacheV111/services/space/Manager.java b/modules/dcache/src/main/java/diskCacheV111/services/space/Manager.java index 60a93cc5dd2..929ec37f006 100644 --- a/modules/dcache/src/main/java/diskCacheV111/services/space/Manager.java +++ b/modules/dcache/src/main/java/diskCacheV111/services/space/Manager.java @@ -4441,7 +4441,7 @@ private List selectLinkGroupForWrite(ProtocolInfo protocolInfo, FileAttr poolMonitor.getPoolSelectionUnit().match(PoolSelectionUnit.DirectionType.WRITE, hostName, protocol, - fileAttributes.getStorageInfo(), + fileAttributes, linkGroup); if (level.length > 0) { outputLinkGroups.add(linkGroup); diff --git a/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrQueryPoolsMsg.java b/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrQueryPoolsMsg.java index 169daa035ba..42211abd603 100644 --- a/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrQueryPoolsMsg.java +++ b/modules/dcache/src/main/java/diskCacheV111/vehicles/PoolMgrQueryPoolsMsg.java @@ -6,12 +6,18 @@ import diskCacheV111.poolManager.PoolSelectionUnit.DirectionType; +import org.dcache.namespace.FileAttribute; +import org.dcache.vehicles.FileAttributes; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + public class PoolMgrQueryPoolsMsg extends Message { private final DirectionType _accessType ; - private String _netUnitName; - private String _protocolUnitName; - private StorageInfo _storageInfo; + private final String _netUnitName; + private final String _protocolUnitName; + private final FileAttributes _fileAttributes; private List []_poolList; private static final long serialVersionUID = 4739697573589962019L; @@ -19,20 +25,20 @@ public class PoolMgrQueryPoolsMsg extends Message { public PoolMgrQueryPoolsMsg(DirectionType accessType, String protocolUnit, String netUnitName, - StorageInfo storageInfo) { - _accessType = accessType ; - _protocolUnitName = protocolUnit; - _netUnitName = netUnitName ; - _storageInfo = storageInfo ; - - setReplyRequired(true); - assert _storageInfo != null; + FileAttributes fileAttributes) { + _accessType = checkNotNull(accessType); + _protocolUnitName = checkNotNull(protocolUnit); + _netUnitName = checkNotNull(netUnitName); + _fileAttributes = checkNotNull(fileAttributes); + checkArgument(fileAttributes.isDefined(FileAttribute.STORAGEINFO)); + + setReplyRequired(true); } public DirectionType getAccessType(){ return _accessType ; } public String getNetUnitName(){ return _netUnitName ; } public String getProtocolUnitName(){ return _protocolUnitName; } - public StorageInfo getStorageInfo(){ return _storageInfo ; } + public FileAttributes getFileAttributes() { return _fileAttributes; } public void setPoolList( List [] poolList ){ _poolList = poolList ; } public List [] getPools(){ return _poolList ; } } diff --git a/modules/dcache/src/test/java/org/dcache/tests/poolmanager/PoolSelectionUnitTest.java b/modules/dcache/src/test/java/org/dcache/tests/poolmanager/PoolSelectionUnitTest.java index 6f551c92a05..054cb81bd33 100644 --- a/modules/dcache/src/test/java/org/dcache/tests/poolmanager/PoolSelectionUnitTest.java +++ b/modules/dcache/src/test/java/org/dcache/tests/poolmanager/PoolSelectionUnitTest.java @@ -21,6 +21,8 @@ import dmg.util.CommandException; import dmg.util.CommandInterpreter; +import org.dcache.vehicles.FileAttributes; + import static org.junit.Assert.*; @@ -276,13 +278,14 @@ public void testAllPoolsOffline() throws CommandException { _ci.command("psu set allpoolsactive off"); - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup @@ -303,13 +306,14 @@ public void testAnyRead() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("Only default read link have to be triggered", 1, preference.length); @@ -326,13 +330,14 @@ public void testAnyWrite() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.WRITE, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("Only default write link have to be triggered", 1, preference.length); @@ -348,13 +353,14 @@ public void testH1Write() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.WRITE, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("H1 write link and default write link have to be triggered", 2, preference.length); @@ -370,13 +376,14 @@ public void testH1Read() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("H1 read link and default read link have to be triggered", 2, preference.length); @@ -393,14 +400,15 @@ public void testH1ReadFallback() throws CommandException { _ci.command("psu set allpoolsactive on"); _ci.command("psu set disabled h1-read"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("H1 read link and default read link have to be triggered", 2, preference.length); @@ -446,14 +454,15 @@ 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" ) ); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, "h1-link-group"); // linkGroup assertEquals("Only h1 read link have to be triggered", 1, preference.length); @@ -473,8 +482,9 @@ public void testSelectStagePoolByLinkGroup() throws Exception { _ci.command(new Args("psu addto linkGroup h1-link-group h1-read-link" ) ); StorageInfo storageInfo = new GenericStorageInfo("osm","h1:u1" ); - storageInfo.addLocation( new URI("osm://osm/?store=h1&bfid=1234") ); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(storageInfo); Set supportedHSM = new HashSet<>(); supportedHSM.add("osm"); @@ -485,7 +495,7 @@ public void testSelectStagePoolByLinkGroup() throws Exception { DirectionType.CACHE, // operation "131.169.214.149", // net unit null, // protocol - storageInfo, + fileAttributes, "h1-link-group"); // linkGroup assertEquals("Only h1 cache link have to be triggered", 1, preference.length); @@ -503,13 +513,14 @@ public void testSelectForP2P() throws CommandException { _ci.command("psu set allpoolsactive on"); _ci.command("psu set pool h1-read rdonly"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match(DirectionType.P2P, // operation "131.169.214.149", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup List pools = new ArrayList<>(); @@ -529,13 +540,14 @@ public void testAllPoolsOfflineIPv6() throws CommandException { _ci.command("psu set allpoolsactive off"); - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup @@ -556,13 +568,14 @@ public void testAnyReadIPv6() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("Only default read link have to be triggered", 1, preference.length); @@ -579,13 +592,14 @@ public void testAnyWriteIPv6() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.WRITE, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("Only default write link have to be triggered", 1, preference.length); @@ -601,13 +615,14 @@ public void testH1WriteIPv6() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.WRITE, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("H1 write link and default write link have to be triggered", 2, preference.length); @@ -623,13 +638,14 @@ public void testH1ReadIPv6() throws CommandException { _ci.command("psu set allpoolsactive on"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("H1 read link and default read link have to be triggered", 2, preference.length); @@ -646,14 +662,15 @@ public void testH1ReadFallbackIPv6() throws CommandException { _ci.command("psu set allpoolsactive on"); _ci.command("psu set disabled h1-read"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals("H1 read link and default read link have to be triggered", 2, preference.length); @@ -673,14 +690,15 @@ public void testSelectPoolByLinkGroupIPv6() 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" ) ); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match( DirectionType.READ, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, "h1-link-group"); // linkGroup assertEquals("Only h1 read link have to be triggered", 1, preference.length); @@ -700,8 +718,9 @@ public void testSelectStagePoolByLinkGroupIPv6() throws Exception { _ci.command(new Args("psu addto linkGroup h1-link-group h1-read-link" ) ); StorageInfo storageInfo = new GenericStorageInfo("osm","h1:u1" ); - storageInfo.addLocation( new URI("osm://osm/?store=h1&bfid=1234") ); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(storageInfo); Set supportedHSM = new HashSet<>(); supportedHSM.add("osm"); @@ -712,7 +731,7 @@ public void testSelectStagePoolByLinkGroupIPv6() throws Exception { DirectionType.CACHE, // operation "2001:638:700::f00:ba", // net unit null, // protocol - storageInfo, + fileAttributes, "h1-link-group"); // linkGroup assertEquals("Only h1 cache link have to be triggered", 1, preference.length); @@ -730,13 +749,14 @@ public void testSelectForP2PIPv6() throws CommandException { _ci.command("psu set allpoolsactive on"); _ci.command("psu set pool h1-read rdonly"); - StorageInfo si = GenericStorageInfo.valueOf("h1:u1@osm", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("h1:u1@osm", "*")); PoolPreferenceLevel[] preference = _psu.match(DirectionType.P2P, // operation "2001:638:700::f00:ba", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup List pools = new ArrayList<>(); @@ -754,7 +774,7 @@ public void testActive() throws CommandException { _ci.command( new Args("psu set active -on h1-read" ) ); SelectionPool pool = _psu.getPool("h1-read"); - assertNotNull("Null pool recieved", pool); + assertNotNull("Null pool received", pool); assertTrue("Pool is not active", pool.isActive()); assertTrue("Pool is not readable", pool.canRead()); } @@ -797,12 +817,13 @@ public void testRestrictedIPAddressExampleFromBook() /* We cannot read from a write pool. */ - StorageInfo si = GenericStorageInfo.valueOf("*", "*"); + FileAttributes fileAttributes = new FileAttributes(); + fileAttributes.setStorageInfo(GenericStorageInfo.valueOf("*", "*")); PoolPreferenceLevel[] preference = psu.match(DirectionType.READ, // operation "111.111.111.201", // net unit null, // protocol - si, + fileAttributes, null); // linkGroup assertEquals(0, preference.length); }