public void TestOperationRequest() { ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl(); configProperties.Properties = (new List <ConfigurationPropertyImpl>()); APIConfigurationImpl apiImpl = new APIConfigurationImpl(); apiImpl.ConfigurationProperties = (configProperties); IList <object> args = new List <object>(); args.Add("my arg"); OperationRequest v1 = new OperationRequest(new ConnectorKey("my bundle", "my version", "my connector"), SerializerUtil.SerializeBase64Object(apiImpl), SafeType <APIOperation> .Get <CreateApiOp>(), "mymethodName", args); OperationRequest v2 = (OperationRequest)CloneObject(v1); Assert.AreEqual("my bundle", v2.ConnectorKey.BundleName); Assert.AreEqual("my version", v2.ConnectorKey.BundleVersion); Assert.AreEqual("my connector", v2.ConnectorKey.ConnectorName); Assert.IsNotNull(v2.ConnectorFacadeKey); Assert.AreEqual(SafeType <APIOperation> .Get <CreateApiOp>(), v2.Operation); Assert.AreEqual("mymethodName", v2.OperationMethodName); Assert.IsTrue( CollectionUtil.Equals( args, v2.Arguments)); }
/// <summary> /// Method for convenient testing of local connectors. /// </summary> public APIConfiguration CreateTestConfiguration(SafeType <Connector> clazz, Configuration config) { LocalConnectorInfoImpl info = new LocalConnectorInfoImpl(); info.ConnectorConfigurationClass = SafeType <Configuration> .Get(config); info.ConnectorClass = (clazz); info.ConnectorDisplayNameKey = ("DUMMY_DISPLAY_NAME"); info.ConnectorKey = ( new ConnectorKey(clazz.RawType.Name + ".bundle", "1.0", clazz.RawType.Name)); info.Messages = (this.CreateDummyMessages()); APIConfigurationImpl rv = new APIConfigurationImpl(); rv.IsConnectorPoolingSupported = ( IsConnectorPoolingSupported(clazz)); ConfigurationPropertiesImpl properties = CSharpClassProperties.CreateConfigurationProperties(config); rv.ConfigurationProperties = (properties); rv.ConnectorInfo = (info); rv.SupportedOperations = ( FrameworkUtil.GetDefaultSupportedOperations(clazz)); info.DefaultAPIConfiguration = ( rv); return(rv); }
MergeIntoBean(ConfigurationPropertiesImpl properties, Configuration config) { SafeType <Configuration> configType = SafeType <Configuration> .Get(config); IDictionary <string, PropertyInfo> descriptors = GetFilteredProperties(configType); foreach (ConfigurationPropertyImpl property in properties.Properties) { String name = property.Name; PropertyInfo desc = CollectionUtil.GetValue(descriptors, name, null); if (desc == null) { String FMT = "Class ''{0}'' does not have a property ''{1}''."; String MSG = String.Format(FMT, configType.RawType.Name, name); throw new ArgumentException(MSG); } object val = property.Value; //some value types such as arrays //are mutable. make sure the config object //has its own copy val = SerializerUtil.CloneObject(val); desc.SetValue(config, val, null); } }
public void TestSchema() { OperationOptionInfo opInfo = new OperationOptionInfo("name", typeof(int?)); ObjectClassInfoBuilder bld = new ObjectClassInfoBuilder(); bld.ObjectType = ObjectClass.ACCOUNT_NAME; ObjectClassInfo info = bld.Build(); ICollection <ObjectClassInfo> temp = CollectionUtil.NewSet(info); IDictionary <SafeType <APIOperation>, ICollection <ObjectClassInfo> > map = new Dictionary <SafeType <APIOperation>, ICollection <ObjectClassInfo> >(); map[SafeType <APIOperation> .Get <CreateApiOp>()] = temp; ICollection <OperationOptionInfo> temp2 = CollectionUtil.NewSet(opInfo); IDictionary <SafeType <APIOperation>, ICollection <OperationOptionInfo> > map2 = new Dictionary <SafeType <APIOperation>, ICollection <OperationOptionInfo> >(); map2[SafeType <APIOperation> .Get <CreateApiOp>()] = temp2; Schema v1 = new Schema(CollectionUtil.NewSet(info), CollectionUtil.NewSet(opInfo), map, map2); Schema v2 = (Schema)CloneObject(v1); Assert.AreEqual(v1, v2); Assert.AreEqual(info, v2.ObjectClassInfo.First()); Assert.AreEqual(1, v2.SupportedObjectClassesByOperation.Count); Assert.AreEqual(1, v2.SupportedOptionsByOperation.Count); Assert.AreEqual(1, v2.OperationOptionInfo.Count); }
public void Sync(ObjectClass objClass, SyncToken token, SyncResultsHandler handler, OperationOptions options) { ((SyncApiOp)this.GetOperationCheckSupported(SafeType <APIOperation> .Get <SyncApiOp>())) .Sync(objClass, token, handler, options); }
static LocalConnectorFacadeImpl() { AddImplementation(SafeType <APIOperation> .Get <CreateApiOp>(), SafeType <APIOperation> .Get <CreateImpl>()); AddImplementation(SafeType <APIOperation> .Get <DeleteApiOp>(), SafeType <APIOperation> .Get <DeleteImpl>()); AddImplementation(SafeType <APIOperation> .Get <SchemaApiOp>(), SafeType <APIOperation> .Get <SchemaImpl>()); AddImplementation(SafeType <APIOperation> .Get <SearchApiOp>(), SafeType <APIOperation> .Get <SearchImpl>()); AddImplementation(SafeType <APIOperation> .Get <UpdateApiOp>(), SafeType <APIOperation> .Get <UpdateImpl>()); AddImplementation(SafeType <APIOperation> .Get <AuthenticationApiOp>(), SafeType <APIOperation> .Get <AuthenticationImpl>()); AddImplementation(SafeType <APIOperation> .Get <ResolveUsernameApiOp>(), SafeType <APIOperation> .Get <ResolveUsernameImpl>()); AddImplementation(SafeType <APIOperation> .Get <TestApiOp>(), SafeType <APIOperation> .Get <TestImpl>()); AddImplementation(SafeType <APIOperation> .Get <ScriptOnConnectorApiOp>(), SafeType <APIOperation> .Get <ScriptOnConnectorImpl>()); AddImplementation(SafeType <APIOperation> .Get <ScriptOnResourceApiOp>(), SafeType <APIOperation> .Get <ScriptOnResourceImpl>()); AddImplementation(SafeType <APIOperation> .Get <SyncApiOp>(), SafeType <APIOperation> .Get <SyncImpl>()); }
public Object RunScriptOnResource(ScriptContext request, OperationOptions options) { return(((ScriptOnResourceApiOp)this .GetOperationCheckSupported(SafeType <APIOperation> .Get <ScriptOnResourceApiOp>())) .RunScriptOnResource(request, options)); }
public Uid RemoveAttributeValues( ObjectClass objclass, Uid uid, ICollection <ConnectorAttribute> attrs, OperationOptions options) { return(((UpdateApiOp)this.GetOperationCheckSupported(SafeType <APIOperation> .Get <UpdateApiOp>())) .RemoveAttributeValues(objclass, uid, attrs, options)); }
public Schema Schema() { SchemaBuilder schemaBuilder = new SchemaBuilder(SafeType <Connector> .Get(this)); ICollection <ConnectorAttributeInfo> connectorAttributeInfos = new List <ConnectorAttributeInfo>(); connectorAttributeInfos.Add(ConnectorAttributeInfoBuilder.Build("User Logon Name")); schemaBuilder.DefineObjectClass(ObjectClass.ACCOUNT_NAME, connectorAttributeInfos); return(schemaBuilder.Build()); }
public static ICollection <SafeType <APIOperation> > GetUnconditionallySupportedOperations() { HashSet <SafeType <APIOperation> > ret; ret = new HashSet <SafeType <APIOperation> >(); //add validate api op always ret.Add(SafeType <APIOperation> .Get <ValidateApiOp>()); //add ScriptOnConnectorApiOp always ret.Add(SafeType <APIOperation> .Get <ScriptOnConnectorApiOp>()); return(ret); }
protected Schema ExecuteSchema(String scriptName) { var scb = new SchemaBuilder(SafeType <Connector> .Get(this)); var arguments = new Dictionary <String, Object> { { SchemaBldr, scb } }; ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.SCHEMA, null, null, null, null)); return(scb.Build()); }
public static ICollection <SafeType <APIOperation> > AllAPIOperations() { ICollection <SafeType <APIOperation> > set = new HashSet <SafeType <APIOperation> >(); CollectionUtil.AddAll(set, SPI_TO_API.Values); // add Get because it doesn't have a corresponding SPI. set.Add(SafeType <APIOperation> .Get <GetApiOp>()); set.Add(SafeType <APIOperation> .Get <ValidateApiOp>()); return(CollectionUtil.AsReadOnlySet(set)); }
public void TestAPIConfiguration() { ConnectorInfoManager manager = GetConnectorInfoManager(); ConnectorInfo info = FindConnectorInfo(manager, "1.0.0.0", "org.identityconnectors.testconnector.TstConnector"); Assert.IsNotNull(info); APIConfiguration api = info.CreateDefaultAPIConfiguration(); ConfigurationProperties props = api.ConfigurationProperties; ConfigurationProperty property = props.GetProperty("tstField"); Assert.IsNotNull(property); ICollection <SafeType <APIOperation> > operations = property.Operations; Assert.AreEqual(1, operations.Count); Assert.IsTrue(operations.Contains(SafeType <APIOperation> .Get <SyncApiOp>())); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en"); Assert.AreEqual("Help for test field.", property.GetHelpMessage(null)); Assert.AreEqual("Display for test field.", property.GetDisplayName(null)); Assert.AreEqual("Group for test field.", property.GetGroup(null)); Assert.AreEqual("Test Framework Value", info.Messages.Format("TEST_FRAMEWORK_KEY", "empty")); CultureInfo eslocale = new CultureInfo("es"); Thread.CurrentThread.CurrentUICulture = eslocale; Assert.AreEqual("tstField.help_es", property.GetHelpMessage(null)); Assert.AreEqual("tstField.display_es", property.GetDisplayName(null)); CultureInfo esESlocale = new CultureInfo("es-ES"); Thread.CurrentThread.CurrentUICulture = esESlocale; Assert.AreEqual("tstField.help_es-ES", property.GetHelpMessage(null)); Assert.AreEqual("tstField.display_es-ES", property.GetDisplayName(null)); CultureInfo esARlocale = new CultureInfo("es-AR"); Thread.CurrentThread.CurrentUICulture = esARlocale; Assert.AreEqual("tstField.help_es", property.GetHelpMessage(null)); Assert.AreEqual("tstField.display_es", property.GetDisplayName(null)); ConnectorFacadeFactory facf = ConnectorFacadeFactory.GetInstance(); ConnectorFacade facade = facf.NewInstance(api); // call the various create/update/delete commands.. facade.Schema(); }
public void TestSafeType() { //compile-time type safe SafeType <APIOperation> op = SafeType <APIOperation> .Get <ScriptOnResourceApiOp>(); Assert.AreEqual(typeof(ScriptOnResourceApiOp), op.RawType); //runtime type safe. needed for marshalling code, etc op = SafeType <APIOperation> .ForRawType(typeof(SchemaApiOp)); Assert.AreEqual(typeof(SchemaApiOp), op.RawType); }
public void UnsupportedOperationTest() { Configuration config = new MockConfiguration(false); SafeType <Connector> clazz = SafeType <Connector> .Get <MockConnector>(); ConnectorFacadeFactory factory = ConnectorFacadeFactory.GetInstance(); APIConfiguration impl = TestHelpers.CreateTestConfiguration(clazz, config); ConnectorFacade facade; facade = factory.NewInstance(impl); facade.Authenticate(ObjectClass.ACCOUNT, "fadf", new GuardedString(), null); }
public virtual Schema Schema() { if (null == _schema) { var builder = new SchemaBuilder(SafeType <Connector> .Get(this)); // Account var accountInfoBuilder = new ObjectClassInfoBuilder(); accountInfoBuilder.AddAttributeInfo(Name.INFO); accountInfoBuilder.AddAttributeInfo(OperationalAttributeInfos.PASSWORD); accountInfoBuilder.AddAttributeInfo(PredefinedAttributeInfos.GROUPS); accountInfoBuilder.AddAttributeInfo(ConnectorAttributeInfoBuilder.Build("firstName")); accountInfoBuilder.AddAttributeInfo( ConnectorAttributeInfoBuilder.Define("lastName").SetRequired(true).Build()); builder.DefineObjectClass(accountInfoBuilder.Build()); // Group var groupInfoBuilder = new ObjectClassInfoBuilder(); groupInfoBuilder.ObjectType = ObjectClass.GROUP_NAME; groupInfoBuilder.AddAttributeInfo(Name.INFO); groupInfoBuilder.AddAttributeInfo(PredefinedAttributeInfos.DESCRIPTION); groupInfoBuilder.AddAttributeInfo( ConnectorAttributeInfoBuilder.Define("members") .SetCreatable(false) .SetUpdateable(false) .SetMultiValued(true) .Build()); // Only the CRUD operations builder.DefineObjectClass(groupInfoBuilder.Build(), SafeType <SPIOperation> .Get <CreateOp>(), SafeType <SPIOperation> .ForRawType(typeof(SearchOp <>)), SafeType <SPIOperation> .Get <UpdateOp>(), SafeType <SPIOperation> .Get <DeleteOp>()); // Operation Options builder.DefineOperationOption(OperationOptionInfoBuilder.BuildAttributesToGet(), SafeType <SPIOperation> .ForRawType(typeof(SearchOp <>))); // Support paged Search builder.DefineOperationOption(OperationOptionInfoBuilder.BuildPageSize(), SafeType <SPIOperation> .ForRawType(typeof(SearchOp <>))); builder.DefineOperationOption(OperationOptionInfoBuilder.BuildPagedResultsCookie(), SafeType <SPIOperation> .ForRawType(typeof(SearchOp <>))); // Support to execute operation with provided credentials builder.DefineOperationOption(OperationOptionInfoBuilder.BuildRunAsUser()); builder.DefineOperationOption(OperationOptionInfoBuilder.BuildRunWithPassword()); _schema = builder.Build(); } return(_schema); }
public static ICollection <SafeType <APIOperation> > Spi2Apis(SafeType <SPIOperation> type) { type = type.GetTypeErasure(); HashSet <SafeType <APIOperation> > set = new HashSet <SafeType <APIOperation> >(); set.Add(SPI_TO_API[type]); // add GetApiOp if search is available.. if (type.RawType.Equals(typeof(SearchOp <>))) { set.Add(SafeType <APIOperation> .Get <GetApiOp>()); } return(set); }
// ======================================================================= // ConnectorFacade Interface // ======================================================================= protected override APIOperation GetOperationImplementation(SafeType <APIOperation> api) { APIOperation proxy; //first create the inner proxy - this is the proxy that obtaining //a connection from the pool, etc //NOTE: we want to skip this part of the proxy for //validate op, but we will want the timeout proxy if (api.RawType.Equals(typeof(ValidateApiOp))) { OperationalContext context = new OperationalContext(connectorInfo, GetAPIConfiguration()); proxy = new ValidateImpl(context); } else if (api.RawType.Equals(typeof(GetApiOp))) { ConstructorInfo constructor = API_TO_IMPL[SafeType <APIOperation> .Get <SearchApiOp>()]; ConnectorOperationalContext context = new ConnectorOperationalContext(connectorInfo, GetAPIConfiguration(), GetPool()); ConnectorAPIOperationRunnerProxy handler = new ConnectorAPIOperationRunnerProxy(context, constructor); proxy = new GetImpl((SearchApiOp)NewAPIOperationProxy(SafeType <APIOperation> .Get <SearchApiOp>(), handler)); } else { ConstructorInfo constructor = API_TO_IMPL[api]; ConnectorOperationalContext context = new ConnectorOperationalContext(connectorInfo, GetAPIConfiguration(), GetPool()); ConnectorAPIOperationRunnerProxy handler = new ConnectorAPIOperationRunnerProxy(context, constructor); proxy = NewAPIOperationProxy(api, handler); } //TODO: timeout // add logging proxy.. proxy = CreateLoggingProxy(api, proxy); return(proxy); }
public Schema Schema() { SchemaBuilder builder = new SchemaBuilder(SafeType <Connector> .Get <TstConnector>()); for (int i = 0; i < 2; i++) { ObjectClassInfoBuilder classBuilder = new ObjectClassInfoBuilder(); classBuilder.ObjectType = ("class" + i); for (int j = 0; j < 200; j++) { classBuilder.AddAttributeInfo(ConnectorAttributeInfoBuilder.Build("attributename" + j, typeof(String))); } builder.DefineObjectClass(classBuilder.Build()); } return(builder.Build()); }
public void TestAPIConfiguration() { ConfigurationPropertyImpl prop1 = new ConfigurationPropertyImpl(); prop1.Order = (1); prop1.IsConfidential = (true); prop1.Name = ("foo"); prop1.HelpMessageKey = ("help key"); prop1.DisplayMessageKey = ("display key"); prop1.GroupMessageKey = ("group key"); prop1.Value = ("bar"); prop1.ValueType = (typeof(string)); prop1.Operations = null; ConfigurationPropertiesImpl props1 = new ConfigurationPropertiesImpl(); props1.Properties = (CollectionUtil.NewReadOnlyList <ConfigurationPropertyImpl>(prop1)); APIConfigurationImpl v1 = new APIConfigurationImpl(); v1.ConnectorPoolConfiguration = (new ObjectPoolConfiguration()); v1.ConfigurationProperties = (props1); v1.IsConnectorPoolingSupported = (true); v1.ProducerBufferSize = (200); v1.SupportedOperations = (FrameworkUtil.AllAPIOperations()); IDictionary <SafeType <APIOperation>, int> map = CollectionUtil.NewDictionary <SafeType <APIOperation>, int>(SafeType <APIOperation> .Get <CreateApiOp>(), 6); v1.TimeoutMap = (map); APIConfigurationImpl v2 = (APIConfigurationImpl) CloneObject(v1); Assert.IsTrue(!Object.ReferenceEquals(v1, v2)); Assert.IsNotNull(v2.ConnectorPoolConfiguration); Assert.IsNotNull(v2.ConfigurationProperties); Assert.AreEqual(v1.ConnectorPoolConfiguration, v2.ConnectorPoolConfiguration); Assert.AreEqual(v1.ConfigurationProperties, v2.ConfigurationProperties); Assert.IsTrue(v2.IsConnectorPoolingSupported); Assert.AreEqual(200, v2.ProducerBufferSize); Assert.IsTrue(CollectionUtil.SetsEqual( FrameworkUtil.AllAPIOperations(), v2.SupportedOperations)); Assert.AreEqual(map, v2.TimeoutMap); }
public void TestStackTraceOfExceptionThrownByConnectorFacade() { ConnectorFacadeFactory factory = ConnectorFacadeFactory.GetInstance(); Configuration config = new MockConfiguration(); ConnectorFacade facade = factory.NewInstance( TestHelpers.CreateTestConfiguration(SafeType <Connector> .Get <SpyConnector>(), config)); try { facade.Test(); Assert.Fail("Exception was not thrown"); } catch (EUTestException eutex) { ExceptionUtilTestHelpers.AssertStackTrace(eutex, SpyConnector.StackTrace); } }
public static Schema BuildSchema(Connector connector, GetSupportedObjectClassesDelegate getSupportedObjectClassesDelegate, GetObjectClassInfoDelegate getObjectClassInfoDelegate, GetSupportedOperationsDelegate getSupportedOperationsDelegate, GetUnSupportedOperationsDelegate getUnSupportedOperationsDelegate) { SchemaBuilder schemaBuilder = new SchemaBuilder(SafeType <Connector> .Get(connector)); //iterate through supported object classes foreach (ObjectClass oc in getSupportedObjectClassesDelegate()) { ObjectClassInfo ocInfo = getObjectClassInfoDelegate(oc); Assertions.NullCheck(ocInfo, "ocInfo"); //add object class to schema schemaBuilder.DefineObjectClass(ocInfo); //add supported operations IList <SafeType <SPIOperation> > supportedOps = getSupportedOperationsDelegate(oc); if (supportedOps != null) { foreach (SafeType <SPIOperation> op in supportedOps) { schemaBuilder.AddSupportedObjectClass(op, ocInfo); } } //remove unsupported operatons IList <SafeType <SPIOperation> > unSupportedOps = getUnSupportedOperationsDelegate(oc); if (unSupportedOps != null) { foreach (SafeType <SPIOperation> op in unSupportedOps) { schemaBuilder.RemoveSupportedObjectClass(op, ocInfo); } } } LOG.Debug("Finished retrieving schema"); return(schemaBuilder.Build()); }
/// <summary> /// Test the pattern of the common operations. /// </summary> private void TestCallPattern(TestOperationPattern pattern) { TestCallPattern(pattern, SafeType <Connector> .Get <MockAllOpsConnector>()); }
public ConnectorObject GetObject(ObjectClass objClass, Uid uid, OperationOptions options) { return(((GetApiOp)this.GetOperationCheckSupported(SafeType <APIOperation> .Get <GetApiOp>())) .GetObject(objClass, uid, options)); }
public void UpdateMergeTests() { ConnectorAttribute expected, actual; Configuration config = new MockConfiguration(false); ConnectorFacadeFactory factory = ConnectorFacadeFactory.GetInstance(); SafeType <Connector> clazz = SafeType <Connector> .Get <MockUpdateConnector>(); // **test only** APIConfiguration impl = TestHelpers.CreateTestConfiguration(clazz, config); impl.SetTimeout(SafeType <APIOperation> .Get <GetApiOp>(), APIConstants.NO_TIMEOUT); impl.SetTimeout(SafeType <APIOperation> .Get <UpdateApiOp>(), APIConstants.NO_TIMEOUT); impl.SetTimeout(SafeType <APIOperation> .Get <SearchApiOp>(), APIConstants.NO_TIMEOUT); ConnectorFacade facade = factory.NewInstance(impl); // sniff test to make sure we can get an object.. ConnectorObject obj = facade.GetObject(ObjectClass.ACCOUNT, NewUid(1), null); Assert.AreEqual(NewUid(1), obj.Uid); // ok lets add an attribute that doesn't exist.. String ADDED = "somthing to add to the object"; String ATTR_NAME = "added"; ICollection <ConnectorAttribute> addAttrSet; addAttrSet = CollectionUtil.NewSet((IEnumerable <ConnectorAttribute>)obj.GetAttributes()); addAttrSet.Add(ConnectorAttributeBuilder.Build(ATTR_NAME, ADDED)); Name name = obj.Name; addAttrSet.Remove(name); Uid uid = facade.AddAttributeValues(ObjectClass.ACCOUNT, obj.Uid, ConnectorAttributeUtil.FilterUid(addAttrSet), null); // get back the object and see if there are the same.. addAttrSet.Add(name); ConnectorObject addO = new ConnectorObject(ObjectClass.ACCOUNT, addAttrSet); obj = facade.GetObject(ObjectClass.ACCOUNT, NewUid(1), null); Assert.AreEqual(addO, obj); // attempt to add on to an existing attribute.. addAttrSet.Remove(name); uid = facade.AddAttributeValues(ObjectClass.ACCOUNT, obj.Uid, ConnectorAttributeUtil.FilterUid(addAttrSet), null); // get the object back out and check on it.. obj = facade.GetObject(ObjectClass.ACCOUNT, uid, null); expected = ConnectorAttributeBuilder.Build(ATTR_NAME, ADDED, ADDED); actual = obj.GetAttributeByName(ATTR_NAME); Assert.AreEqual(expected, actual); // attempt to delete a value from an attribute.. ICollection <ConnectorAttribute> deleteAttrs = CollectionUtil.NewSet((IEnumerable <ConnectorAttribute>)addO.GetAttributes()); deleteAttrs.Remove(name); uid = facade.RemoveAttributeValues(ObjectClass.ACCOUNT, addO.Uid, ConnectorAttributeUtil.FilterUid(deleteAttrs), null); obj = facade.GetObject(ObjectClass.ACCOUNT, uid, null); expected = ConnectorAttributeBuilder.Build(ATTR_NAME, ADDED); actual = obj.GetAttributeByName(ATTR_NAME); Assert.AreEqual(expected, actual); // attempt to delete an attribute that doesn't exist.. ICollection <ConnectorAttribute> nonExist = new HashSet <ConnectorAttribute>(); nonExist.Add(NewUid(1)); nonExist.Add(ConnectorAttributeBuilder.Build("does not exist", "asdfe")); uid = facade.RemoveAttributeValues(ObjectClass.ACCOUNT, addO.Uid, ConnectorAttributeUtil.FilterUid(nonExist), null); obj = facade.GetObject(ObjectClass.ACCOUNT, NewUid(1), null); Assert.IsTrue(obj.GetAttributeByName("does not exist") == null); }
public void Test() { ((TestApiOp)this.GetOperationCheckSupported(SafeType <APIOperation> .Get <TestApiOp>())).Test(); }
public void Validate() { ((ValidateApiOp)this.GetOperationCheckSupported(SafeType <APIOperation> .Get <ValidateApiOp>())).Validate(); }
public SyncToken GetLatestSyncToken(ObjectClass objectClass) { return(((SyncApiOp)this.GetOperationCheckSupported(SafeType <APIOperation> .Get <SyncApiOp>())) .GetLatestSyncToken(objectClass)); }
static FrameworkUtil() { IDictionary <SafeType <SPIOperation>, SafeType <APIOperation> > temp = new Dictionary <SafeType <SPIOperation>, SafeType <APIOperation> >(); temp[SafeType <SPIOperation> .Get <AuthenticateOp>()] = SafeType <APIOperation> .Get <AuthenticationApiOp>(); temp[SafeType <SPIOperation> .Get <ResolveUsernameOp>()] = SafeType <APIOperation> .Get <ResolveUsernameApiOp>(); temp[SafeType <SPIOperation> .Get <CreateOp>()] = SafeType <APIOperation> .Get <CreateApiOp>(); temp[SafeType <SPIOperation> .Get <DeleteOp>()] = SafeType <APIOperation> .Get <DeleteApiOp>(); temp[SafeType <SPIOperation> .ForRawType(typeof(SearchOp <>))] = SafeType <APIOperation> .Get <SearchApiOp>(); temp[SafeType <SPIOperation> .Get <UpdateOp>()] = SafeType <APIOperation> .Get <UpdateApiOp>(); temp[SafeType <SPIOperation> .Get <UpdateAttributeValuesOp>()] = SafeType <APIOperation> .Get <UpdateApiOp>(); temp[SafeType <SPIOperation> .Get <SchemaOp>()] = SafeType <APIOperation> .Get <SchemaApiOp>(); temp[SafeType <SPIOperation> .Get <TestOp>()] = SafeType <APIOperation> .Get <TestApiOp>(); temp[SafeType <SPIOperation> .Get <ScriptOnConnectorOp>()] = SafeType <APIOperation> .Get <ScriptOnConnectorApiOp>(); temp[SafeType <SPIOperation> .Get <ScriptOnResourceOp>()] = SafeType <APIOperation> .Get <ScriptOnResourceApiOp>(); temp[SafeType <SPIOperation> .Get <SyncOp>()] = SafeType <APIOperation> .Get <SyncApiOp>(); SPI_TO_API = CollectionUtil.NewReadOnlyDictionary(temp); CONFIG_SUPPORTED_TYPES = CollectionUtil.NewReadOnlySet <Type> ( typeof(string), typeof(long), typeof(long?), typeof(char), typeof(char?), typeof(double), typeof(double?), typeof(float), typeof(float?), typeof(int), typeof(int?), typeof(bool), typeof(bool?), typeof(Uri), typeof(FileName), typeof(GuardedByteArray), typeof(GuardedString), typeof(Script) ); ATTR_SUPPORTED_TYPES = CollectionUtil.NewReadOnlySet <Type> ( typeof(string), typeof(long), typeof(long?), typeof(char), typeof(char?), typeof(double), typeof(double?), typeof(float), typeof(float?), typeof(int), typeof(int?), typeof(bool), typeof(bool?), typeof(byte), typeof(byte?), typeof(byte[]), typeof(BigDecimal), typeof(BigInteger), typeof(GuardedByteArray), typeof(GuardedString), typeof(IDictionary <object, object>) ); }
CreateConfigurationProperties(Configuration defaultObject) { SafeType <Configuration> config = SafeType <Configuration> .Get(defaultObject); ConfigurationPropertiesImpl properties = new ConfigurationPropertiesImpl(); IList <ConfigurationPropertyImpl> temp = new List <ConfigurationPropertyImpl>(); IDictionary <string, PropertyInfo> descs = GetFilteredProperties(config); foreach (PropertyInfo desc in descs.Values) { String name = desc.Name; // get the configuration options.. ConfigurationPropertyAttribute options = GetPropertyOptions(desc); // use the options to set internal properties.. int order = 0; String helpKey = name + ".help"; String displKey = name + ".display"; bool confidential = false; bool required = false; if (options != null) { // determine the display and help keys.. if (!StringUtil.IsBlank(options.HelpMessageKey)) { helpKey = options.HelpMessageKey; } if (!StringUtil.IsBlank(options.DisplayMessageKey)) { displKey = options.DisplayMessageKey; } // determine the order.. order = options.Order; required = options.Required; confidential = options.Confidential; } Type type = desc.PropertyType; if (!FrameworkUtil.IsSupportedConfigurationType(type)) { const String MSG = "Property type ''{0}'' is not supported."; throw new ArgumentException(String.Format(MSG, type)); } Object value = desc.GetValue(defaultObject, null); ConfigurationPropertyImpl prop = new ConfigurationPropertyImpl(); prop.IsConfidential = confidential; prop.IsRequired = required; prop.DisplayMessageKey = displKey; prop.HelpMessageKey = helpKey; prop.Name = name; prop.Order = order; prop.Value = value; prop.ValueType = type; prop.Operations = options == null ? null : TranslateOperations(options.Operations); temp.Add(prop); } properties.Properties = (temp); return(properties); }