Revision 9005
Added by Jing Tao about 10 years ago
test/edu/ucsb/nceas/metacat/admin/upgrade/dataone/SyncAccessPolicyTest.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
import org.dataone.client.v2.CNode; |
38 | 38 |
import org.dataone.client.v2.itk.D1Client; |
39 |
import org.dataone.configuration.Settings; |
|
39 | 40 |
import org.dataone.service.exceptions.ServiceFailure; |
40 | 41 |
import org.dataone.service.types.v1.AccessPolicy; |
41 | 42 |
import org.dataone.service.types.v1.AccessRule; |
42 | 43 |
import org.dataone.service.types.v1.Identifier; |
44 |
import org.dataone.service.types.v1.NodeReference; |
|
43 | 45 |
import org.dataone.service.types.v1.Permission; |
44 | 46 |
import org.dataone.service.types.v1.Session; |
45 | 47 |
import org.dataone.service.types.v1.Subject; |
... | ... | |
137 | 139 |
SystemMetadata sysmeta = createSystemMetadata(guid, |
138 | 140 |
session.getSubject(), object); |
139 | 141 |
|
142 |
String nodeId = Settings.getConfiguration().getString("dataone.nodeId"); |
|
143 |
//System.out.println("the node id from the configuration file (metacat.properties) is =============================="+nodeId); |
|
144 |
if(nodeId != null && !nodeId.trim().equals("")) { |
|
145 |
//System.out.println("set the node id to be ============================== "+nodeId+" which comes from the configuration file"); |
|
146 |
NodeReference nr = new NodeReference(); |
|
147 |
nr.setValue(nodeId); |
|
148 |
sysmeta.setOriginMemberNode(nr); |
|
149 |
sysmeta.setAuthoritativeMemberNode(nr); |
|
150 |
} |
|
140 | 151 |
pid = MNodeService.getInstance(request).create(session, guid, |
141 | 152 |
object, sysmeta); |
142 | 153 |
} catch (Exception e) { |
Also available in: Unified diff
Overwrite the default node id (which value is metacat) from the metacat.properties. Otherwise, the test will fail.