CASA/c_policy/Test.cs
2005-10-11 19:51:00 +00:00

99 lines
3.7 KiB
C#

using System;
using System.Collections;
using Novell.CASA.CASAPolicy;
class Test
{
public static void Main()
{
ArrayList storeList = new ArrayList();
Store store = new Store("kwallet","walletid");
storeList.Add(store);
store = new Store("gnome-keyring","keyring1");
storeList.Add(store);
AggregationPol aggPol = new AggregationPol(storeList);
PersistencePol persistPol = new PersistencePol("linux","myfile.xml",10);
UIPol uiPol = new UIPol(true,false,true,"auto");
ArrayList linkKeyList = new ArrayList();
KWLinkKey kwLinkKey = new KWLinkKey("wallet1","folder1","kw-secret","kw-passwd");
linkKeyList.Add(kwLinkKey);
GKLinkKey gkLinkKey = new GKLinkKey("keyring1","gk-secret","gk-passwd");
linkKeyList.Add(gkLinkKey);
Link link1 = new Link(linkKeyList);
linkKeyList = new ArrayList();
kwLinkKey = new KWLinkKey("wallet1","folder1","kw-secret","kw-username");
linkKeyList.Add(kwLinkKey);
gkLinkKey = new GKLinkKey("keyring1","gk-secret","gk-username");
linkKeyList.Add(gkLinkKey);
/*
MZLinkKey mzLinkKey = new MZLinkKey("profile1","mz-secret","mz-username");
linkKeyList.Add(mzLinkKey);
*/
Link link2 = new Link(linkKeyList);
ArrayList grp = new ArrayList();
grp.Add(link1);
grp.Add(link2);
LinkGroup linkGrp = new LinkGroup(grp);
ArrayList grpList = new ArrayList();
grpList.Add(linkGrp);
SynchPol synchPol = new SynchPol(grpList);
CASAPol[] policies = new CASAPol[4];
policies[0] = aggPol;
policies[1] = persistPol;
policies[2] = uiPol;
policies[3] = synchPol;
ICASAPol.SetPolicies(policies);
policies = ICASAPol.GetPolicies();
for(int i = 0; i < policies.Length; i++)
{
if(policies[i] != null)
policies[i].DumpPol();
}
aggPol = (AggregationPol) ICASAPol.GetPolicy(CASAPolType.AGGREGATION_POL);
aggPol.DumpPol();
{
Console.WriteLine("AGGPOL \n");
ArrayList stores = aggPol.StoreList;
IEnumerator enumerator = stores.GetEnumerator();
while(enumerator.MoveNext())
{
Console.WriteLine("StoreName = " + ((Store)(enumerator.Current)).StoreName + " StoreId = " + ((Store)(enumerator.Current)).StoreId);
}
}
persistPol = (PersistencePol)ICASAPol.GetPolicy(CASAPolType.PERSISTENCE_POL);
persistPol.DumpPol();
{
Console.WriteLine("PERSISTENCE POL \n");
Console.WriteLine("persistPol.OS = " + persistPol.OS);
Console.WriteLine("persistPol.FilePath = " + persistPol.FilePath);
Console.WriteLine("persistPol.PollInterval = " + persistPol.PollInterval);
}
uiPol = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL);
uiPol.DumpPol();
{
Console.WriteLine("UIPOL \n");
Console.WriteLine("uiPol.showInTaskBar = " + uiPol.ShowInTaskBar);
Console.WriteLine("uiPol.showSecretValue = " + uiPol.ShowSecretValue);
Console.WriteLine("uiPol.showSecretInClearText = " + uiPol.ShowSecretInClearText);
Console.WriteLine("uiPol.synchEngineStartMode = " + uiPol.SynchEngineStartMode);
}
persistPol = new PersistencePol("win","winfile.xml",100);
ICASAPol.SetPolicy(persistPol);
persistPol = (PersistencePol) ICASAPol.GetPolicy(CASAPolType.PERSISTENCE_POL);
persistPol.DumpPol();
}
}