use of org.nhind.config.ConfigurationServiceProxy in project nhin-d by DirectProject.
the class ClientProxyCertificatePolicyTest method setupClass.
@BeforeClass
public static void setupClass() throws Exception {
ConfigServiceRunner.startConfigService();
proxy = new ConfigurationServiceProxy(ConfigServiceRunner.getConfigServiceURL());
}
use of org.nhind.config.ConfigurationServiceProxy in project nhin-d by DirectProject.
the class ClientProxyEndToEndTest method setupClass.
@BeforeClass
public static void setupClass() throws Exception {
ConfigServiceRunner.startConfigService();
proxy = new ConfigurationServiceProxy(ConfigServiceRunner.getConfigServiceURL());
}
use of org.nhind.config.ConfigurationServiceProxy in project nhin-d by DirectProject.
the class WSSmtpAgentConfigFunctional_Test method setUp.
/**
* Initialize the servers- LDAP and HTTP.
*/
@SuppressWarnings("unchecked")
@Override
public void setUp() throws Exception {
// check for Windows... it doens't like file://<drive>... turns it into FTP
File file = new File("./src/test/resources/bundles/testBundle.p7b");
if (file.getAbsolutePath().contains(":/"))
filePrefix = "file:///";
else
filePrefix = "file:///";
CertCacheFactory.getInstance().flushAll();
/*
* Setup the LDAP Server
*/
MutablePartitionConfiguration pcfg = new MutablePartitionConfiguration();
pcfg.setName("lookupTest");
pcfg.setSuffix("cn=lookupTest");
// Create some indices
Set<String> indexedAttrs = new HashSet<String>();
indexedAttrs.add("objectClass");
indexedAttrs.add("cn");
pcfg.setIndexedAttributes(indexedAttrs);
// Create a first entry associated to the partition
Attributes attrs = new BasicAttributes(true);
// First, the objectClass attribute
Attribute attr = new BasicAttribute("objectClass");
attr.add("top");
attrs.put(attr);
// Associate this entry to the partition
pcfg.setContextEntry(attrs);
// As we can create more than one partition, we must store
// each created partition in a Set before initialization
Set<MutablePartitionConfiguration> pcfgs = new HashSet<MutablePartitionConfiguration>();
pcfgs.add(pcfg);
//
//
//
// add the lookupTestPublic
//
//
pcfg = new MutablePartitionConfiguration();
pcfg.setName("lookupTestPublic");
pcfg.setSuffix("cn=lookupTestPublic");
// Create some indices
indexedAttrs = new HashSet<String>();
indexedAttrs.add("objectClass");
indexedAttrs.add("cn");
pcfg.setIndexedAttributes(indexedAttrs);
// Create a first entry associated to the partition
attrs = new BasicAttributes(true);
// First, the objectClass attribute
attr = new BasicAttribute("objectClass");
attr.add("top");
attrs.put(attr);
// Associate this entry to the partition
pcfg.setContextEntry(attrs);
// As we can create more than one partition, we must store
// each created partition in a Set before initialization
pcfgs.add(pcfg);
configuration.setContextPartitionConfigurations(pcfgs);
this.configuration.setWorkingDirectory(new File("LDAP-TEST"));
// add the private key schema
///
Set<AbstractBootstrapSchema> schemas = configuration.getBootstrapSchemas();
schemas.add(new PrivkeySchema());
configuration.setBootstrapSchemas(schemas);
super.setUp();
// import the ldif file
InputStream stream = TestUtils.class.getResourceAsStream("/ldifs/privCertsOnly.ldif");
if (stream == null)
throw new IOException("Failed to load ldif file");
importLdif(stream);
// setup the mock DNS SRV adapter
mockLookup = mock(Lookup.class);
LookupFactory.getFactory().addOverrideImplementation(mockLookup);
SRVRecord srvRecord = new SRVRecord(new Name("_ldap._tcp.example.com."), DClass.IN, 3600, 0, 1, port, new Name("localhost."));
when(mockLookup.run()).thenReturn(new Record[] { srvRecord });
// create the web service and proxy
ConfigServiceRunner.startConfigService();
proxy = new ConfigurationServiceProxy(ConfigServiceRunner.getConfigServiceURL());
}
use of org.nhind.config.ConfigurationServiceProxy in project nhin-d by DirectProject.
the class NHINDSecurityAndTrustMailet_initialization_Test method testValidMailetConfiguration_AssertProperWSInitialization.
public void testValidMailetConfiguration_AssertProperWSInitialization() throws Exception {
new TestPlan() {
private ConfigurationServiceProxy proxy;
@Override
protected MailetConfig getMailetConfig() throws Exception {
ConfigServiceRunner.startConfigService();
cleanConfig();
addDomains();
addTrustAnchors();
Map<String, String> params = new HashMap<String, String>();
params.put("ConfigURL", ConfigServiceRunner.getConfigServiceURL());
return new MockMailetConfig(params, "NHINDSecurityAndTrustMailet");
}
protected void addDomains() throws Exception {
Domain dom = new Domain();
dom.setDomainName("cerner.com");
dom.setPostMasterEmail("postmaster@cerner.com");
proxy.addDomain(dom);
dom = new Domain();
dom.setDomainName("securehealthemail.com");
dom.setPostMasterEmail("postmaster@securehealthemail.com");
proxy.addDomain(dom);
}
protected void addTrustAnchors() throws Exception {
Vector<Anchor> vec = new Vector<Anchor>();
Anchor anchor = new Anchor();
anchor.setData(getCertificateFileData("cacert.der"));
anchor.setOwner("cerner.com");
anchor.setIncoming(true);
anchor.setOutgoing(true);
vec.add(anchor);
anchor = new Anchor();
anchor.setData(getCertificateFileData("cacert.der"));
anchor.setOwner("securehealthemail.com");
anchor.setIncoming(true);
anchor.setOutgoing(true);
vec.add(anchor);
proxy.addAnchor(vec.toArray(new Anchor[vec.size()]));
}
protected void cleanConfig() throws Exception {
proxy = new ConfigurationServiceProxy(ConfigServiceRunner.getConfigServiceURL());
// clean domains
int domainCount = proxy.getDomainCount();
Domain[] doms = proxy.listDomains(null, domainCount);
if (doms != null)
for (Domain dom : doms) {
// clean anchors
proxy.removeAnchorsForOwner(dom.getDomainName());
proxy.removeDomain(dom.getDomainName());
}
// clean certificates
Certificate[] certs = proxy.listCertificates(0, 0x8FFFF, null);
if (certs != null)
for (Certificate cert : certs) proxy.removeCertificatesForOwner(cert.getOwner());
// clean settings
Setting[] settings = proxy.getAllSettings();
if (settings != null)
for (Setting setting : settings) proxy.deleteSetting(new String[] { setting.getName() });
}
@Override
protected void doAssertions(NHINDSecurityAndTrustMailet agent) throws Exception {
assertNotNull(agent);
assertNotNull(agent.getInitParameter("ConfigURL"));
assertEquals(ConfigServiceRunner.getConfigServiceURL(), agent.getInitParameter("ConfigURL"));
}
}.perform();
}
use of org.nhind.config.ConfigurationServiceProxy in project nhin-d by DirectProject.
the class ConfigServiceDNSStore_isCertCompliantWithPolicyTest method setUp.
public void setUp() {
try {
if (!ConfigServiceRunner.isServiceRunning())
ConfigServiceRunner.startConfigService();
proxy = new ConfigurationServiceProxy(ConfigServiceRunner.getConfigServiceURL());
cleanRecords();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations