Skip to content

Commit

Permalink
Update schema, xml parsing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Blues committed Jan 26, 2014
1 parent 52267fb commit 23624c4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (void)setUp
NSString* xmlString = [[TyphoonBundleResource withName:@"MiddleAgesAssembly.xml"] asString];
_element = [TyphoonRXMLElement elementFromXMLString:xmlString encoding:NSUTF8StringEncoding];

NSString* lasyXmlString = [[TyphoonBundleResource withName:@"LazyInitCasesAssembly.xml"] asString];
NSString* lasyXmlString = [[TyphoonBundleResource withName:@"XmlParsingCasesAssembly.xml"] asString];
self.lazyElementTest = [TyphoonRXMLElement elementFromXMLString:lasyXmlString encoding:NSUTF8StringEncoding];
}

Expand Down Expand Up @@ -135,6 +135,12 @@ - (void)test_asComponentDefinition_lazyInit_singleton_without_lazy
}

- (void)test_asComponentDefinition_lazyInit_singleton_with_lazy_YES
{
TyphoonDefinition* def = [self definitionInElement:[self lazyElementTest] forKey:@"defaultScope1"];
assertThatUnsignedInteger([def scope], equalToUnsignedInteger(TyphoonScopeObjectGraph));
}

- (void)test_asComponentDefinition_default_scope
{
TyphoonDefinition* def = [self definitionInElement:[self lazyElementTest] forKey:@"lazySingleton2"];
assertThatBool([def isLazy], is(@YES));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

<description>
Enumerate all cases for the lazy-init attribute.
Please, use this convension:
Please, use this convention:
- if the component is default, set a key that contains 'default'
- if the component is a prototype, set a key that contains 'prototype';
- if the component is a singleton, set a key that contains 'singleton';
- if the component is a lasy singleton, set a key that contains 'lazySingleton';
- if the component is a lazy singleton, set a key that contains 'lazySingleton';
</description>

<component class="Knight" key="prototype1" lazy-init="true">
Expand Down Expand Up @@ -54,5 +55,11 @@
Singleton and lasy. Should be interpreted as a lasy singleton.
</description>
</component>

<component class="Knight" key="defaultScope1" lazy-init="NO" scope="default">
<description>
Singleton and lasy. Should be interpreted as a lasy singleton.
</description>
</component>

</assembly>
16 changes: 8 additions & 8 deletions Tests/Tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
4B841520179B0EA600916BF5 /* CircularDependenciesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414D9179B0EA600916BF5 /* CircularDependenciesAssembly.xml */; };
4B841521179B0EA600916BF5 /* ExceptionTestAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DA179B0EA600916BF5 /* ExceptionTestAssembly.xml */; };
4B841522179B0EA600916BF5 /* ExceptionTestAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DA179B0EA600916BF5 /* ExceptionTestAssembly.xml */; };
4B841523179B0EA600916BF5 /* LazyInitCasesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DB179B0EA600916BF5 /* LazyInitCasesAssembly.xml */; };
4B841524179B0EA600916BF5 /* LazyInitCasesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DB179B0EA600916BF5 /* LazyInitCasesAssembly.xml */; };
4B841523179B0EA600916BF5 /* XmlParsingCasesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DB179B0EA600916BF5 /* XmlParsingCasesAssembly.xml */; };
4B841524179B0EA600916BF5 /* XmlParsingCasesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DB179B0EA600916BF5 /* XmlParsingCasesAssembly.xml */; };
4B841525179B0EA600916BF5 /* MiddleAgesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DC179B0EA600916BF5 /* MiddleAgesAssembly.xml */; };
4B841526179B0EA600916BF5 /* MiddleAgesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DC179B0EA600916BF5 /* MiddleAgesAssembly.xml */; };
4B841527179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DD179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml */; };
Expand Down Expand Up @@ -135,7 +135,7 @@
4BC648E717A20AD2007F0463 /* AssemblyWithInvalidClassName.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414D8179B0EA600916BF5 /* AssemblyWithInvalidClassName.xml */; };
4BC648E817A20AD2007F0463 /* CircularDependenciesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414D9179B0EA600916BF5 /* CircularDependenciesAssembly.xml */; };
4BC648E917A20AD2007F0463 /* ExceptionTestAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DA179B0EA600916BF5 /* ExceptionTestAssembly.xml */; };
4BC648EA17A20AD2007F0463 /* LazyInitCasesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DB179B0EA600916BF5 /* LazyInitCasesAssembly.xml */; };
4BC648EA17A20AD2007F0463 /* XmlParsingCasesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DB179B0EA600916BF5 /* XmlParsingCasesAssembly.xml */; };
4BC648EB17A20AD2007F0463 /* MiddleAgesAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DC179B0EA600916BF5 /* MiddleAgesAssembly.xml */; };
4BC648EC17A20AD2007F0463 /* PropertyPlaceholderAssembly.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DD179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml */; };
4BC648ED17A20AD2007F0463 /* SomeProperties.properties in Resources */ = {isa = PBXBuildFile; fileRef = 4B8414DE179B0EA600916BF5 /* SomeProperties.properties */; };
Expand Down Expand Up @@ -432,7 +432,7 @@
4B8414D8179B0EA600916BF5 /* AssemblyWithInvalidClassName.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = AssemblyWithInvalidClassName.xml; sourceTree = "<group>"; };
4B8414D9179B0EA600916BF5 /* CircularDependenciesAssembly.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CircularDependenciesAssembly.xml; sourceTree = "<group>"; };
4B8414DA179B0EA600916BF5 /* ExceptionTestAssembly.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ExceptionTestAssembly.xml; sourceTree = "<group>"; };
4B8414DB179B0EA600916BF5 /* LazyInitCasesAssembly.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = LazyInitCasesAssembly.xml; sourceTree = "<group>"; };
4B8414DB179B0EA600916BF5 /* XmlParsingCasesAssembly.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = XmlParsingCasesAssembly.xml; sourceTree = "<group>"; };
4B8414DC179B0EA600916BF5 /* MiddleAgesAssembly.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = MiddleAgesAssembly.xml; sourceTree = "<group>"; };
4B8414DD179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PropertyPlaceholderAssembly.xml; sourceTree = "<group>"; };
4B8414DE179B0EA600916BF5 /* SomeProperties.properties */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SomeProperties.properties; sourceTree = "<group>"; };
Expand Down Expand Up @@ -843,7 +843,7 @@
4B8414D9179B0EA600916BF5 /* CircularDependenciesAssembly.xml */,
4EB2191317B4F6EB00B901C9 /* SingletonsChainAssembly.xml */,
4B8414DA179B0EA600916BF5 /* ExceptionTestAssembly.xml */,
4B8414DB179B0EA600916BF5 /* LazyInitCasesAssembly.xml */,
4B8414DB179B0EA600916BF5 /* XmlParsingCasesAssembly.xml */,
4B8414DC179B0EA600916BF5 /* MiddleAgesAssembly.xml */,
4B8414DD179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml */,
4656F7AE17DB6D5100EDDC23 /* InfratructureComponentsAssembly.xml */,
Expand Down Expand Up @@ -1171,7 +1171,7 @@
4B84151D179B0EA600916BF5 /* AssemblyWithInvalidClassName.xml in Resources */,
4B84151F179B0EA600916BF5 /* CircularDependenciesAssembly.xml in Resources */,
4B841521179B0EA600916BF5 /* ExceptionTestAssembly.xml in Resources */,
4B841523179B0EA600916BF5 /* LazyInitCasesAssembly.xml in Resources */,
4B841523179B0EA600916BF5 /* XmlParsingCasesAssembly.xml in Resources */,
4B841525179B0EA600916BF5 /* MiddleAgesAssembly.xml in Resources */,
4B841527179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml in Resources */,
4B841529179B0EA600916BF5 /* SomeProperties.properties in Resources */,
Expand All @@ -1189,7 +1189,7 @@
4B84151E179B0EA600916BF5 /* AssemblyWithInvalidClassName.xml in Resources */,
4B841520179B0EA600916BF5 /* CircularDependenciesAssembly.xml in Resources */,
4B841522179B0EA600916BF5 /* ExceptionTestAssembly.xml in Resources */,
4B841524179B0EA600916BF5 /* LazyInitCasesAssembly.xml in Resources */,
4B841524179B0EA600916BF5 /* XmlParsingCasesAssembly.xml in Resources */,
4B841526179B0EA600916BF5 /* MiddleAgesAssembly.xml in Resources */,
4B841528179B0EA600916BF5 /* PropertyPlaceholderAssembly.xml in Resources */,
4B84152A179B0EA600916BF5 /* SomeProperties.properties in Resources */,
Expand All @@ -1207,7 +1207,7 @@
4BC648E717A20AD2007F0463 /* AssemblyWithInvalidClassName.xml in Resources */,
4BC648E817A20AD2007F0463 /* CircularDependenciesAssembly.xml in Resources */,
4BC648E917A20AD2007F0463 /* ExceptionTestAssembly.xml in Resources */,
4BC648EA17A20AD2007F0463 /* LazyInitCasesAssembly.xml in Resources */,
4BC648EA17A20AD2007F0463 /* XmlParsingCasesAssembly.xml in Resources */,
4BC648EB17A20AD2007F0463 /* MiddleAgesAssembly.xml in Resources */,
4BC648EC17A20AD2007F0463 /* PropertyPlaceholderAssembly.xml in Resources */,
4BC648ED17A20AD2007F0463 /* SomeProperties.properties in Resources */,
Expand Down
20 changes: 18 additions & 2 deletions schema/assembly.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="description" minOccurs="0"/>
<xsd:element ref="property-placeholder" maxOccurs="1"/>
<xsd:element ref="property-placeholder" minOccurs="0" maxOccurs="1"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="component"/>
<xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
Expand Down Expand Up @@ -103,6 +103,22 @@
</xsd:simpleType>
</xsd:attribute>

<xsd:attribute name="lazy-init">
<xsd:annotation>
<xsd:documentation><![CDATA[
]]></xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="true"/>
<xsd:enumeration value="false"/>
<xsd:enumeration value="YES"/>
<xsd:enumeration value="NO"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>

<xsd:attribute name="parent" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -326,7 +342,7 @@
]]></xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="location" type="xsd:string" use="optional">
<xsd:attribute name="location" type="xsd:string" use="required">
<xsd:annotation>
<xsd:documentation><![CDATA[
The location of the properties file. Several files can be provided by separating the names with commas.
Expand Down

0 comments on commit 23624c4

Please sign in to comment.