Skip to content

Commit

Permalink
Fixed test for ocpsoft#182 ocpsoft#183
Browse files Browse the repository at this point in the history
  • Loading branch information
chkal committed Sep 4, 2014
1 parent 172592a commit 1a5f14c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@
package org.ocpsoft.rewrite.faces.outbound;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

import org.hamcrest.Matchers;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.ocpsoft.rewrite.category.IgnoreForGlassfish4;
import org.ocpsoft.rewrite.config.ConfigurationProvider;
import org.ocpsoft.rewrite.faces.annotation.RewriteFacesAnnotationsTest;
import org.ocpsoft.rewrite.test.RewriteTest;
import org.ocpsoft.rewrite.test.RewriteTestBase;

import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.ocpsoft.rewrite.config.ConfigurationProvider;

/**
* This test doesn't work on Glassfish 4.0 at all. For some reason Glassfish _always_ appends the JSESSIONID, even if
Expand Down Expand Up @@ -67,7 +69,7 @@ public void testResourceUrlRewritten() throws Exception
HtmlPage page = getWebClient("/outbound").getPage();
DomNodeList<DomElement> stylesheets = page.getElementsByTagName("link");
assertEquals(1, stylesheets.size());
assertEquals("/css/style.css", stylesheets.get(0).getAttribute("href"));
assertThat(stylesheets.get(0).getAttribute("href"), Matchers.endsWith("/css/style.css?ln=test"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Configuration getConfiguration(final ServletContext context)
{
return ConfigurationBuilder.begin()
.addRule(Join.path("/outbound").to("/faces/outbound.xhtml"))
.addRule(Join.path("/css/{file}").to("/faces/javax.faces.resource/css/{file}?ln=test"))
.addRule(Join.path("/css/{file}").to("/faces/javax.faces.resource/css/{file}"))
.addRule()
.when(Direction.isInbound().and(DispatchType.isRequest()))
.perform(SendStatus.error(403));
Expand Down

0 comments on commit 1a5f14c

Please sign in to comment.