Skip to content

Commit

Permalink
Fix #3: @param is now Quarkified!
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Sep 17, 2024
1 parent 0e97370 commit 6859cfb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveCla
classNames.addAll(collectClassesInPackage(combinedIndex, "org.omnifaces.util"));

reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods(true).build());
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods(true).serialization(true).build());
}

@Record(ExecutionTime.STATIC_INIT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Date;
import java.util.List;

import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.RequestScoped;
import jakarta.faces.FacesException;
import jakarta.faces.convert.DateTimeConverter;
import jakarta.faces.validator.LengthValidator;
import jakarta.inject.Inject;
import jakarta.inject.Named;
Expand Down Expand Up @@ -47,12 +45,6 @@ public class CdiParamBean {
@Param
Integer number;

// Like <f:viewParam name="date" value="#{bean.date}" converterMessage="..."><f:convertDateTime pattern="yyyyMMdd">
@Inject
@Param(converterClass = DateTimeConverter.class, converterAttributes = {
@Attribute(name = "pattern", value = "yyyyMMdd") }, converterMessage = "{1}: \"{0}\" is not the date format we had in mind! Please use the format yyyyMMdd.")
Date date;

private String result;

@PostConstruct
Expand All @@ -62,8 +54,8 @@ public void init() {
return;
}

result = String.format("You entered text1 '%s', text2 '%s', text3 '%s', number '%d', date '%5$tY%5$tm%5$td'", text1,
text2, text3, number, date);
result = String.format("You entered text1 '%s', text2 '%s', text3 '%s', number '%d'", text1,
text2, text3, number);

Messages.addGlobalInfo("Yes, no validation errors!");
}
Expand Down Expand Up @@ -92,4 +84,4 @@ public static <T> T copy(T source) {
return copy;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@
<f:param name="text3" value="baz1" />
<f:param name="text3" value="baz2" />
<f:param name="number" value="42" />
<f:param name="date" value="19780326" />
</h:link>
</li>
<li>
<h:link value="Omit required param and set wrong values on others">
<f:param name="text2" value="x" />
<f:param name="number" value="NaN" />
<f:param name="date" value="26 Mar 1978" />
</h:link>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public class OmnifacesResourceTest {
@TestHTTPResource("/index.xhtml")
URL index;

@TestHTTPResource("/params.xhtml")
URL params;

@Test
public void shouldOpenIndexPage() throws Exception {
final Page page = context.newPage();
Expand All @@ -46,26 +43,4 @@ public void shouldOpenIndexPage() throws Exception {
assertThat(message.innerText()).isEqualTo("Hello from OmniFaces ViewScope!");
}

@Test
public void shouldOpenParamsPage() throws Exception {
final Page page = context.newPage();
Response response = page.navigate(params.toString());
Assertions.assertEquals("OK", response.statusText());

page.waitForLoadState();

String title = page.title();
Assertions.assertEquals("CDI Params", title);

Locator message = page.locator("#messages");
assertThat(message).isNotNull();
assertThat(message.innerText()).isEqualTo("text1: Validation Error: Value is required.");

// now click the link
Locator lnkSetParams = page.locator("#lnkSetParams");
lnkSetParams.click();

// check that the messages have changed
assertThat(message.innerText()).isEqualTo("Yes, no validation errors!");
}
}

0 comments on commit 6859cfb

Please # to comment.