target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testWithInstanceCount() { final Deployment deploy = new Deployment(); deploy.withInstanceCount(3); assertEquals(3, (int) deploy.getInstanceCount()); }
public Deployment withInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; }
Deployment { public Deployment withInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } }
Deployment { public Deployment withInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } }
Deployment { public Deployment withInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistent...
Deployment { public Deployment withInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistent...
@Test public void testWithDeploymentName() { final Deployment deploy = new Deployment(); deploy.withDeploymentName("deploymentName1"); assertEquals("deploymentName1", deploy.getDeploymentName()); }
public Deployment withDeploymentName(String deploymentName) { this.deploymentName = deploymentName; return this; }
Deployment { public Deployment withDeploymentName(String deploymentName) { this.deploymentName = deploymentName; return this; } }
Deployment { public Deployment withDeploymentName(String deploymentName) { this.deploymentName = deploymentName; return this; } }
Deployment { public Deployment withDeploymentName(String deploymentName) { this.deploymentName = deploymentName; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersist...
Deployment { public Deployment withDeploymentName(String deploymentName) { this.deploymentName = deploymentName; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersist...
@Test public void testWithJvmOptions() { final Deployment deploy = new Deployment(); deploy.withJvmOptions("jvmOptions1"); assertEquals("jvmOptions1", deploy.getJvmOptions()); }
public Deployment withJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; return this; }
Deployment { public Deployment withJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; return this; } }
Deployment { public Deployment withJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; return this; } }
Deployment { public Deployment withJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistentStorage(); St...
Deployment { public Deployment withJvmOptions(String jvmOptions) { this.jvmOptions = jvmOptions; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistentStorage(); St...
@Test public void doExecute() throws Exception { final RunMojo mojo = getMojoFromPom(); final RunMojo mojoSpy = spy(mojo); doNothing().when(mojoSpy).checkStageDirectoryExistence(); doNothing().when(mojoSpy).checkRuntimeExistence(any(CommandHandler.class)); doNothing().when(mojoSpy).runFunctions(any(CommandHandler.class...
@Override protected void doExecute() throws AzureExecutionException { final CommandHandler commandHandler = new CommandHandlerImpl(); checkStageDirectoryExistence(); checkRuntimeExistence(commandHandler); checkRuntimeCompatibility(commandHandler); runFunctions(commandHandler); }
RunMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { final CommandHandler commandHandler = new CommandHandlerImpl(); checkStageDirectoryExistence(); checkRuntimeExistence(commandHandler); checkRuntimeCompatibility(commandHandler); runFunctions(commandHandler); } }
RunMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { final CommandHandler commandHandler = new CommandHandlerImpl(); checkStageDirectoryExistence(); checkRuntimeExistence(commandHandler); checkRuntimeCompatibility(commandHandler); runFunctions(commandHandler); } ...
RunMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { final CommandHandler commandHandler = new CommandHandlerImpl(); checkStageDirectoryExistence(); checkRuntimeExistence(commandHandler); checkRuntimeCompatibility(commandHandler); runFunctions(commandHandler); } ...
RunMojo extends AbstractFunctionMojo { @Override protected void doExecute() throws AzureExecutionException { final CommandHandler commandHandler = new CommandHandlerImpl(); checkStageDirectoryExistence(); checkRuntimeExistence(commandHandler); checkRuntimeCompatibility(commandHandler); runFunctions(commandHandler); } ...
@Test public void testWithEnvironment() { final Deployment deploy = new Deployment(); deploy.withEnvironment(Collections.singletonMap("foo", "bar")); assertEquals("bar", deploy.getEnvironment().get("foo")); }
public Deployment withEnvironment(Map<String, String> environment) { this.environment = environment; return this; }
Deployment { public Deployment withEnvironment(Map<String, String> environment) { this.environment = environment; return this; } }
Deployment { public Deployment withEnvironment(Map<String, String> environment) { this.environment = environment; return this; } }
Deployment { public Deployment withEnvironment(Map<String, String> environment) { this.environment = environment; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersis...
Deployment { public Deployment withEnvironment(Map<String, String> environment) { this.environment = environment; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersis...
@Test public void testWithResources() { final Deployment deploy = new Deployment(); deploy.withResources(ResourcesUtils.getDefaultResources()); assertEquals(1, deploy.getResources().size()); assertEquals("*.jar", deploy.getResources().get(0).getIncludes().get(0)); }
public Deployment withResources(List<Resource> resources) { this.resources = resources; return this; }
Deployment { public Deployment withResources(List<Resource> resources) { this.resources = resources; return this; } }
Deployment { public Deployment withResources(List<Resource> resources) { this.resources = resources; return this; } }
Deployment { public Deployment withResources(List<Resource> resources) { this.resources = resources; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistentStorage()...
Deployment { public Deployment withResources(List<Resource> resources) { this.resources = resources; return this; } Integer getCpu(); Integer getMemoryInGB(); Integer getInstanceCount(); String getDeploymentName(); Map<String, String> getEnvironment(); List<Resource> getResources(); Boolean isEnablePersistentStorage()...
@Test public void testSetSubscriptionId() { final AppSettings app = new AppSettings(); app.setSubscriptionId("subscriptionId1"); assertEquals("subscriptionId1", app.getSubscriptionId()); }
public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; }
AppSettings extends BaseSettings { public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } }
AppSettings extends BaseSettings { public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } }
AppSettings extends BaseSettings { public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appN...
AppSettings extends BaseSettings { public void setSubscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appN...
@Test public void testSetClusterName() { final AppSettings app = new AppSettings(); app.setClusterName("clusterName1"); assertEquals("clusterName1", app.getClusterName()); }
public void setClusterName(String clusterName) { this.clusterName = clusterName; }
AppSettings extends BaseSettings { public void setClusterName(String clusterName) { this.clusterName = clusterName; } }
AppSettings extends BaseSettings { public void setClusterName(String clusterName) { this.clusterName = clusterName; } }
AppSettings extends BaseSettings { public void setClusterName(String clusterName) { this.clusterName = clusterName; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appName); String...
AppSettings extends BaseSettings { public void setClusterName(String clusterName) { this.clusterName = clusterName; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appName); String...
@Test public void testSetAppName() { final AppSettings app = new AppSettings(); app.setAppName("appName1"); assertEquals("appName1", app.getAppName()); }
public void setAppName(String appName) { this.appName = appName; }
AppSettings extends BaseSettings { public void setAppName(String appName) { this.appName = appName; } }
AppSettings extends BaseSettings { public void setAppName(String appName) { this.appName = appName; } }
AppSettings extends BaseSettings { public void setAppName(String appName) { this.appName = appName; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appName); String isPublic(); voi...
AppSettings extends BaseSettings { public void setAppName(String appName) { this.appName = appName; } String getSubscriptionId(); void setSubscriptionId(String subscriptionId); String getClusterName(); void setClusterName(String clusterName); String getAppName(); void setAppName(String appName); String isPublic(); voi...
@Test public void testHandle() throws Exception { final Map<String, Map<String, Object>> templates = (Map<String, Map<String, Object>>) FieldUtils.readField(wrapper, "templates", true); final Map<String, Object> map = MapUtils.putAll(new LinkedHashMap<>(), new Map.Entry[] { new DefaultMapEntry<>("id", "testId1"), new D...
public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
@Test public void testEvaluateDefault() throws Exception { final Map<String, Map<String, Object>> templates = (Map<String, Map<String, Object>>) FieldUtils.readField(wrapper, "templates", true); final Map<String, Object> map = MapUtils.putAll(new LinkedHashMap<>(), new Map.Entry[] { new DefaultMapEntry<>("id", "testId1...
public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
@Test public void testBadTemplate() throws Exception { try { wrapper.handle("", true); fail("Should report IAE when template cannot be found."); } catch (IllegalArgumentException e) { } try { wrapper.handle("badId", true); fail("Should report IAE when template cannot be found."); } catch (IllegalArgumentException e) { ...
public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
@Test public void testHandleBadConfiguration() throws Exception { final Map<String, Map<String, Object>> templates = (Map<String, Map<String, Object>>) FieldUtils.readField(wrapper, "templates", true); final Map<String, Object> map = MapUtils.putAll(new LinkedHashMap<>(), new Map.Entry[] { new DefaultMapEntry<>("id", "...
public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); }
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
PromptWrapper { public String handle(String templateId, boolean autoApplyDefault) throws InvalidConfigurationException, IOException { return handle(templateId, autoApplyDefault, null); } PromptWrapper(ExpressionEvaluator expressionEvaluator, Log log); void initialize(); void putCommonVariable(String key, Object obj); T...
@Test public void testHandleSelectOne() throws Exception { final Map<String, Map<String, Object>> templates = (Map<String, Map<String, Object>>) FieldUtils.readField(wrapper, "templates", true); final Map<String, Object> map = MapUtils.putAll(new LinkedHashMap<>(), new Map.Entry[] { new DefaultMapEntry<>("id", "testId1...
public <T> T handleSelectOne(String templateId, List<T> options, T defaultEntity, Function<T, String> getNameFunc) throws IOException, SpringConfigurationException { final Map<String, Object> variables = createVariableTables(templateId); final boolean isRequired = TemplateUtils.evalBoolean("required", variables); if (o...
PromptWrapper { public <T> T handleSelectOne(String templateId, List<T> options, T defaultEntity, Function<T, String> getNameFunc) throws IOException, SpringConfigurationException { final Map<String, Object> variables = createVariableTables(templateId); final boolean isRequired = TemplateUtils.evalBoolean("required", v...
PromptWrapper { public <T> T handleSelectOne(String templateId, List<T> options, T defaultEntity, Function<T, String> getNameFunc) throws IOException, SpringConfigurationException { final Map<String, Object> variables = createVariableTables(templateId); final boolean isRequired = TemplateUtils.evalBoolean("required", v...
PromptWrapper { public <T> T handleSelectOne(String templateId, List<T> options, T defaultEntity, Function<T, String> getNameFunc) throws IOException, SpringConfigurationException { final Map<String, Object> variables = createVariableTables(templateId); final boolean isRequired = TemplateUtils.evalBoolean("required", v...
PromptWrapper { public <T> T handleSelectOne(String templateId, List<T> options, T defaultEntity, Function<T, String> getNameFunc) throws IOException, SpringConfigurationException { final Map<String, Object> variables = createVariableTables(templateId); final boolean isRequired = TemplateUtils.evalBoolean("required", v...
@Test(expected = AzureExecutionException.class) public void checkStageDirectoryExistenceWhenIsNotDirectory() throws Exception { final RunMojo mojo = getMojoFromPom(); final RunMojo mojoSpy = spy(mojo); doReturn("./RunMojoTest.java").when(mojoSpy).getDeploymentStagingDirectoryPath(); mojoSpy.checkStageDirectoryExistence...
protected void checkStageDirectoryExistence() throws AzureExecutionException { final File file = new File(getDeploymentStagingDirectoryPath()); if (!file.exists() || !file.isDirectory()) { throw new AzureExecutionException(STAGE_DIR_NOT_FOUND); } Log.info(STAGE_DIR_FOUND + getDeploymentStagingDirectoryPath()); }
RunMojo extends AbstractFunctionMojo { protected void checkStageDirectoryExistence() throws AzureExecutionException { final File file = new File(getDeploymentStagingDirectoryPath()); if (!file.exists() || !file.isDirectory()) { throw new AzureExecutionException(STAGE_DIR_NOT_FOUND); } Log.info(STAGE_DIR_FOUND + getDepl...
RunMojo extends AbstractFunctionMojo { protected void checkStageDirectoryExistence() throws AzureExecutionException { final File file = new File(getDeploymentStagingDirectoryPath()); if (!file.exists() || !file.isDirectory()) { throw new AzureExecutionException(STAGE_DIR_NOT_FOUND); } Log.info(STAGE_DIR_FOUND + getDepl...
RunMojo extends AbstractFunctionMojo { protected void checkStageDirectoryExistence() throws AzureExecutionException { final File file = new File(getDeploymentStagingDirectoryPath()); if (!file.exists() || !file.isDirectory()) { throw new AzureExecutionException(STAGE_DIR_NOT_FOUND); } Log.info(STAGE_DIR_FOUND + getDepl...
RunMojo extends AbstractFunctionMojo { protected void checkStageDirectoryExistence() throws AzureExecutionException { final File file = new File(getDeploymentStagingDirectoryPath()); if (!file.exists() || !file.isDirectory()) { throw new AzureExecutionException(STAGE_DIR_NOT_FOUND); } Log.info(STAGE_DIR_FOUND + getDepl...
@Test public void testRead_errors () { assertThrows(IllegalStateException.class, () -> RequestParams.builder(resource).value("x")); }
public static Builder builder (String resource) { return new Builder(resource); }
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } }
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams( String resource, String primaryKey, String primaryKeyValue, String column, String columnValue, String query, List<NameValuePair> queryArgs, Lis...
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams( String resource, String primaryKey, String primaryKeyValue, String column, String columnValue, String query, List<NameValuePair> queryArgs, Lis...
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams( String resource, String primaryKey, String primaryKeyValue, String column, String columnValue, String query, List<NameValuePair> queryArgs, Lis...
@Test public void testDynamicQuery_errors () { assertThrows(IllegalArgumentException.class, () -> RequestParams.builder(resource).dynamicQuery("invalid")); assertThrows(IllegalArgumentException.class, () -> RequestParams.builder(resource).dynamicQuery("Find")); assertThrows(IllegalStateException.class, () -> RequestPar...
public static Builder builder (String resource) { return new Builder(resource); }
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } }
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams( String resource, String primaryKey, String primaryKeyValue, String column, String columnValue, String query, List<NameValuePair> queryArgs, Lis...
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams( String resource, String primaryKey, String primaryKeyValue, String column, String columnValue, String query, List<NameValuePair> queryArgs, Lis...
RequestParams { public static Builder builder (String resource) { return new Builder(resource); } RequestParams( String resource, String primaryKey, String primaryKeyValue, String column, String columnValue, String query, List<NameValuePair> queryArgs, Lis...
@Test public void buildsPngImage() throws Exception { final Base base = new MkBase(); final String alias = "test"; final String urn = "urn:test:1"; base.user(new URN(urn)).aliases().add(alias); MatcherAssert.assertThat( new RsPrint( new TkFriend(base).act( new RqRegex.Fake( new RqWithAuth(urn), "(.*)", alias ) ) ), Mat...
@Override public Response act(final RqRegex req) throws IOException { final User user = new RqAlias(this.base, req).user(); final String alias = req.matcher().group(1); final Iterable<Friend> opts = user.friends(alias); if (Iterables.isEmpty(opts)) { throw new RsFailure( String.format("alias \"%s\" not found", alias) )...
TkFriend implements TkRegex { @Override public Response act(final RqRegex req) throws IOException { final User user = new RqAlias(this.base, req).user(); final String alias = req.matcher().group(1); final Iterable<Friend> opts = user.friends(alias); if (Iterables.isEmpty(opts)) { throw new RsFailure( String.format("ali...
TkFriend implements TkRegex { @Override public Response act(final RqRegex req) throws IOException { final User user = new RqAlias(this.base, req).user(); final String alias = req.matcher().group(1); final Iterable<Friend> opts = user.friends(alias); if (Iterables.isEmpty(opts)) { throw new RsFailure( String.format("ali...
TkFriend implements TkRegex { @Override public Response act(final RqRegex req) throws IOException { final User user = new RqAlias(this.base, req).user(); final String alias = req.matcher().group(1); final Iterable<Friend> opts = user.friends(alias); if (Iterables.isEmpty(opts)) { throw new RsFailure( String.format("ali...
TkFriend implements TkRegex { @Override public Response act(final RqRegex req) throws IOException { final User user = new RqAlias(this.base, req).user(); final String alias = req.matcher().group(1); final Iterable<Friend> opts = user.friends(alias); if (Iterables.isEmpty(opts)) { throw new RsFailure( String.format("ali...
@Test public void formatsTextToHtml() throws Exception { final String meta = new MarkdownTxtmark().html( Joiner.on(MarkdownTxtmarkTest.EOL).join( "**hi**, _dude_!\r", "", " b**o", " ", " ", " o**m", "" ) ); MatcherAssert.assertThat( String.format("<x>%s</x>", meta), Matchers.describedAs( meta, XhtmlMatchers.hasXPaths( ...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void handlesBrokenFormattingGracefully() throws Exception { final String[] texts = { Joiner.on(MarkdownTxtmarkTest.EOL).join("**", ""), "__", "", "**hi there! {{{", Joiner.on(MarkdownTxtmarkTest.EOL).join( " ", " ", " ", " ", "" ), }; for (final String text : texts) { MatcherAssert.assertThat( String.forma...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void handlesReferenceLinks() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html( "Reference-style: \n![alt text][logo]\n\n[logo]: https: ), Matchers.equalTo( "<p>Reference-style:<br />\n<img src=\"https: ) ); }
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void handlesScriptViolation() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html( "<script>alert()</script>" ), Matchers.equalTo( "<p>&lt;script>alert()&lt;/script></p>\n" ) ); }
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void formatsTextFragmentsToHtml() throws Exception { final String[][] texts = { new String[] {"hi, *dude*!", "<p>hi, <em>dude</em>!</p>"}, new String[] { "hello, **dude**!", "<p>hello, <strong>dude</strong>!</p>", }, new String[] { "wazzup, ***dude***!", "<p>wazzup, <strong><em>dude</em></strong>!</p>", },...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void formatsCodeFragmentsToHtml() throws Exception { final String[][] texts = { new String[] { "```\ncode\nanother line of code\n```", "<p><pre><code>code\nanother line of code</code></pre></p>", }, new String[] { "``code span not block\nextra line``", "<p><code>code span not block\nextra line</code></p>",...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void formatsBulletsToHtml() throws Exception { final String meta = new MarkdownTxtmark().html( Joiner.on(MarkdownTxtmarkTest.EOL).join( "my list:", "", "* line one", "* line two", "", "normal text now" ) ); MatcherAssert.assertThat( String.format("<r>%s</r>", meta), Matchers.describedAs( meta, XhtmlMatcher...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void breaksSingleLine() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html( Joiner.on(MarkdownTxtmarkTest.EOL) .join("line1 line", "line2", "", "line3").trim() ), Matchers.equalTo( Joiner.on(MarkdownTxtmarkTest.EOL).join( "<p>line1 line<br />", "line2<br /></p>", "<p>line3</p>", "" ) )...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void leavesDivUntouched() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html("<div>hey<svg viewBox='444'/></div>"), XhtmlMatchers.hasXPaths( "/div/svg[@viewBox]" ) ); }
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void detectsLinks() throws Exception { final String[][] texts = { new String[] { "<a href=\"http: "<p><a href=\"http: }, new String[] { "http: "<p><a href=\"http: }, new String[]{ "(http: "<p>(<a href=\"http: }, new String[] { "(http: "<p>(<a href=\"http: }, new String[] { "(https: "<p>(<a href=\"https: },...
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void rendersPage() throws Exception { final Base base = new MkBase(); final String alias = "test"; final String urn = "urn:test:1"; base.user(URN.create(urn)).aliases().add(alias); MatcherAssert.assertThat( new RsPrint( new TkIndex(base).act(new RqWithAuth(urn)) ).printBody(), XhtmlMatchers.hasXPaths( "/pa...
@Override public Response act(final Request req) throws IOException { return new RsPage( "/xsl/account.xsl", this.base, new RqWithDefaultHeader(req, HttpHeaders.ACCEPT, "text/xml"), new XeLink("save-email", "/acc/save") ); }
TkIndex implements Take { @Override public Response act(final Request req) throws IOException { return new RsPage( "/xsl/account.xsl", this.base, new RqWithDefaultHeader(req, HttpHeaders.ACCEPT, "text/xml"), new XeLink("save-email", "/acc/save") ); } }
TkIndex implements Take { @Override public Response act(final Request req) throws IOException { return new RsPage( "/xsl/account.xsl", this.base, new RqWithDefaultHeader(req, HttpHeaders.ACCEPT, "text/xml"), new XeLink("save-email", "/acc/save") ); } TkIndex(final Base bse); }
TkIndex implements Take { @Override public Response act(final Request req) throws IOException { return new RsPage( "/xsl/account.xsl", this.base, new RqWithDefaultHeader(req, HttpHeaders.ACCEPT, "text/xml"), new XeLink("save-email", "/acc/save") ); } TkIndex(final Base bse); @Override Response act(final Request req); }
TkIndex implements Take { @Override public Response act(final Request req) throws IOException { return new RsPage( "/xsl/account.xsl", this.base, new RqWithDefaultHeader(req, HttpHeaders.ACCEPT, "text/xml"), new XeLink("save-email", "/acc/save") ); } TkIndex(final Base bse); @Override Response act(final Request req); ...
@Test public void escapesReplacement() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html("backslash \\ and group reference $3\n"), Matchers.is("<p>backslash \\ and group reference $3<br /></p>\n") ); }
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void returnsSecondIdentity() throws Exception { MatcherAssert.assertThat( new PsTwice( new PsFake(true), new PsLogout() ).enter(new RqFake()).get(), Matchers.is(Identity.ANONYMOUS) ); }
@Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; }
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } }
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); }
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Ov...
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Ov...
@Test public void returnsEmptyIdentity() throws Exception { MatcherAssert.assertThat( new PsTwice( new PsFake(false), new PsLogout() ).enter(new RqFake()).has(), Matchers.equalTo(false) ); }
@Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; }
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } }
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); }
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Ov...
PsTwice implements Pass { @Override public Opt<Identity> enter(final Request req) throws IOException { Opt<Identity> user = new Opt.Empty<>(); if (this.fst.enter(req).has()) { user = this.snd.enter(req); } return user; } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Ov...
@Test public void returnsCorrectResponseOnExit() throws Exception { MatcherAssert.assertThat( new PsTwice( new PsFake(true), new PsLogout() ).exit(new RsEmpty(), Identity.ANONYMOUS) .head().iterator().next(), Matchers.containsString("HTTP/1.1 200 O") ); }
@Override public Response exit(final Response response, final Identity identity) throws IOException { return this.snd.exit(response, identity); }
PsTwice implements Pass { @Override public Response exit(final Response response, final Identity identity) throws IOException { return this.snd.exit(response, identity); } }
PsTwice implements Pass { @Override public Response exit(final Response response, final Identity identity) throws IOException { return this.snd.exit(response, identity); } PsTwice(final Pass first, final Pass second); }
PsTwice implements Pass { @Override public Response exit(final Response response, final Identity identity) throws IOException { return this.snd.exit(response, identity); } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Override Response exit(final Response response, ...
PsTwice implements Pass { @Override public Response exit(final Response response, final Identity identity) throws IOException { return this.snd.exit(response, identity); } PsTwice(final Pass first, final Pass second); @Override Opt<Identity> enter(final Request req); @Override Response exit(final Response response, ...
@Test public void buildsGifImage() throws Exception { MatcherAssert.assertThat( new RsPrint( new TkFavicon().act(new RqFake("GET", "/?unread=44")) ).printBody(), Matchers.notNullValue() ); }
@Override public Response act(final Request req) throws IOException { final long unread = TkFavicon.unread(req); final int width = 64; final int height = 64; final BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); final Graphics graph = image.getGraphics(); graph.setColor(new Color(0...
TkFavicon implements Take { @Override public Response act(final Request req) throws IOException { final long unread = TkFavicon.unread(req); final int width = 64; final int height = 64; final BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); final Graphics graph = image.getGraphics()...
TkFavicon implements Take { @Override public Response act(final Request req) throws IOException { final long unread = TkFavicon.unread(req); final int width = 64; final int height = 64; final BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); final Graphics graph = image.getGraphics()...
TkFavicon implements Take { @Override public Response act(final Request req) throws IOException { final long unread = TkFavicon.unread(req); final int width = 64; final int height = 64; final BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); final Graphics graph = image.getGraphics()...
TkFavicon implements Take { @Override public Response act(final Request req) throws IOException { final long unread = TkFavicon.unread(req); final int width = 64; final int height = 64; final BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); final Graphics graph = image.getGraphics()...
@Test public void sendsMessageToBout() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff1"); final Alias alias = user.aliases().iterate().iterator().next(); final long number = alias.inbox().start(); final Bout bout ...
private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return URLDecoder.decode(matcher.gro...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
@Test(expected = RsFailure.class) public void ignoresWrongRequest() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:3"; final User user = base.user(new URN(urn)); user.aliases().add("jeff3"); final Alias alias = user.aliases().iterate().iterator().next(); final long bout = alias.inbox(...
private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return URLDecoder.decode(matcher.gro...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
@Test public void ignoresWrongFile() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:2"; final User user = base.user(new URN(urn)); user.aliases().add("jeff2"); final Alias alias = user.aliases().iterate().iterator().next(); final long bout = alias.inbox().start(); alias.inbox().bout(b...
private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return URLDecoder.decode(matcher.gro...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
TkAttach implements Take { private static String name(final Request file) throws IOException { final Matcher matcher = TkAttach.FILE_NAME_PATTERN.matcher( new RqHeaders.Smart( new RqHeaders.Base(file) ).single("Content-Disposition") ); if (!matcher.find()) { throw new RsFailure("Filename was not provided"); } return UR...
@Test public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bo...
private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(Inbox.NEVER) ) ); messages =...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
@Test public void searchesMessages() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:99"; final User user = base.user(new URN(urn)); user.aliases().add("test-search-user"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox(...
private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(Inbox.NEVER) ) ); messages =...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
TkIndex implements Take { private static Iterable<Message> messages(final Bout bout, final Request req, final String query) throws IOException { final Iterable<Message> messages; if (StringUtils.isBlank(query)) { final long start = Long.parseLong( new RqHref.Smart(new RqHref.Base(req)).single( "start", Long.toString(In...
@Test public void savesEmail() throws Exception { final Base base = new CdBase(new MkBase()); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("alias"); final Alias alias = user.aliases().iterate().iterator().next(); alias.email("old@example.com"); new TkAuth( new TkSaveEma...
@Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOException ex) { throw new RsFailu...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
@Test (expected = RsForward.class) public void invitesUserByEmail() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox()...
@Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invite, bout); } else { guest =...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
@Test (expected = RsFailure.class) public void failsWhenInvitingWithTooLongAlias() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:2"; final User user = base.user(new URN(urn)); final String name = StringUtils.join( "12345678901234567890123456789012345678901234", "567890123456789012345...
@Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invite, bout); } else { guest =...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
@Test (expected = RsForward.class) public void invitesValidAlias() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:3"; final User user = base.user(new URN(urn)); final String name = "john"; user.aliases().add(name); final Alias alias = user.aliases().iterate().iterator().next(); try { ...
@Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invite, bout); } else { guest =...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
TkInvite implements Take { @Override public Response act(final Request req) throws IOException { final String invite = new RqForm.Smart( new RqForm.Base(req) ).single("name"); final Bout bout = new RqBout(this.base, req).bout(); final String guest; if (MAIL_MASK.matcher(invite).find()) { guest = this.inviteByEmail(invi...
@Test public void allocatesDifferentNumbersWithDifferentPorts() throws Exception { final int porta = Ports.allocate(); final int portb = Ports.allocate(); final int portc = Ports.allocate(); MatcherAssert.assertThat(porta, Matchers.not(portb)); MatcherAssert.assertThat(porta, Matchers.not(portc)); MatcherAssert.assertT...
public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt)); return...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
@Test public void allocatesDifferentNumbersWithSamePorts() throws Exception { final int porta = Ports.allocate(); final int portb = Ports.allocate(); final int portc = Ports.allocate(); MatcherAssert.assertThat(porta, Matchers.not(portb)); MatcherAssert.assertThat(porta, Matchers.not(portc)); MatcherAssert.assertThat(p...
public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt)); return...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
Ports { public static int allocate() throws IOException { synchronized (Ports.class) { int attempts = 0; int prt; do { prt = random(); ++attempts; if (attempts > 100) { throw new IllegalStateException( String.format( "failed to allocate TCP port after %d attempts", attempts ) ); } } while (Ports.ASSIGNED.contains(prt))...
@Test public void readsInboxPeriodically() throws Exception { final GreenMail mail = new GreenMail( new ServerSetup(Ports.allocate(), null, "pop3") ); mail.start(); final ServerSetup setup = mail.getPop3().getServerSetup(); final String login = "to"; final String from = "from@localhost.com"; final String to = "to@local...
public void start() { final Thread monitor = new Thread( new Runnable() { @Override public void run() { EmCatch.this.mainLoop(); } } ); monitor.setDaemon(true); monitor.start(); }
EmCatch { public void start() { final Thread monitor = new Thread( new Runnable() { @Override public void run() { EmCatch.this.mainLoop(); } } ); monitor.setDaemon(true); monitor.start(); } }
EmCatch { public void start() { final Thread monitor = new Thread( new Runnable() { @Override public void run() { EmCatch.this.mainLoop(); } } ); monitor.setDaemon(true); monitor.start(); } EmCatch(final Action act, final String usr, final String pass, final String hst, final int prt, final long prd); }
EmCatch { public void start() { final Thread monitor = new Thread( new Runnable() { @Override public void run() { EmCatch.this.mainLoop(); } } ); monitor.setDaemon(true); monitor.start(); } EmCatch(final Action act, final String usr, final String pass, final String hst, final int prt, final long prd); void star...
EmCatch { public void start() { final Thread monitor = new Thread( new Runnable() { @Override public void run() { EmCatch.this.mainLoop(); } } ); monitor.setDaemon(true); monitor.start(); } EmCatch(final Action act, final String usr, final String pass, final String hst, final int prt, final long prd); void star...
@Test public void sendEmailWithInviteKey() throws Exception { final String content = "You are invited into the Netbout click on the link to"; final Postman postman = Mockito.mock(Postman.class); final BoutInviteMail mail = new BoutInviteMail(postman); final MkBase base = new MkBase(); final Alias alias = new EmAlias(ba...
public void send(final String email, final String urn, final Bout bout) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(email)) .with( new StSubject( String.format( "#%d: %s", bout.number(), bout.title() ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Default().html( BoutIn...
BoutInviteMail { public void send(final String email, final String urn, final Bout bout) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(email)) .with( new StSubject( String.format( "#%d: %s", bout.number(), bout.title() ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Defau...
BoutInviteMail { public void send(final String email, final String urn, final Bout bout) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(email)) .with( new StSubject( String.format( "#%d: %s", bout.number(), bout.title() ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Defau...
BoutInviteMail { public void send(final String email, final String urn, final Bout bout) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(email)) .with( new StSubject( String.format( "#%d: %s", bout.number(), bout.title() ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Defau...
BoutInviteMail { public void send(final String email, final String urn, final Bout bout) throws IOException { this.postman.send( new Envelope.MIME() .with(new StRecipient(email)) .with( new StSubject( String.format( "#%d: %s", bout.number(), bout.title() ) ) ) .with( new EnHTML( Joiner.on('\n').join( new Markdown.Defau...
@Test(expected = RsFailure.class) public void throwsUserFriendlyExceptionOnFailure() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias alias = new EmAlias(base.randomAlias(), postman); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.f...
@Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.subscription(friend.alias())) { con...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
@Test public void canSendEmailWithReplyTo() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias alias = new EmAlias(base.randomAlias(), postman); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.friends().invite(base.randomAlias().name()...
@Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.subscription(friend.alias())) { con...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
EmMessages implements Messages { @Override public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.su...
@Test public void sendsConfirmationEmail() throws Exception { final Postman postman = Mockito.mock(Postman.class); final Alias alias = new EmAlias(new MkBase().randomAlias(), postman); alias.email("mihai@test.com", "netbout.com/test/verification/link"); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(En...
@Override public String email() throws IOException { return this.origin.email(); }
EmAlias implements Alias { @Override public String email() throws IOException { return this.origin.email(); } }
EmAlias implements Alias { @Override public String email() throws IOException { return this.origin.email(); } EmAlias(final Alias org, final Postman pst); }
EmAlias implements Alias { @Override public String email() throws IOException { return this.origin.email(); } EmAlias(final Alias org, final Postman pst); @Override String name(); @Override URI photo(); @Override Locale locale(); @Override void photo(final URI uri); @Override String email(); @Override void email(final ...
EmAlias implements Alias { @Override public String email() throws IOException { return this.origin.email(); } EmAlias(final Alias org, final Postman pst); @Override String name(); @Override URI photo(); @Override Locale locale(); @Override void photo(final URI uri); @Override String email(); @Override void email(final ...
@Test public void savesEmailLocal() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:2"; final User user = base.user(new URN(urn)); user.aliases().add("alias2"); final Alias alias = user.aliases().iterate().iterator().next(); alias.email("jack@example.com"); final String email = "john@e...
@Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOException ex) { throw new RsFailu...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
@Test public void changesUpdateAttribute() throws Exception { final Bout bout = new MkBase().randomBout(); final Messages messages = bout.messages(); final Long last = bout.updated().getTime(); messages.post("hi"); Thread.sleep(Tv.HUNDRED); MatcherAssert.assertThat( bout.updated().getTime(), Matchers.greaterThan(last) ...
@Override public void post(final String text) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO message (bout, text, author) VALUES (?, ?, ?)") .set(this.bout) .set(text) .set(this.self) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } new TouchBout(thi...
MkMessages implements Messages { @Override public void post(final String text) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO message (bout, text, author) VALUES (?, ?, ?)") .set(this.bout) .set(text) .set(this.self) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOE...
MkMessages implements Messages { @Override public void post(final String text) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO message (bout, text, author) VALUES (?, ?, ?)") .set(this.bout) .set(text) .set(this.self) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOE...
MkMessages implements Messages { @Override public void post(final String text) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO message (bout, text, author) VALUES (?, ?, ?)") .set(this.bout) .set(text) .set(this.self) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOE...
MkMessages implements Messages { @Override public void post(final String text) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO message (bout, text, author) VALUES (?, ?, ?)") .set(this.bout) .set(text) .set(this.self) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOE...
@Test public final void testStart() throws IOException { final String name = "current-name"; final Sql sql = new H2Sql(); final Aliases aliases = new MkUser( sql, URN.create( String.format( "urn:test:%d", new SecureRandom().nextInt(Integer.MAX_VALUE) ) ) ).aliases(); aliases.add(name); final Alias alias = aliases.itera...
@Override public long start() throws IOException { try { final Long number = new JdbcSession(this.sql.source()) .sql("INSERT INTO bout (title) VALUES (?)") .set("untitled") .insert(new SingleOutcome<Long>(Long.class)); this.bout(number).friends().invite(this.self); return number; } catch (final SQLException ex) { throw...
MkInbox implements Inbox { @Override public long start() throws IOException { try { final Long number = new JdbcSession(this.sql.source()) .sql("INSERT INTO bout (title) VALUES (?)") .set("untitled") .insert(new SingleOutcome<Long>(Long.class)); this.bout(number).friends().invite(this.self); return number; } catch (fin...
MkInbox implements Inbox { @Override public long start() throws IOException { try { final Long number = new JdbcSession(this.sql.source()) .sql("INSERT INTO bout (title) VALUES (?)") .set("untitled") .insert(new SingleOutcome<Long>(Long.class)); this.bout(number).friends().invite(this.self); return number; } catch (fin...
MkInbox implements Inbox { @Override public long start() throws IOException { try { final Long number = new JdbcSession(this.sql.source()) .sql("INSERT INTO bout (title) VALUES (?)") .set("untitled") .insert(new SingleOutcome<Long>(Long.class)); this.bout(number).friends().invite(this.self); return number; } catch (fin...
MkInbox implements Inbox { @Override public long start() throws IOException { try { final Long number = new JdbcSession(this.sql.source()) .sql("INSERT INTO bout (title) VALUES (?)") .set("untitled") .insert(new SingleOutcome<Long>(Long.class)); this.bout(number).friends().invite(this.self); return number; } catch (fin...
@Test public void savesAndReadsEmail() throws Exception { final Alias alias = new MkBase().randomAlias(); MatcherAssert.assertThat(alias.email(), Matchers.notNullValue()); final String email = "jeff@example.com"; alias.email(email); MatcherAssert.assertThat(alias.email(), Matchers.equalTo(email)); }
@Override public String email() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT email FROM alias WHERE name = ?") .set(this.label) .select(new SingleOutcome<String>(String.class)); } catch (final SQLException ex) { throw new IOException(ex); } }
MkAlias implements Alias { @Override public String email() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT email FROM alias WHERE name = ?") .set(this.label) .select(new SingleOutcome<String>(String.class)); } catch (final SQLException ex) { throw new IOException(ex); } } }
MkAlias implements Alias { @Override public String email() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT email FROM alias WHERE name = ?") .set(this.label) .select(new SingleOutcome<String>(String.class)); } catch (final SQLException ex) { throw new IOException(ex); } } MkAlias(final...
MkAlias implements Alias { @Override public String email() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT email FROM alias WHERE name = ?") .set(this.label) .select(new SingleOutcome<String>(String.class)); } catch (final SQLException ex) { throw new IOException(ex); } } MkAlias(final...
MkAlias implements Alias { @Override public String email() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT email FROM alias WHERE name = ?") .set(this.label) .select(new SingleOutcome<String>(String.class)); } catch (final SQLException ex) { throw new IOException(ex); } } MkAlias(final...
@Test public void startsBoutAndTalks() throws Exception { final Messages messages = new MkBase().randomBout().messages(); messages.post("How are you doing?"); MatcherAssert.assertThat( messages.iterate(), Matchers.hasItem( new Message.HasText(Matchers.containsString("are you")) ) ); }
public Bout randomBout() throws IOException { final Inbox inbox = this.randomAlias().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename( String.format( "random title %d", MkBase.RANDOM.nextInt(Integer.MAX_VALUE) ) ); return bout; }
MkBase implements Base { public Bout randomBout() throws IOException { final Inbox inbox = this.randomAlias().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename( String.format( "random title %d", MkBase.RANDOM.nextInt(Integer.MAX_VALUE) ) ); return bout; } }
MkBase implements Base { public Bout randomBout() throws IOException { final Inbox inbox = this.randomAlias().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename( String.format( "random title %d", MkBase.RANDOM.nextInt(Integer.MAX_VALUE) ) ); return bout; } MkBase(); MkBase(final Sql src); }
MkBase implements Base { public Bout randomBout() throws IOException { final Inbox inbox = this.randomAlias().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename( String.format( "random title %d", MkBase.RANDOM.nextInt(Integer.MAX_VALUE) ) ); return bout; } MkBase(); MkBase(final Sql src); @Override Use...
MkBase implements Base { public Bout randomBout() throws IOException { final Inbox inbox = this.randomAlias().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename( String.format( "random title %d", MkBase.RANDOM.nextInt(Integer.MAX_VALUE) ) ); return bout; } MkBase(); MkBase(final Sql src); @Override Use...
@Test public void changesUpdateAttribute() throws Exception { final Sql sql = new H2Sql(); final Bout bout = new MkBase(sql).randomBout(); final Long last = bout.updated().getTime(); new TouchBout(sql, bout.number()).act(); Thread.sleep(Tv.HUNDRED); MatcherAssert.assertThat( bout.updated().getTime(), Matchers.greaterTh...
public void act() throws IOException { try { new JdbcSession(this.sql.source()) .sql("UPDATE bout SET updated = CURRENT_TIMESTAMP WHERE number = ?") .set(this.bout) .update(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } }
TouchBout { public void act() throws IOException { try { new JdbcSession(this.sql.source()) .sql("UPDATE bout SET updated = CURRENT_TIMESTAMP WHERE number = ?") .set(this.bout) .update(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } } }
TouchBout { public void act() throws IOException { try { new JdbcSession(this.sql.source()) .sql("UPDATE bout SET updated = CURRENT_TIMESTAMP WHERE number = ?") .set(this.bout) .update(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } } TouchBout(final Sql src, final long bot); }
TouchBout { public void act() throws IOException { try { new JdbcSession(this.sql.source()) .sql("UPDATE bout SET updated = CURRENT_TIMESTAMP WHERE number = ?") .set(this.bout) .update(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } } TouchBout(final Sql src, final long bot); void act(); }
TouchBout { public void act() throws IOException { try { new JdbcSession(this.sql.source()) .sql("UPDATE bout SET updated = CURRENT_TIMESTAMP WHERE number = ?") .set(this.bout) .update(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } } TouchBout(final Sql src, final long bot); void act(); ...
@Test(expected = Friends.UnknownAliasException.class) public void inviteFailsOnUnknownAlias() throws Exception { new MkBase().randomBout().friends().invite("NoSuchFriend"); }
@Override public void invite(final String friend) throws IOException { try { final boolean exists = new JdbcSession(this.sql.source()) .sql("SELECT name FROM alias WHERE name = ?") .set(friend) .select(Outcome.NOT_EMPTY); if (!exists) { throw new Friends.UnknownAliasException( String.format("alias '%s' doesn't exist", ...
MkFriends implements Friends { @Override public void invite(final String friend) throws IOException { try { final boolean exists = new JdbcSession(this.sql.source()) .sql("SELECT name FROM alias WHERE name = ?") .set(friend) .select(Outcome.NOT_EMPTY); if (!exists) { throw new Friends.UnknownAliasException( String.form...
MkFriends implements Friends { @Override public void invite(final String friend) throws IOException { try { final boolean exists = new JdbcSession(this.sql.source()) .sql("SELECT name FROM alias WHERE name = ?") .set(friend) .select(Outcome.NOT_EMPTY); if (!exists) { throw new Friends.UnknownAliasException( String.form...
MkFriends implements Friends { @Override public void invite(final String friend) throws IOException { try { final boolean exists = new JdbcSession(this.sql.source()) .sql("SELECT name FROM alias WHERE name = ?") .set(friend) .select(Outcome.NOT_EMPTY); if (!exists) { throw new Friends.UnknownAliasException( String.form...
MkFriends implements Friends { @Override public void invite(final String friend) throws IOException { try { final boolean exists = new JdbcSession(this.sql.source()) .sql("SELECT name FROM alias WHERE name = ?") .set(friend) .select(Outcome.NOT_EMPTY); if (!exists) { throw new Friends.UnknownAliasException( String.form...
@Test(expected = RsForward.class) public void throwsRsForward() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:3"; final User user = base.user(new URN(urn)); user.aliases().add("alias3"); final Alias alias = user.aliases().iterate().iterator().next(); alias.email("test@example.com"); ...
@Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOException ex) { throw new RsFailu...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
TkSaveEmail implements Take { @Override public Response act(final Request req) throws IOException { final String email = new RqForm.Smart( new RqForm.Base(req) ).single("email"); final Alias alias = new RqAlias(this.base, req).alias(); final Response res; if (this.local) { try { alias.email(email); } catch (final IOExc...
@Test public void kicksAnUser() throws Exception { final String alias = "test"; final String urn = "urn:test:1"; final MkBase base = new MkBase(); final Bout bout = base.randomBout(); base.user(new URN(urn)).aliases().add(alias); bout.friends().invite(alias); MatcherAssert.assertThat( new RsPrint( new TkAuth( new TkApp...
@Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("search", new Href("/search"))...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
@Test public void searchesBouts() throws Exception { final String urn = "urn:test:2"; final MkBase base = new MkBase(); final Aliases aliases = base.user(new URN(urn)).aliases(); aliases.add("test2"); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout first = inbox.bout(inbox.start()); final St...
@Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("search", new Href("/search"))...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
@Test public void handleInvalidSince() throws Exception { final String alias = "test3"; final String urn = "urn:test:3"; final MkBase base = new MkBase(); final Bout bout = base.randomBout(); base.user(new URN(urn)).aliases().add(alias); bout.friends().invite(alias); MatcherAssert.assertThat( new RsPrint( new TkAuth( n...
@Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("search", new Href("/search"))...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
@Test public void handleValidSince() throws Exception { final String alias = "test4"; final String urn = "urn:test:4"; final MkBase base = new MkBase(); final Bout bout = base.randomBout(); base.user(new URN(urn)).aliases().add(alias); bout.friends().invite(alias); MatcherAssert.assertThat( new RsPrint( new TkAuth( new...
@Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("search", new Href("/search"))...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
TkInbox implements Take { @Override public Response act(final Request req) throws IOException { final String query = new RqHref.Smart(new RqHref.Base(req)).single( "q", "" ); return new RsPage( "/xsl/inbox.xsl", this.base, req, new XeAppend("bouts", this.bouts(req, query)), new XeAppend("query", query), new XeLink("sea...
@Test public void handlesWhitespaceAfterLinks() throws Exception { MatcherAssert.assertThat( new MarkdownTxtmark().html( "Hi [google](http: ), Matchers.equalTo( "<p>Hi <a href=\"http: ) ); }
@Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asList("```", "``", "`").iterator() ) ), ...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
MarkdownTxtmark implements Markdown { @Override public String html(@NotNull final String txt) { final Configuration conf = Configuration.builder() .enableSafeMode() .build(); return MarkdownTxtmark.fixedCodeBlocks( Processor.process( MarkdownTxtmark.formatLinks( MarkdownTxtmark.makeLineBreakExcludeCode( txt, Arrays.asL...
@Test public void combinesMultipleFiles() throws Exception { final File input = this.temp.newFolder(); final File output = this.temp.newFolder(); FileUtils.write( new File(input, "b.req"), "\n\nUser is a \"good human being\".", StandardCharsets.UTF_8 ); FileUtils.write( new File(input, "a.req"), "\n\nUser is a \"human ...
public void compile() throws IOException { assert this.properties != null; final long start = System.currentTimeMillis(); final Facet[] facets = { new XeFacet.Wrap(new Aggregate(new File(this.input))), new XeFacet.Wrap(new AntlrFacet()), new Transform("cleanup/duplicate-step-numbers.xsl"), new Transform("cleanup/duplic...
Compiler { public void compile() throws IOException { assert this.properties != null; final long start = System.currentTimeMillis(); final Facet[] facets = { new XeFacet.Wrap(new Aggregate(new File(this.input))), new XeFacet.Wrap(new AntlrFacet()), new Transform("cleanup/duplicate-step-numbers.xsl"), new Transform("cle...
Compiler { public void compile() throws IOException { assert this.properties != null; final long start = System.currentTimeMillis(); final Facet[] facets = { new XeFacet.Wrap(new Aggregate(new File(this.input))), new XeFacet.Wrap(new AntlrFacet()), new Transform("cleanup/duplicate-step-numbers.xsl"), new Transform("cle...
Compiler { public void compile() throws IOException { assert this.properties != null; final long start = System.currentTimeMillis(); final Facet[] facets = { new XeFacet.Wrap(new Aggregate(new File(this.input))), new XeFacet.Wrap(new AntlrFacet()), new Transform("cleanup/duplicate-step-numbers.xsl"), new Transform("cle...
Compiler { public void compile() throws IOException { assert this.properties != null; final long start = System.currentTimeMillis(); final Facet[] facets = { new XeFacet.Wrap(new Aggregate(new File(this.input))), new XeFacet.Wrap(new AntlrFacet()), new Transform("cleanup/duplicate-step-numbers.xsl"), new Transform("cle...
@Test public void setsAttributes() throws Exception { final Directives dirs = new Directives().add("x"); final Method method = new XeMethod(dirs, "/x"); final String name = "attr-1"; method.attribute(name, ""); method.attribute(name, "ffa7ed"); method.attribute("another", "123456"); MatcherAssert.assertThat( XhtmlMatch...
@Override public void attribute(final String name, final String seal) { this.dirs.xpath(this.start) .strict(1) .addIf("attributes") .xpath( String.format( "%s/attributes[not(attribute=%s)]", this.start, XeOntology.escapeXPath(name) ) ) .add("attribute").set(name) .xpath( String.format( "%s/attributes/attribute[.=%s]", ...
XeMethod implements Method { @Override public void attribute(final String name, final String seal) { this.dirs.xpath(this.start) .strict(1) .addIf("attributes") .xpath( String.format( "%s/attributes[not(attribute=%s)]", this.start, XeOntology.escapeXPath(name) ) ) .add("attribute").set(name) .xpath( String.format( "%s/...
XeMethod implements Method { @Override public void attribute(final String name, final String seal) { this.dirs.xpath(this.start) .strict(1) .addIf("attributes") .xpath( String.format( "%s/attributes[not(attribute=%s)]", this.start, XeOntology.escapeXPath(name) ) ) .add("attribute").set(name) .xpath( String.format( "%s/...
XeMethod implements Method { @Override public void attribute(final String name, final String seal) { this.dirs.xpath(this.start) .strict(1) .addIf("attributes") .xpath( String.format( "%s/attributes[not(attribute=%s)]", this.start, XeOntology.escapeXPath(name) ) ) .add("attribute").set(name) .xpath( String.format( "%s/...
XeMethod implements Method { @Override public void attribute(final String name, final String seal) { this.dirs.xpath(this.start) .strict(1) .addIf("attributes") .xpath( String.format( "%s/attributes[not(attribute=%s)]", this.start, XeOntology.escapeXPath(name) ) ) .add("attribute").set(name) .xpath( String.format( "%s/...
@Test public void manipulatesWithTypesAndUseCases() throws Exception { final XeOntology onto = new XeOntology(); final Type type = onto.type("First"); type.explain("first text"); type.parent("Root"); type.slot("one").assign("Emp"); onto.type("Second").explain("second text"); MatcherAssert.assertThat( XhtmlMatchers.xhtm...
@Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPath(name) ) ); }
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
@Test public void avoidsDuplication() throws Exception { final XeOntology onto = new XeOntology(); final String name = "Alpha"; onto.type(name); onto.type(name); MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Xembler(onto).xml()), XhtmlMatchers.hasXPath("/spec/types[count(type)=1]") ); }
@Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPath(name) ) ); }
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
XeOntology implements Ontology { @Override public Type type(final String name) { this.root("types") .xpath( String.format( "/spec/types[not(type/name=%s)]", XeOntology.escapeXPath(name) ) ) .add("type").add("name").set(name); return new XeType( this.dirs, String.format( "/spec/types/type[name=%s]", XeOntology.escapeXPa...
@Test public void avoidsDuplicationOfMethods() throws Exception { final XeOntology onto = new XeOntology(); final String name = "UC3"; onto.method(name); onto.method(name); MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Xembler(onto).xml()), XhtmlMatchers.hasXPath("/spec/methods[count(method)=1]") ); }
@Override public Method method(final String name) { this.root("methods") .xpath( String.format( "/spec/methods[not(method/id=%s)]", XeOntology.escapeXPath(name) ) ) .add("method").add("id").set(name); return new XeMethod( this.dirs, String.format( "/spec/methods/method[id=%s]", XeOntology.escapeXPath(name) ) ); }
XeOntology implements Ontology { @Override public Method method(final String name) { this.root("methods") .xpath( String.format( "/spec/methods[not(method/id=%s)]", XeOntology.escapeXPath(name) ) ) .add("method").add("id").set(name); return new XeMethod( this.dirs, String.format( "/spec/methods/method[id=%s]", XeOntolo...
XeOntology implements Ontology { @Override public Method method(final String name) { this.root("methods") .xpath( String.format( "/spec/methods[not(method/id=%s)]", XeOntology.escapeXPath(name) ) ) .add("method").add("id").set(name); return new XeMethod( this.dirs, String.format( "/spec/methods/method[id=%s]", XeOntolo...
XeOntology implements Ontology { @Override public Method method(final String name) { this.root("methods") .xpath( String.format( "/spec/methods[not(method/id=%s)]", XeOntology.escapeXPath(name) ) ) .add("method").add("id").set(name); return new XeMethod( this.dirs, String.format( "/spec/methods/method[id=%s]", XeOntolo...
XeOntology implements Ontology { @Override public Method method(final String name) { this.root("methods") .xpath( String.format( "/spec/methods[not(method/id=%s)]", XeOntology.escapeXPath(name) ) ) .add("method").add("id").set(name); return new XeMethod( this.dirs, String.format( "/spec/methods/method[id=%s]", XeOntolo...
@Test public void manipulatesWithBindings() throws Exception { final Directives dirs = new Directives().add("f"); final Flow flow = new XeFlow(dirs, "/f"); flow.binding("emp", "Employee"); flow.binding("one", "One"); MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Xembler(dirs).xml()), XhtmlMatchers.hasXPaths( "/f/bi...
@Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type").set(type); }
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
@Test public void avoidsDuplicateBindings() throws Exception { final Directives dirs = new Directives().add("f1"); final Flow flow = new XeFlow(dirs, "/f1"); for (int idx = 0; idx < Tv.FIVE; ++idx) { flow.binding("a", "alpha"); } MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Xembler(dirs).xml()), XhtmlMatchers.hasX...
@Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type").set(type); }
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
XeFlow implements Flow { @Override public void binding(final String name, final String type) { this.dirs.xpath(this.start).strict(1).addIf("bindings").up().xpath( String.format( "bindings[not(binding[name='%s' and type=%s])]", name, XeOntology.escapeXPath(type) ) ).add("binding").add("name").set(name).up().add("type")....
@Test public void checksSeals() { MatcherAssert.assertThat( XhtmlMatchers.xhtml( new Transform("sanity/seals-check.xsl").touch( new XMLDocument( StringUtils.join( "<spec><method seal='a12ef4'>", "<id>UC5</id><attributes>", "<attribute seal='b89e4e'>invalid</attribute>", "<attribute seal='a12ef4'>valid</attribute>", "</...
@Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) .transform(spec); }
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
@Test public void checksTypes() { MatcherAssert.assertThat( XhtmlMatchers.xhtml( new Transform("sanity/types-check.xsl").touch( new XMLDocument( StringUtils.join( "<spec><types><type><name>User</name>", "<slots><slot><type>Alpha</type></slot></slots>", "</type></types><methods><method><bindings>", "<binding><type>Beta<...
@Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) .transform(spec); }
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
@Test public void checksSignatures() { MatcherAssert.assertThat( XhtmlMatchers.xhtml( new Transform("sanity/signatures-check.xsl").touch( new XMLDocument( StringUtils.join( "<spec><methods><method><signature>abc</signature>", "</method><method><steps><step><signature>cde", "</signature></step></steps></method></methods...
@Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) .transform(spec); }
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
Transform implements Facet { @Override public XML touch(final XML spec) { final URL url = Transform.class.getResource(this.sheet); if (url == null) { throw new IllegalArgumentException( String.format("stylesheet '%s' not found", this.sheet) ); } return XSLDocument.make(url) .with(new ClasspathSources(this.getClass())) ...
@Test public void buildsSvg() throws IOException { Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); MatcherAssert.assertThat( XhtmlMatchers.xhtml( Plant.svg("@startuml\nBob -> Alice : hello\n@enduml\n") ), XhtmlMatchers.hasXPath(" ); }
@SuppressWarnings("PMD.ProhibitPublicStaticMethods") public static String svg(final String src) throws IOException { final String svg; if (SystemUtils.IS_OS_WINDOWS) { svg = "<p>SVG can't be rendered in Windows</p>"; } else { final SourceStringReader reader = new SourceStringReader(src); final ByteArrayOutputStream bao...
Plant { @SuppressWarnings("PMD.ProhibitPublicStaticMethods") public static String svg(final String src) throws IOException { final String svg; if (SystemUtils.IS_OS_WINDOWS) { svg = "<p>SVG can't be rendered in Windows</p>"; } else { final SourceStringReader reader = new SourceStringReader(src); final ByteArrayOutputSt...
Plant { @SuppressWarnings("PMD.ProhibitPublicStaticMethods") public static String svg(final String src) throws IOException { final String svg; if (SystemUtils.IS_OS_WINDOWS) { svg = "<p>SVG can't be rendered in Windows</p>"; } else { final SourceStringReader reader = new SourceStringReader(src); final ByteArrayOutputSt...
Plant { @SuppressWarnings("PMD.ProhibitPublicStaticMethods") public static String svg(final String src) throws IOException { final String svg; if (SystemUtils.IS_OS_WINDOWS) { svg = "<p>SVG can't be rendered in Windows</p>"; } else { final SourceStringReader reader = new SourceStringReader(src); final ByteArrayOutputSt...
Plant { @SuppressWarnings("PMD.ProhibitPublicStaticMethods") public static String svg(final String src) throws IOException { final String svg; if (SystemUtils.IS_OS_WINDOWS) { svg = "<p>SVG can't be rendered in Windows</p>"; } else { final SourceStringReader reader = new SourceStringReader(src); final ByteArrayOutputSt...
@Test public void checksInput() throws Exception { MatcherAssert.assertThat( new CascadingRule().enforce("hey\n works\n fine\nstart"), Matchers.empty() ); }
@Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx = 0; idx < lines.length; ++idx) {...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
@Test public void displaysVersionNumber() throws Exception { Main.main(new String[]{"-v"}); MatcherAssert.assertThat( this.out.toString(), Matchers.containsString("-SNAPSHOT") ); }
private Main() { }
Main { private Main() { } }
Main { private Main() { } private Main(); }
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }
@Test public void rendersHelpMessage() throws Exception { Main.main(new String[] {"-h"}); MatcherAssert.assertThat( this.out.toString(), Matchers.containsString("Usage:") ); }
private Main() { }
Main { private Main() { } }
Main { private Main() { } private Main(); }
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }
@Test public void compilesRequsSources() throws Exception { final File input = this.temp.newFolder(); final File output = this.temp.newFolder(); FileUtils.write( new File(input, "employee.req"), "Employee is a \"user of the system\".", StandardCharsets.UTF_8 ); Main.main( new String[] { "-i", input.getAbsolutePath(), "...
private Main() { }
Main { private Main() { } }
Main { private Main() { } private Main(); }
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }
Main { private Main() { } private Main(); @SuppressWarnings("PMD.ProhibitPublicStaticMethods") static void main(final String... args); }
@Test public void processesRequsSpec() throws Exception { final InstantRs res = new InstantRs(); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); final SecurityContext sec = Mockito.mock(SecurityContext.class); res.setSecurityContext(sec); final String json = res.post("Use...
@POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Loggable @SuppressWarnings("PMD.AvoidCatchingGenericException") public String post(@NotNull @FormParam("text") final String text) throws IOException { final File input = Files.createTempDir(); FileUtils.write( new File(input, "in.req"), text, StandardCharsets.UTF_...
InstantRs extends BaseRs { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Loggable @SuppressWarnings("PMD.AvoidCatchingGenericException") public String post(@NotNull @FormParam("text") final String text) throws IOException { final File input = Files.createTempDir(); FileUtils.write( new File(input, "in.req"), ...
InstantRs extends BaseRs { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Loggable @SuppressWarnings("PMD.AvoidCatchingGenericException") public String post(@NotNull @FormParam("text") final String text) throws IOException { final File input = Files.createTempDir(); FileUtils.write( new File(input, "in.req"), ...
InstantRs extends BaseRs { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Loggable @SuppressWarnings("PMD.AvoidCatchingGenericException") public String post(@NotNull @FormParam("text") final String text) throws IOException { final File input = Files.createTempDir(); FileUtils.write( new File(input, "in.req"), ...
InstantRs extends BaseRs { @POST @Path("/") @Produces(MediaType.APPLICATION_JSON) @Loggable @SuppressWarnings("PMD.AvoidCatchingGenericException") public String post(@NotNull @FormParam("text") final String text) throws IOException { final File input = Files.createTempDir(); FileUtils.write( new File(input, "in.req"), ...
@Test public void rendersFrontPage() throws Exception { final IndexRs res = new IndexRs(); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); final SecurityContext sec = Mockito.mock(SecurityContext.class); res.setSecurityContext(sec); final Response response = res.index(); ...
@GET @Path("/") public Response index() throws Exception { return new PageBuilder() .stylesheet("/xsl/index.xsl") .build(DemoPage.class) .init(this) .render() .build(); }
IndexRs extends BaseRs { @GET @Path("/") public Response index() throws Exception { return new PageBuilder() .stylesheet("/xsl/index.xsl") .build(DemoPage.class) .init(this) .render() .build(); } }
IndexRs extends BaseRs { @GET @Path("/") public Response index() throws Exception { return new PageBuilder() .stylesheet("/xsl/index.xsl") .build(DemoPage.class) .init(this) .render() .build(); } }
IndexRs extends BaseRs { @GET @Path("/") public Response index() throws Exception { return new PageBuilder() .stylesheet("/xsl/index.xsl") .build(DemoPage.class) .init(this) .render() .build(); } @GET @Path("/") Response index(); }
IndexRs extends BaseRs { @GET @Path("/") public Response index() throws Exception { return new PageBuilder() .stylesheet("/xsl/index.xsl") .build(DemoPage.class) .init(this) .render() .build(); } @GET @Path("/") Response index(); }
@Test public void checksInvalidInput() throws Exception { MatcherAssert.assertThat( new CascadingRule().enforce( "\n\n\n hey\n three!" ).iterator().next().line(), Matchers.equalTo(Tv.FIVE) ); }
@Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx = 0; idx < lines.length; ++idx) {...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
CascadingRule implements Rule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> enforce(final String text) { final String[] lines = StringUtils.splitPreserveAllTokens(text, '\n'); final Collection<Violation> violations = new LinkedList<>(); int indent = 0; for (int idx =...
@Test public void checksInput() throws IOException { MatcherAssert.assertThat( new XeFacet.Wrap(new Rules()).touch( new XMLDocument( StringUtils.join( "<spec><input>", "User is\ta &quot;human being&quot;. ", "</input></spec>" ) ) ), XhtmlMatchers.hasXPaths( "/spec/errors", "/spec/errors[count(error)>2]" ) ); }
@Override public Iterable<Directive> touch(final XML spec) { final Rule[] rules = { new LineRule.Wrap( new RegexRule( "[^ ] +$", "trailing space(s) at the end of line" ) ), new LineRule.Wrap( new RegexRule( "[^ ] {2,}", "avoid two or more consecutive spaces" ) ), new LineRule.Wrap( new RegexRule( ".{81,}", "avoid lines...
Rules implements XeFacet { @Override public Iterable<Directive> touch(final XML spec) { final Rule[] rules = { new LineRule.Wrap( new RegexRule( "[^ ] +$", "trailing space(s) at the end of line" ) ), new LineRule.Wrap( new RegexRule( "[^ ] {2,}", "avoid two or more consecutive spaces" ) ), new LineRule.Wrap( new RegexR...
Rules implements XeFacet { @Override public Iterable<Directive> touch(final XML spec) { final Rule[] rules = { new LineRule.Wrap( new RegexRule( "[^ ] +$", "trailing space(s) at the end of line" ) ), new LineRule.Wrap( new RegexRule( "[^ ] {2,}", "avoid two or more consecutive spaces" ) ), new LineRule.Wrap( new RegexR...
Rules implements XeFacet { @Override public Iterable<Directive> touch(final XML spec) { final Rule[] rules = { new LineRule.Wrap( new RegexRule( "[^ ] +$", "trailing space(s) at the end of line" ) ), new LineRule.Wrap( new RegexRule( "[^ ] {2,}", "avoid two or more consecutive spaces" ) ), new LineRule.Wrap( new RegexR...
Rules implements XeFacet { @Override public Iterable<Directive> touch(final XML spec) { final Rule[] rules = { new LineRule.Wrap( new RegexRule( "[^ ] +$", "trailing space(s) at the end of line" ) ), new LineRule.Wrap( new RegexRule( "[^ ] {2,}", "avoid two or more consecutive spaces" ) ), new LineRule.Wrap( new RegexR...
@Test public void checksInput() throws Exception { MatcherAssert.assertThat( new IndentationRule().check(" works fine"), Matchers.empty() ); }
@Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Violation.Simple( String.format( "indent...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
@Test public void checksInvalidInput() throws Exception { MatcherAssert.assertThat( new IndentationRule().check(" works fine"), Matchers.not(Matchers.empty()) ); }
@Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Violation.Simple( String.format( "indent...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
IndentationRule implements LineRule { @Override public Collection<Violation> check(final String line) { int indent; for (indent = 0; indent < line.length(); ++indent) { if (line.charAt(indent) != ' ') { break; } } final Collection<Violation> violations = new LinkedList<>(); if (indent % 2 != 0) { violations.add( new Vi...
@Test public void checksInput() throws Exception { MatcherAssert.assertThat( new RegexRule("[a-z]+", "").check("abjkljeklsf"), Matchers.not(Matchers.empty()) ); }
@Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matcher.find()) { violations.add( ne...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
@Test public void checksInvalidInput() throws Exception { MatcherAssert.assertThat( new RegexRule("[0-9]", "").check("broken input"), Matchers.empty() ); }
@Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matcher.find()) { violations.add( ne...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
RegexRule implements LineRule { @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public Collection<Violation> check(final String line) { final Pattern ptn = Pattern.compile(this.regex); final Matcher matcher = ptn.matcher(line); final Collection<Violation> violations = new LinkedList<>(); while (matc...
@Test public void signsMethod() throws Exception { final Directives dirs = new Directives().add("s"); final Signature signature = new XeSignature(dirs, "/s"); signature.sign("\"informal one\""); MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Xembler(dirs).xml()), XhtmlMatchers.hasXPaths( "/s[signature='\"informal on...
@Override public void sign(final String text) { this.dirs.xpath(this.start).strict(1) .add("signature").set(text); }
XeSignature implements Signature { @Override public void sign(final String text) { this.dirs.xpath(this.start).strict(1) .add("signature").set(text); } }
XeSignature implements Signature { @Override public void sign(final String text) { this.dirs.xpath(this.start).strict(1) .add("signature").set(text); } XeSignature(final Directives directives, final String xpath); }
XeSignature implements Signature { @Override public void sign(final String text) { this.dirs.xpath(this.start).strict(1) .add("signature").set(text); } XeSignature(final Directives directives, final String xpath); @Override void sign(final String text); @Override void object(final String name); @Override void result(fi...
XeSignature implements Signature { @Override public void sign(final String text) { this.dirs.xpath(this.start).strict(1) .add("signature").set(text); } XeSignature(final Directives directives, final String xpath); @Override void sign(final String text); @Override void object(final String name); @Override void result(fi...
@Test public void avoidsDuplicateSteps() throws Exception { final Directives dirs = new Directives().add("mtd"); final Method method = new XeMethod(dirs, "/mtd"); method.step(1); method.step(1); MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Xembler(dirs).xml()), XhtmlMatchers.hasXPath("/mtd/steps[count(step)=1]") )...
@Override public Step step(final int number) { return this.flow.step(number); }
XeMethod implements Method { @Override public Step step(final int number) { return this.flow.step(number); } }
XeMethod implements Method { @Override public Step step(final int number) { return this.flow.step(number); } XeMethod(final Directives directives, final String xpath); }
XeMethod implements Method { @Override public Step step(final int number) { return this.flow.step(number); } XeMethod(final Directives directives, final String xpath); @Override void attribute(final String name, final String seal); @Override Nfr nfr(final String name); @Override void sign(final String text); @Override ...
XeMethod implements Method { @Override public Step step(final int number) { return this.flow.step(number); } XeMethod(final Directives directives, final String xpath); @Override void attribute(final String name, final String seal); @Override Nfr nfr(final String name); @Override void sign(final String text); @Override ...
@Test(dataProvider = "parametricStateTestDP") public void parametricStateTest(int originalBase, State s) { ParametricState ts = new ParametricState(s); State s1 = ts.createActualState(originalBase); assert Arrays.equals(s.getMemberPositions(), s1.getMemberPositions()); }
public ParametricState(State state) { Position[] stateMemberPositionArray = state.getMemberPositions(); int memberPositionCount = stateMemberPositionArray.length; memberPositionBoundaryOffsetArray = new int[memberPositionCount]; memberPositionEArray = new int[memberPositionCount]; memberPositionTArray = new boolean[mem...
ParametricState { public ParametricState(State state) { Position[] stateMemberPositionArray = state.getMemberPositions(); int memberPositionCount = stateMemberPositionArray.length; memberPositionBoundaryOffsetArray = new int[memberPositionCount]; memberPositionEArray = new int[memberPositionCount]; memberPositionTArray...
ParametricState { public ParametricState(State state) { Position[] stateMemberPositionArray = state.getMemberPositions(); int memberPositionCount = stateMemberPositionArray.length; memberPositionBoundaryOffsetArray = new int[memberPositionCount]; memberPositionEArray = new int[memberPositionCount]; memberPositionTArray...
ParametricState { public ParametricState(State state) { Position[] stateMemberPositionArray = state.getMemberPositions(); int memberPositionCount = stateMemberPositionArray.length; memberPositionBoundaryOffsetArray = new int[memberPositionCount]; memberPositionEArray = new int[memberPositionCount]; memberPositionTArray...
ParametricState { public ParametricState(State state) { Position[] stateMemberPositionArray = state.getMemberPositions(); int memberPositionCount = stateMemberPositionArray.length; memberPositionBoundaryOffsetArray = new int[memberPositionCount]; memberPositionEArray = new int[memberPositionCount]; memberPositionTArray...
@Test(dataProvider = "transitionInternalTestDp") public void transitionInternalTest(Position p) { int mdStartIndex = p.getE() + (!p.getT() ? 2 : 1); for(int mdi = mdStartIndex; mdi >= p.getE(); mdi--) { for(int rsi = 0; rsi <= 2; rsi++) { for(int hii = -1; hii <= 4; hii++) { int currentE = (mdi == p.getE() + 2 ? 0 : p....
public State transitionInternal(int maxEditDistance, int relevantSubwordSize, int hitIndex) { Position.EditDistanceRelationType edRelationType = (E < maxEditDistance ? (E == 0 ? Position.EditDistanceRelationType.AT_ZERO_AND_NOT_AT_MAX : Position.EditDistanceRelationType.NOT_AT_ZERO_AND_NOT_AT_MAX) : Position.EditDistan...
Position implements Comparable<Position> { public State transitionInternal(int maxEditDistance, int relevantSubwordSize, int hitIndex) { Position.EditDistanceRelationType edRelationType = (E < maxEditDistance ? (E == 0 ? Position.EditDistanceRelationType.AT_ZERO_AND_NOT_AT_MAX : Position.EditDistanceRelationType.NOT_AT...
Position implements Comparable<Position> { public State transitionInternal(int maxEditDistance, int relevantSubwordSize, int hitIndex) { Position.EditDistanceRelationType edRelationType = (E < maxEditDistance ? (E == 0 ? Position.EditDistanceRelationType.AT_ZERO_AND_NOT_AT_MAX : Position.EditDistanceRelationType.NOT_AT...
Position implements Comparable<Position> { public State transitionInternal(int maxEditDistance, int relevantSubwordSize, int hitIndex) { Position.EditDistanceRelationType edRelationType = (E < maxEditDistance ? (E == 0 ? Position.EditDistanceRelationType.AT_ZERO_AND_NOT_AT_MAX : Position.EditDistanceRelationType.NOT_AT...
Position implements Comparable<Position> { public State transitionInternal(int maxEditDistance, int relevantSubwordSize, int hitIndex) { Position.EditDistanceRelationType edRelationType = (E < maxEditDistance ? (E == 0 ? Position.EditDistanceRelationType.AT_ZERO_AND_NOT_AT_MAX : Position.EditDistanceRelationType.NOT_AT...
@Test @Override public void testWrongParameters() throws JsonParsingFailedException { List<Pair<String, JsonObject>> listOfPairsOfStringAndJsonObjects = getWrongParameters(); for (int i = 0; i < listOfPairsOfStringAndJsonObjects.size(); i++) { IDistribution<SPACE> distribution = getDistribution(); try { distribution.se...
@Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getDistributionConfiguration().overrideConfiguration(jsonObject); }
ADistribution implements IDistribution<SPACE> { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getDistributionConfiguration().overrideConfiguration(jsonObject); } }
ADistribution implements IDistribution<SPACE> { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getDistributionConfiguration().overrideConfiguration(jsonObject); } ADistribution(); }
ADistribution implements IDistribution<SPACE> { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getDistributionConfiguration().overrideConfiguration(jsonObject); } ADistribution(); @Override List<SPACE> generateSamples(int numberOfSamples); abstract CONFIG createDe...
ADistribution implements IDistribution<SPACE> { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getDistributionConfiguration().overrideConfiguration(jsonObject); } ADistribution(); @Override List<SPACE> generateSamples(int numberOfSamples); abstract CONFIG createDe...
@Override @Test public void testCorrectParameters() throws JsonParsingFailedException { List<JsonObject> testPairs = getCorrectParameters(); for (int i = 0; i < testPairs.size(); i++) { IEvaluation evaluation = getEvaluation(); JsonObject object = testPairs.get(i); try { evaluation.setParameters(object); } catch (Param...
@Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); }
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } }
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); }
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluatio...
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluatio...
@Override @Test public void testWrongParameters() throws JsonParsingFailedException { List<Pair<String, JsonObject>> testPairs = getWrongParameters(); for (int i = 0; i < testPairs.size(); i++) { IEvaluation evaluation = getEvaluation(); JsonObject object = testPairs.get(i).getSecond(); try { evaluation.setParameters(o...
@Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); }
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } }
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); }
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluatio...
AEvaluation implements IEvaluation { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getEvaluationConfiguration().overrideConfiguration(jsonObject); } AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluatio...
@Test public void testCorrectEvaluationSettings() { evaluation = (AEvaluation<?>) getEvaluation(); List<Pair<EvaluationSetting, EvaluationResult>> testPairs = getCorrectListOfEvaluationSettings(); for (int i = 0; i < testPairs.size(); i++) { EvaluationSetting evaluationSetting = testPairs.get(i).getFirst(); try { Evalu...
public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException;
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; }
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; AEvaluation(ELearningProblem eLearningProblem); }
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluationForOneSetOfEvaluationSe...
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluationForOneSetOfEvaluationSe...
@Test public void testWrongEvaluationSettings() { List<Pair<EvaluationSetting, EvaluationResult>> testPairs = getWrongListOfEvaluationSettings(); AEvaluation<?> evaluation = (AEvaluation<?>) getEvaluation(); for (int i = 0; i < testPairs.size(); i++) { try { EvaluationSetting evaluationSetting = testPairs.get(i).getFir...
public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException;
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; }
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; AEvaluation(ELearningProblem eLearningProblem); }
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluationForOneSetOfEvaluationSe...
AEvaluation implements IEvaluation { public abstract EvaluationResult evaluateSingleCombination(EvaluationSetting evaluationSetting) throws LossException, PredictionFailedException; AEvaluation(ELearningProblem eLearningProblem); @Override void evaluate(); @Override EvaluationResult runEvaluationForOneSetOfEvaluationSe...
@Test public void testEvaluateAlgorithmsCommandWithCommandLineCompleteInput() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { String correctResult = String.format( TestUtils.getStringByReflection(EvaluateAlgorithmsCommand.class, REFLECTION_COMMAND_POSITIVE_TEST), EEval...
@Override public String getFailureReason() { return failureReason; }
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } }
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); }
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); @Override boolean canBeExecuted(); @Override CommandResult executeCommand(); @Override String getFailureR...
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); @Override boolean canBeExecuted(); @Override CommandResult executeCommand(); @Override String getFailureR...
@Test public void testEvaluateAlgorithmsCommandWithSystemConfigCompleteInput() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { String correctResult = String.format( TestUtils.getStringByReflection(EvaluateAlgorithmsCommand.class, REFLECTION_COMMAND_POSITIVE_TEST), EEva...
@Override public String getFailureReason() { return failureReason; }
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } }
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); }
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); @Override boolean canBeExecuted(); @Override CommandResult executeCommand(); @Override String getFailureR...
EvaluateAlgorithmsCommand extends ACommand { @Override public String getFailureReason() { return failureReason; } EvaluateAlgorithmsCommand(String evaluationIdentifierHandler, List<String> metricIdentifierHandler); @Override boolean canBeExecuted(); @Override CommandResult executeCommand(); @Override String getFailureR...
@Test public void testEvaluateAlgorithmsCommandWithSystemConfigNullEvalaution() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { String inCorrectresult = String.format( TestUtils.getStringByReflection(EvaluateAlgorithmsCommand.class, REFLECTION_CANNOT_CREATE_EVALUATION_...
@Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); logger.error(failureReason, commandCannotBeExe...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
@Test public void testEvaluateAlgorithmsCommandWithSystemConfigWrongParameters() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { String inCorrectresult = String.format( TestUtils.getStringByReflection(AEvaluationConfiguration.class, REFLECTION_VALIDATION_EVALUATION_MET...
@Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); logger.error(failureReason, commandCannotBeExe...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
@Test public void testEvaluateAlgorithmsCommandWithSystemConfigWrongParametersForMetrics() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { String invalidValue = TestUtils.getStringByReflection(FMeasureConfiguration.class, REFLECTION_TYPE_VALUE_INVALID); runSystemConfig...
@Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); logger.error(failureReason, commandCannotBeExe...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...
EvaluateAlgorithmsCommand extends ACommand { @Override public boolean canBeExecuted() { try { checkInitialParametersForCommandExecution(); } catch (CommandCannotBeExecutedException commandCannotBeExecuted) { failureReason = String.format(COMMAND_CANNOT_BE_EXECUTED_ERROR_MESSAGE, commandCannotBeExecuted.getMessage()); l...