[jira] [Updated] (SLING-6994) [Mocks] Sling JCR Mocks do not resolve vanity resources properly
[ https://issues.apache.org/jira/browse/SLING-6994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrei Dulvac updated SLING-6994: - Component/s: (was: Apache Sling Testing Rules) > [Mocks] Sling JCR Mocks do not resolve vanity resources properly > > > Key: SLING-6994 > URL: https://issues.apache.org/jira/browse/SLING-6994 > Project: Sling > Issue Type: Improvement >Reporter: David Gonzalez >Priority: Major > > I would like to use Sling Mocks to test code that relies on > sling:vanityPaths. Sling Mocks resolve vanity pathed resources to > sling:nonexisting rather than sling:redirect (which is the actual behavior) > which isn't allowing me to write tests for my code unless i change my code to > match mock behavior and not be driven by actual behavior/contracts. > {noformat} > @Rule > public SlingContext context = new > SlingContextBuilder(ResourceResolverType.JCR_MOCK) >.resourceResolverFactoryActivatorProps(ImmutableMap.of( >"resource.resolver.mapping", new String[] {"/:/", > "/content/test/)) >.build(); > @Before > public void setUp() throws Exception { >request = new MockSlingHttpServletRequest(context.resourceResolver(), > context.bundleContext()); >response = new MockSlingHttpServletResponse(); >context.build().resource("/content") >.resource("test") >.resource("vanity", "sling:vanityPath", "/my-vanity"); > } > ... > @Test > public void dispatch_path1() throws Exception { > request.setServletPath("/content/test/my-vanity"); > ... calls code that preforms ... > > rr.resolve(rr.map("/content/test/my-vanity")).isResourceType("sling:redirect") > > // This should return true; however in mocks the resource type is > "sling:nonexisting" > } > } > {noformat} > /cc [~sseif...@pro-vision.de] -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (SLING-6994) [Mocks] Sling JCR Mocks do not resolve vanity resources properly
[ https://issues.apache.org/jira/browse/SLING-6994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Gonzalez updated SLING-6994: -- Description: I would like to use Sling Mocks to test code that relies on sling:vanityPaths. Sling Mocks resolve vanity pathed resources to sling:nonexisting rather than sling:redirect (which is the actual behavior) which isn't allowing me to write tests for my code unless i change my code to match mock behavior and not be driven by actual behavior/contracts. {noformat} @Rule public SlingContext context = new SlingContextBuilder(ResourceResolverType.JCR_MOCK) .resourceResolverFactoryActivatorProps(ImmutableMap.of( "resource.resolver.mapping", new String[] {"/:/", "/content/test/of( "resource.resolver.mapping", new String[] {"/:/", "/content/test/ [Mocks] Sling JCR Mocks do not resolve vanity resources properly > > > Key: SLING-6994 > URL: https://issues.apache.org/jira/browse/SLING-6994 > Project: Sling > Issue Type: Improvement > Components: Apache Sling Testing Rules >Reporter: David Gonzalez > > I would like to use Sling Mocks to test code that relies on > sling:vanityPaths. Sling Mocks resolve vanity pathed resources to > sling:nonexisting rather than sling:redirect (which is the actual behavior) > which isn't allowing me to write tests for my code unless i change my code to > match mock behavior and not be driven by actual behavior/contracts. > {noformat} > @Rule > public SlingContext context = new > SlingContextBuilder(ResourceResolverType.JCR_MOCK) >.resourceResolverFactoryActivatorProps(ImmutableMap. of( >"resource.resolver.mapping", new String[] {"/:/", > "/content/test/)) >.build(); > @Before > public void setUp() throws Exception { >request = new MockSlingHttpServletRequest(context.resourceResolver(), > context.bundleContext()); >response = new MockSlingHttpServletResponse(); >context.build().resource("/content") >.resource("test") >.resource("vanity", "sling:vanityPath", "/my-vanity"); > } > ... > @Test > public void dispatch_path1() throws Exception { > request.setServletPath("/content/test/my-vanity"); > ... calls code that preforms ... > > rr.resolve(rr.map("/content/test/my-vanity")).isResourceType("sling:redirect") > > // This should return true; however in mocks the resource type is > "sling:nonexisting" > } > } > {noformat} > /cc [~sseif...@pro-vision.de] -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (SLING-6994) [Mocks] Sling JCR Mocks do not resolve vanity resources properly
[ https://issues.apache.org/jira/browse/SLING-6994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Gonzalez updated SLING-6994: -- Description: I would like to use Sling Mocks to test code that relies on sling:vanityPaths. Sling Mocks resolve vanity pathed resources to sling:nonexisting rather than sling:redirect (which is the actual behavior) which isn't allowing me to write tests for my code unless i change my code to match mock behavior and not be driven by actual behavior/contracts. {noformat} @Rule public SlingContext context = new SlingContextBuilder(ResourceResolverType.JCR_MOCK) .resourceResolverFactoryActivatorProps(ImmutableMap.of( "resource.resolver.mapping", new String[] {"/:/", "/content/test/of( "resource.resolver.mapping", new String[] {"/:/", "/content/test/ [Mocks] Sling JCR Mocks do not resolve vanity resources properly > > > Key: SLING-6994 > URL: https://issues.apache.org/jira/browse/SLING-6994 > Project: Sling > Issue Type: Improvement > Components: Apache Sling Testing Rules >Reporter: David Gonzalez > > I would like to use Sling Mocks to test code that relies on > sling:vanityPaths. Sling Mocks resolve vanity pathed resources to > sling:nonexisting rather than sling:redirect (which is the actual behavior) > which isn't allowing me to write tests for my code unless i change my code to > match mock behavior and not be driven by actual behavior/contracts. > {noformat} > @Rule > public SlingContext context = new > SlingContextBuilder(ResourceResolverType.JCR_MOCK) > .resourceResolverFactoryActivatorProps(ImmutableMap. Object>of( > "resource.resolver.mapping", new String[] {"/:/", > "/content/test/ )) > .build(); > @Before > public void setUp() throws Exception { > request = new MockSlingHttpServletRequest(context.resourceResolver(), > context.bundleContext()); > response = new MockSlingHttpServletResponse(); > context.build().resource("/content") > .resource("test") > .resource("vanity", "sling:vanityPath", "/my-vanity"); > } > ... > @Test > public void dispatch_path1() throws Exception { > request.setServletPath("/content/test/my-vanity"); > ... calls code that preforms ... > > rr.resolve(rr.map("/content/test/my-vanity")).isResourceType("sling:redirect") > > // This should return true; however in mocks the resource type is > "sling:nonexisting" > } > } > {noformat} > /cc [~sseif...@pro-vision.de] -- This message was sent by Atlassian JIRA (v6.4.14#64029)