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 testEnvironment() throws Exception { SiteImpl site = getSite(); PathInfo path = getPath(site, "/health/environment"); DefaultEnvironment env = getEnv(); MockHttpServletResponse resp = new MockHttpServletResponse(); monitoringHandler.handle(getRequest(ctx), resp, env, site, path); String content = resp... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, servletRequest)) { String pathsegment = pathInfo... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... |
@Test public void testSizeMin() { assertTrue("sizeMin(foo,3)"); assertFalse("sizeMin(foo,4)"); assertTrue("sizeMin(multifoo,4)"); assertFalse("sizeMin(multifoo,5)"); assertFalse("sizeMin(multibar,5)"); } | public static boolean sizeMin(Object item, int min) { return size(item) >= min; } | RuleValidation { public static boolean sizeMin(Object item, int min) { return size(item) >= min; } } | RuleValidation { public static boolean sizeMin(Object item, int min) { return size(item) >= min; } RuleValidation(Request container); } | RuleValidation { public static boolean sizeMin(Object item, int min) { return size(item) >= min; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean captcha(String... | RuleValidation { public static boolean sizeMin(Object item, int min) { return size(item) >= min; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean captcha(String... |
@Test public void testQuality() throws IOException { File targetFile = new File(targetFolder, "desert-quality-10.jpg"); ImageProcessor ip = getSource(targetFile); ip.fitToWidth(384).quality(10d); ip.getImage(); } | public ImageProcessor quality(double quality) { op.quality(quality); return this; } | ImageProcessor { public ImageProcessor quality(double quality) { op.quality(quality); return this; } } | ImageProcessor { public ImageProcessor quality(double quality) { op.quality(quality); return this; } ImageProcessor(File imageMagickPath, File sourceFile, File targetFile); ImageProcessor(File imageMagickPath, File sourceFile, File targetFile, boolean checkMagicBytes); ImageProcessor(File sourceFile, File targetFile)... | ImageProcessor { public ImageProcessor quality(double quality) { op.quality(quality); return this; } ImageProcessor(File imageMagickPath, File sourceFile, File targetFile); ImageProcessor(File imageMagickPath, File sourceFile, File targetFile, boolean checkMagicBytes); ImageProcessor(File sourceFile, File targetFile)... | ImageProcessor { public ImageProcessor quality(double quality) { op.quality(quality); return this; } ImageProcessor(File imageMagickPath, File sourceFile, File targetFile); ImageProcessor(File imageMagickPath, File sourceFile, File targetFile, boolean checkMagicBytes); ImageProcessor(File sourceFile, File targetFile)... |
@Test public void test() throws Exception { SiteImpl site = getSite(); PathInfo path = getPath(site, "/health"); DefaultEnvironment env = getEnv(); MockHttpServletResponse resp = new MockHttpServletResponse(); MockHttpServletRequest req = getRequest(ctx); monitoringHandler.handle(req, resp, env, site, path); String res... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, servletRequest)) { String pathsegment = pathInfo... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... | MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthenticated(env, se... |
@Test public void testRedirectToFirstVisibleApplication() throws ServletException, IOException { servletRequest.setSession(session); MockitoAnnotations.initMocks(this); Mockito.when(platformProperties.getString(Platform.Property.VHOST_MODE)) .thenReturn(VHostMode.NAME_BASED.name()); Mockito.when(platformProperties.getS... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo pathInfo) throws ServletException, IOException { Properties platformProperties = environment.getAttribute(Scope.PLATFORM, Platform.Environment.PLATFORM_CONFIG); ClassLoader contextClas... | GuiHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo pathInfo) throws ServletException, IOException { Properties platformProperties = environment.getAttribute(Scope.PLATFORM, Platform.Environment.PL... | GuiHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo pathInfo) throws ServletException, IOException { Properties platformProperties = environment.getAttribute(Scope.PLATFORM, Platform.Environment.PL... | GuiHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo pathInfo) throws ServletException, IOException { Properties platformProperties = environment.getAttribute(Scope.PLATFORM, Platform.Environment.PL... | GuiHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo pathInfo) throws ServletException, IOException { Properties platformProperties = environment.getAttribute(Scope.PLATFORM, Platform.Environment.PL... |
@Test public void testSoap() throws Exception { String servletPath = "/services/site1/appng-demoapplication/soap/personService/personService.wsdl"; setup(servletPath); List<String> emptyList = new ArrayList<>(); PathInfo pathInfo = new PathInfo("localhost", "localhost", "localhost", servletPath, "/ws", "/services", emp... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()) { String siteName = path.getSiteName(); String a... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... |
@Test public void testActionUnsupportedMediaType() throws Exception { String servletPath = "/services/localhost/appng-demoapplication/action/foobar/siteEvent/create"; PathInfo setupPath = setupPath(servletPath); handle(servletRequest, servletResponse, environment, site, setupPath); Assert.assertEquals(HttpStatus.UNSUPP... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()) { String siteName = path.getSiteName(); String a... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... |
@Test public void testWebservice() throws Exception { String servletPath = "/services/localhost/appng-demoapplication/webservice/personService"; PathInfo pathInfo = setupPath(servletPath); handle(servletRequest, servletResponse, environment, site, pathInfo); Assert.assertEquals("Webservice-Call", servletResponse.getCon... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()) { String siteName = path.getSiteName(); String a... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... |
@Test public void testSiteNotStarted() throws Exception { PathInfo pathInfo = setupPath("/services/localhost/foobar"); site.setState(SiteState.STARTING); handle(servletRequest, servletResponse, environment, site, pathInfo); Assert.assertEquals(StringUtils.EMPTY, servletResponse.getContentAsString()); Assert.assertNull(... | public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()) { String siteName = path.getSiteName(); String a... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... | ServiceRequestHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (path.isService()... |
@Test(timeout = 100000) public void test() throws Exception { ClassLoader classLoader = RepositoryWatcherTest.class.getClassLoader(); URL url = classLoader.getResource("repository/manager/www"); String rootDir = FilenameUtils.normalize(new File(url.toURI()).getPath(), true); String urlrewrite = classLoader.getResource(... | void init(Cache<String, CachedResponse> cache, String wwwDir, File configFile, String ruleSourceSuffix, List<String> documentDirs) throws Exception { this.cache = cache; this.watcher = FileSystems.getDefault().newWatchService(); this.wwwDir = FilenameUtils.normalize(wwwDir, true); this.configFile = configFile; this.rul... | RepositoryWatcher implements Runnable { void init(Cache<String, CachedResponse> cache, String wwwDir, File configFile, String ruleSourceSuffix, List<String> documentDirs) throws Exception { this.cache = cache; this.watcher = FileSystems.getDefault().newWatchService(); this.wwwDir = FilenameUtils.normalize(wwwDir, true)... | RepositoryWatcher implements Runnable { void init(Cache<String, CachedResponse> cache, String wwwDir, File configFile, String ruleSourceSuffix, List<String> documentDirs) throws Exception { this.cache = cache; this.watcher = FileSystems.getDefault().newWatchService(); this.wwwDir = FilenameUtils.normalize(wwwDir, true)... | RepositoryWatcher implements Runnable { void init(Cache<String, CachedResponse> cache, String wwwDir, File configFile, String ruleSourceSuffix, List<String> documentDirs) throws Exception { this.cache = cache; this.watcher = FileSystems.getDefault().newWatchService(); this.wwwDir = FilenameUtils.normalize(wwwDir, true)... | RepositoryWatcher implements Runnable { void init(Cache<String, CachedResponse> cache, String wwwDir, File configFile, String ruleSourceSuffix, List<String> documentDirs) throws Exception { this.cache = cache; this.watcher = FileSystems.getDefault().newWatchService(); this.wwwDir = FilenameUtils.normalize(wwwDir, true)... |
@Test public void testPostProcessBeanFactory() { Site site = Mockito.mock(Site.class); Application application = Mockito.mock(Application.class); DatasourceConfigurer datasourceConfigurer = Mockito.mock(DatasourceConfigurer.class); DatabaseConnection databaseConnection = new DatabaseConnection(); ArrayList<String> dict... | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("site", site); beanFactory.registerSingleton("application", application); beanFactory.getBean(ApplicationCacheManager.class).initialize(site, application, platformCacheManager); try { Da... | ApplicationPostProcessor implements BeanFactoryPostProcessor, Ordered { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("site", site); beanFactory.registerSingleton("application", application); beanFactory.getBean(ApplicationCacheMana... | ApplicationPostProcessor implements BeanFactoryPostProcessor, Ordered { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("site", site); beanFactory.registerSingleton("application", application); beanFactory.getBean(ApplicationCacheMana... | ApplicationPostProcessor implements BeanFactoryPostProcessor, Ordered { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("site", site); beanFactory.registerSingleton("application", application); beanFactory.getBean(ApplicationCacheMana... | ApplicationPostProcessor implements BeanFactoryPostProcessor, Ordered { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("site", site); beanFactory.registerSingleton("application", application); beanFactory.getBean(ApplicationCacheMana... |
@Test public void testIsLocked() { SubjectImpl s = new SubjectImpl(); Date now = new Date(); Assert.assertFalse(s.isExpired(now)); s.setExpiryDate(now); Assert.assertFalse(s.isExpired(now)); Assert.assertFalse(s.isExpired(DateUtils.addMinutes(now, -1))); Assert.assertTrue(s.isExpired(DateUtils.addMilliseconds(now, 1)))... | @Column(name = "locked") public boolean isLocked() { return locked; } | SubjectImpl implements Subject, Auditable<Integer> { @Column(name = "locked") public boolean isLocked() { return locked; } } | SubjectImpl implements Subject, Auditable<Integer> { @Column(name = "locked") public boolean isLocked() { return locked; } } | SubjectImpl implements Subject, Auditable<Integer> { @Column(name = "locked") public boolean isLocked() { return locked; } @NotNull(message = ValidationMessages.VALIDATION_NOT_NULL) @Pattern(regexp = ValidationPatterns.USERNAME_OR_LDAPGROUP_PATTERN, message = ValidationPatterns.USERNAME_GROUP_MSSG) @Size(max = Validat... | SubjectImpl implements Subject, Auditable<Integer> { @Column(name = "locked") public boolean isLocked() { return locked; } @NotNull(message = ValidationMessages.VALIDATION_NOT_NULL) @Pattern(regexp = ValidationPatterns.USERNAME_OR_LDAPGROUP_PATTERN, message = ValidationPatterns.USERNAME_GROUP_MSSG) @Size(max = Validat... |
@Test public void testIsInactive() { SubjectImpl s = new SubjectImpl(); Date now = new Date(); s.setLastLogin(now); int inactiveLockPeriod = 10; Assert.assertFalse(s.isInactive(now, inactiveLockPeriod)); Assert.assertFalse(s.isInactive(now, inactiveLockPeriod)); Assert.assertFalse(s.isInactive(now, inactiveLockPeriod))... | @Transient public boolean isInactive(Date now, Integer inactiveLockPeriod) { return null != lastLogin && inactiveLockPeriod > 0 && DateUtils.addDays(lastLogin, inactiveLockPeriod).before(now); } | SubjectImpl implements Subject, Auditable<Integer> { @Transient public boolean isInactive(Date now, Integer inactiveLockPeriod) { return null != lastLogin && inactiveLockPeriod > 0 && DateUtils.addDays(lastLogin, inactiveLockPeriod).before(now); } } | SubjectImpl implements Subject, Auditable<Integer> { @Transient public boolean isInactive(Date now, Integer inactiveLockPeriod) { return null != lastLogin && inactiveLockPeriod > 0 && DateUtils.addDays(lastLogin, inactiveLockPeriod).before(now); } } | SubjectImpl implements Subject, Auditable<Integer> { @Transient public boolean isInactive(Date now, Integer inactiveLockPeriod) { return null != lastLogin && inactiveLockPeriod > 0 && DateUtils.addDays(lastLogin, inactiveLockPeriod).before(now); } @NotNull(message = ValidationMessages.VALIDATION_NOT_NULL) @Pattern(reg... | SubjectImpl implements Subject, Auditable<Integer> { @Transient public boolean isInactive(Date now, Integer inactiveLockPeriod) { return null != lastLogin && inactiveLockPeriod > 0 && DateUtils.addDays(lastLogin, inactiveLockPeriod).before(now); } @NotNull(message = ValidationMessages.VALIDATION_NOT_NULL) @Pattern(reg... |
@Test public void testSizeMax() { assertTrue("sizeMax(foo,4)"); assertFalse("sizeMax(foo,2)"); assertTrue("sizeMax(multifoo,4)"); assertFalse("sizeMax(multifoo,3)"); assertTrue("sizeMax(multibar,3)"); } | public static boolean sizeMax(Object item, int max) { return size(item) <= max; } | RuleValidation { public static boolean sizeMax(Object item, int max) { return size(item) <= max; } } | RuleValidation { public static boolean sizeMax(Object item, int max) { return size(item) <= max; } RuleValidation(Request container); } | RuleValidation { public static boolean sizeMax(Object item, int max) { return size(item) <= max; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean captcha(String... | RuleValidation { public static boolean sizeMax(Object item, int max) { return size(item) <= max; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean captcha(String... |
@Test public void testDetermineType() { PropertyImpl booleanProp = new PropertyImpl("booleanProp", "true"); booleanProp.determineType(); Assert.assertEquals(Property.Type.BOOLEAN, booleanProp.getType()); PropertyImpl intProp = new PropertyImpl("intProp", "5"); intProp.determineType(); Assert.assertEquals(Property.Type.... | @Override @Column(name = "prop_type") @Enumerated(EnumType.STRING) public Type getType() { return super.getType(); } | PropertyImpl extends SimpleProperty implements Property, Auditable<String>, Comparable<Property> { @Override @Column(name = "prop_type") @Enumerated(EnumType.STRING) public Type getType() { return super.getType(); } } | PropertyImpl extends SimpleProperty implements Property, Auditable<String>, Comparable<Property> { @Override @Column(name = "prop_type") @Enumerated(EnumType.STRING) public Type getType() { return super.getType(); } PropertyImpl(); PropertyImpl(String name, String value); PropertyImpl(String name, String value, Strin... | PropertyImpl extends SimpleProperty implements Property, Auditable<String>, Comparable<Property> { @Override @Column(name = "prop_type") @Enumerated(EnumType.STRING) public Type getType() { return super.getType(); } PropertyImpl(); PropertyImpl(String name, String value); PropertyImpl(String name, String value, Strin... | PropertyImpl extends SimpleProperty implements Property, Auditable<String>, Comparable<Property> { @Override @Column(name = "prop_type") @Enumerated(EnumType.STRING) public Type getType() { return super.getType(); } PropertyImpl(); PropertyImpl(String name, String value); PropertyImpl(String name, String value, Strin... |
@Test public void testSiteInternalRedirect() { site.sendRedirect(environment, "page/foo/bar#anchor", HttpServletResponse.SC_MOVED_TEMPORARILY); Assert.assertEquals("/ws/foo/page/foo/bar#anchor", response.getHeader(HttpHeaders.LOCATION)); Assert.assertEquals(HttpServletResponse.SC_MOVED_TEMPORARILY, response.getStatus()... | public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @NotNull(message = ValidationMessages.VALIDAT... | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @NotNull(message = ValidationMessages.VALIDAT... |
@Test public void testSiteInternalRedirectMSIE() { Mockito.when(environment.getAttribute(REQUEST, HttpHeaders.USER_AGENT)).thenReturn("MSIE"); site.sendRedirect(environment, "page/foo/bar#anchor", HttpServletResponse.SC_MOVED_TEMPORARILY); Assert.assertEquals("/ws/foo/page/foo/bar?tab=anchor#anchor", response.getHeader... | public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @NotNull(message = ValidationMessages.VALIDAT... | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @NotNull(message = ValidationMessages.VALIDAT... |
@Test public void testExternalRedirect() { site.sendRedirect(environment, "/some/uri", HttpServletResponse.SC_MOVED_TEMPORARILY); Assert.assertEquals("/some/uri", response.getHeader(HttpHeaders.LOCATION)); Assert.assertEquals(HttpServletResponse.SC_MOVED_TEMPORARILY, response.getStatus()); } | public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } } | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @NotNull(message = ValidationMessages.VALIDAT... | SiteImpl implements Site, Auditable<Integer> { public void sendRedirect(Environment env, String target) { sendRedirect(env, target, HttpServletResponse.SC_MOVED_PERMANENTLY); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @NotNull(message = ValidationMessages.VALIDAT... |
@Test public void testCloseClassloader() throws IOException { site.setSiteApplications(new HashSet<>()); site.closeSiteContext(); try { URLClassLoader.class.getMethod("close"); Assert.assertTrue("siteclassloader should be closed", isClosed); } catch (NoSuchMethodException e) { Assert.assertFalse("siteclassloader should... | private void closeClassloader() { try { siteClassLoader.close(); } catch (IOException e) { LOGGER.error("error while closing classloader", e); } siteClassLoader = null; } | SiteImpl implements Site, Auditable<Integer> { private void closeClassloader() { try { siteClassLoader.close(); } catch (IOException e) { LOGGER.error("error while closing classloader", e); } siteClassLoader = null; } } | SiteImpl implements Site, Auditable<Integer> { private void closeClassloader() { try { siteClassLoader.close(); } catch (IOException e) { LOGGER.error("error while closing classloader", e); } siteClassLoader = null; } } | SiteImpl implements Site, Auditable<Integer> { private void closeClassloader() { try { siteClassLoader.close(); } catch (IOException e) { LOGGER.error("error while closing classloader", e); } siteClassLoader = null; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @Not... | SiteImpl implements Site, Auditable<Integer> { private void closeClassloader() { try { siteClassLoader.close(); } catch (IOException e) { LOGGER.error("error while closing classloader", e); } siteClassLoader = null; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Integer id); @Not... |
@Test public void testDeselectAllOptions() { ResponseEntity<Action> actionEntity = new ResponseEntity<>(new Action(), HttpStatus.OK); ActionField field = getSelectionField(); Option a = getOption("a", true); field.getOptions().getEntries().add(a); Option b = getOption("b", true); field.getOptions().getEntries().add(b);... | public ActionHelper deselectAllOptions(String name) { Optional<ActionField> field = getField(name); if (field.isPresent() && isSelectionType(field.get())) { field.get().getOptions().getEntries().forEach(o -> o.setSelected(false)); } return this; } | ActionHelper { public ActionHelper deselectAllOptions(String name) { Optional<ActionField> field = getField(name); if (field.isPresent() && isSelectionType(field.get())) { field.get().getOptions().getEntries().forEach(o -> o.setSelected(false)); } return this; } } | ActionHelper { public ActionHelper deselectAllOptions(String name) { Optional<ActionField> field = getField(name); if (field.isPresent() && isSelectionType(field.get())) { field.get().getOptions().getEntries().forEach(o -> o.setSelected(false)); } return this; } ActionHelper(ResponseEntity<Action> action); } | ActionHelper { public ActionHelper deselectAllOptions(String name) { Optional<ActionField> field = getField(name); if (field.isPresent() && isSelectionType(field.get())) { field.get().getOptions().getEntries().forEach(o -> o.setSelected(false)); } return this; } ActionHelper(ResponseEntity<Action> action); static Actio... | ActionHelper { public ActionHelper deselectAllOptions(String name) { Optional<ActionField> field = getField(name); if (field.isPresent() && isSelectionType(field.get())) { field.get().getOptions().getEntries().forEach(o -> o.setSelected(false)); } return this; } ActionHelper(ResponseEntity<Action> action); static Actio... |
@Test public void testSetFieldValue() { Action action = new Action(); ResponseEntity<Action> actionEntity = new ResponseEntity<>(action, HttpStatus.OK); ActionField field = new ActionField(); field.setName("field"); field.setFieldType(FieldType.TEXT); action.setFields(new ArrayList<>()); action.getFields().add(field); ... | public ActionHelper setFieldValue(String name, Object value) { Optional<ActionField> field = getField(name); if (field.isPresent() && !isSelectionType(field.get())) { field.get().setValue(value); } return this; } | ActionHelper { public ActionHelper setFieldValue(String name, Object value) { Optional<ActionField> field = getField(name); if (field.isPresent() && !isSelectionType(field.get())) { field.get().setValue(value); } return this; } } | ActionHelper { public ActionHelper setFieldValue(String name, Object value) { Optional<ActionField> field = getField(name); if (field.isPresent() && !isSelectionType(field.get())) { field.get().setValue(value); } return this; } ActionHelper(ResponseEntity<Action> action); } | ActionHelper { public ActionHelper setFieldValue(String name, Object value) { Optional<ActionField> field = getField(name); if (field.isPresent() && !isSelectionType(field.get())) { field.get().setValue(value); } return this; } ActionHelper(ResponseEntity<Action> action); static ActionHelper create(ResponseEntity<Actio... | ActionHelper { public ActionHelper setFieldValue(String name, Object value) { Optional<ActionField> field = getField(name); if (field.isPresent() && !isSelectionType(field.get())) { field.get().setValue(value); } return this; } ActionHelper(ResponseEntity<Action> action); static ActionHelper create(ResponseEntity<Actio... |
@Test public void testCookies() { Map<String, String> cookies = new HashMap<>(); cookies.put("foo", "bar"); cookies.put("lore", "ipsum"); RestClient restClient = new RestClient("foo", cookies); List<String> cookieList = restClient.getHeaders(false).get(HttpHeaders.COOKIE); Assert.assertTrue(cookieList.contains("foo=bar... | protected HttpHeaders getHeaders(boolean acceptAnyType) { HttpHeaders headers = new HttpHeaders(); if (!cookies.isEmpty()) { cookies.keySet().forEach(k -> { String cookie = cookies.get(k); headers.add(HttpHeaders.COOKIE, k + "=" + cookie); LOGGER.debug("sent cookie: {}={}", k, cookies.get(k)); }); } headers.setContentT... | RestClient { protected HttpHeaders getHeaders(boolean acceptAnyType) { HttpHeaders headers = new HttpHeaders(); if (!cookies.isEmpty()) { cookies.keySet().forEach(k -> { String cookie = cookies.get(k); headers.add(HttpHeaders.COOKIE, k + "=" + cookie); LOGGER.debug("sent cookie: {}={}", k, cookies.get(k)); }); } header... | RestClient { protected HttpHeaders getHeaders(boolean acceptAnyType) { HttpHeaders headers = new HttpHeaders(); if (!cookies.isEmpty()) { cookies.keySet().forEach(k -> { String cookie = cookies.get(k); headers.add(HttpHeaders.COOKIE, k + "=" + cookie); LOGGER.debug("sent cookie: {}={}", k, cookies.get(k)); }); } header... | RestClient { protected HttpHeaders getHeaders(boolean acceptAnyType) { HttpHeaders headers = new HttpHeaders(); if (!cookies.isEmpty()) { cookies.keySet().forEach(k -> { String cookie = cookies.get(k); headers.add(HttpHeaders.COOKIE, k + "=" + cookie); LOGGER.debug("sent cookie: {}={}", k, cookies.get(k)); }); } header... | RestClient { protected HttpHeaders getHeaders(boolean acceptAnyType) { HttpHeaders headers = new HttpHeaders(); if (!cookies.isEmpty()) { cookies.keySet().forEach(k -> { String cookie = cookies.get(k); headers.add(HttpHeaders.COOKIE, k + "=" + cookie); LOGGER.debug("sent cookie: {}={}", k, cookies.get(k)); }); } header... |
@Test public void testSetCookies() { RestClient restClient = new RestClient("foo"); HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.SET_COOKIE, "foo=bar"); headers.add(HttpHeaders.SET_COOKIE, "lore=ipsum;"); restClient.setCookies(new ResponseEntity<>(headers, HttpStatus.OK)); Map<String, String> cookie... | protected void setCookies(ResponseEntity<?> entity) { List<String> setCookies = entity.getHeaders().get(HttpHeaders.SET_COOKIE); if (null != setCookies) { for (String c : setCookies) { int valueStart = c.indexOf('='); String name = c.substring(0, valueStart); int end = c.indexOf(';'); String value = c.substring(valueSt... | RestClient { protected void setCookies(ResponseEntity<?> entity) { List<String> setCookies = entity.getHeaders().get(HttpHeaders.SET_COOKIE); if (null != setCookies) { for (String c : setCookies) { int valueStart = c.indexOf('='); String name = c.substring(0, valueStart); int end = c.indexOf(';'); String value = c.subs... | RestClient { protected void setCookies(ResponseEntity<?> entity) { List<String> setCookies = entity.getHeaders().get(HttpHeaders.SET_COOKIE); if (null != setCookies) { for (String c : setCookies) { int valueStart = c.indexOf('='); String name = c.substring(0, valueStart); int end = c.indexOf(';'); String value = c.subs... | RestClient { protected void setCookies(ResponseEntity<?> entity) { List<String> setCookies = entity.getHeaders().get(HttpHeaders.SET_COOKIE); if (null != setCookies) { for (String c : setCookies) { int valueStart = c.indexOf('='); String name = c.substring(0, valueStart); int end = c.indexOf(';'); String value = c.subs... | RestClient { protected void setCookies(ResponseEntity<?> entity) { List<String> setCookies = entity.getHeaders().get(HttpHeaders.SET_COOKIE); if (null != setCookies) { for (String c : setCookies) { int valueStart = c.indexOf('='); String name = c.substring(0, valueStart); int end = c.indexOf(';'); String value = c.subs... |
@Test public void testDataSource() throws URISyntaxException { RestClient restClient = new RestClient("http: protected <IN, OUT> RestResponseEntity<IN> exchange(URI uri, OUT body, HttpMethod method, Class<IN> returnType) { Assert.assertEquals( "http: uri.toString()); return null; } }; MultiValueMap<String, String> para... | public RestResponseEntity<Datasource> datasource(String application, String id) throws URISyntaxException { return datasource(application, id, (Pageable) null); } | RestClient { public RestResponseEntity<Datasource> datasource(String application, String id) throws URISyntaxException { return datasource(application, id, (Pageable) null); } } | RestClient { public RestResponseEntity<Datasource> datasource(String application, String id) throws URISyntaxException { return datasource(application, id, (Pageable) null); } RestClient(String url); RestClient(String url, Map<String, String> cookies); } | RestClient { public RestResponseEntity<Datasource> datasource(String application, String id) throws URISyntaxException { return datasource(application, id, (Pageable) null); } RestClient(String url); RestClient(String url, Map<String, String> cookies); RestResponseEntity<Datasource> datasource(String application, Stri... | RestClient { public RestResponseEntity<Datasource> datasource(String application, String id) throws URISyntaxException { return datasource(application, id, (Pageable) null); } RestClient(String url); RestClient(String url, Map<String, String> cookies); RestResponseEntity<Datasource> datasource(String application, Stri... |
@Test public void testSizeMinMax() { assertTrue("sizeMinMax(foo,1,3)"); assertFalse("sizeMinMax(foo,4,5)"); assertTrue("sizeMinMax(multifoo,1,4)"); assertFalse("sizeMinMax(multifoo,1,3)"); assertFalse("sizeMinMax(multifoo,5,7)"); assertFalse("sizeMinMax(multibar,1,3)"); assertFalse("sizeMinMax(multibar,5,7)"); } | public static boolean sizeMinMax(Object item, int min, int max) { return sizeMax(item, max) && sizeMin(item, min); } | RuleValidation { public static boolean sizeMinMax(Object item, int min, int max) { return sizeMax(item, max) && sizeMin(item, min); } } | RuleValidation { public static boolean sizeMinMax(Object item, int min, int max) { return sizeMax(item, max) && sizeMin(item, min); } RuleValidation(Request container); } | RuleValidation { public static boolean sizeMinMax(Object item, int min, int max) { return sizeMax(item, max) && sizeMin(item, min); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String str... | RuleValidation { public static boolean sizeMinMax(Object item, int min, int max) { return sizeMax(item, max) && sizeMin(item, min); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String str... |
@Test public void testComment() { Assert.assertArrayEquals(new String[0], batch.parseLine("#My first comment")); Assert.assertArrayEquals(new String[0], batch.parseLine("# AnotherOne")); } | protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.put("systemProp", System.getProperties()); Expres... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... |
@Test public void testSysEnvVariables() { OperatingSystem os = OperatingSystem.detect(); String lang = System.getenv("LANG"); LOGGER.info("OS is {} ({}) with LANG {}", os, System.getProperty("os.name"), lang); switch (os) { case LINUX: Assert.assertArrayEquals(new String[0], batch.parseLine("def LANG = ${systemEnv['LAN... | protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.put("systemProp", System.getProperties()); Expres... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... |
@Test public void testCommandParsing() { Assert.assertArrayEquals(new String[0], batch.parseLine("# a comment")); Assert.assertArrayEquals(new String[0], batch.parseLine("def foo = bar")); Assert.assertArrayEquals(new String[0], batch.parseLine("")); Assert.assertArrayEquals(new String[] { "-i", "-f", "-g", "-h" }, bat... | protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.put("systemProp", System.getProperties()); Expres... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... |
@Test public void testCommandVariables() { checkVariables("def DEPLOY = -f", "DEPLOY", "-f"); checkVariables("def MANAGER_APP =appng-manager ", "MANAGER_APP", "appng-manager"); checkVariables("def MANAGER_VERSION = 1.1-SNAPSHOT", "MANAGER_VERSION", "1.1-SNAPSHOT"); checkVariables("def REPOSITORY=\"Local Repository\"", ... | protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.put("systemProp", System.getProperties()); Expres... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... |
@Test public void testCommandUndeclaredVariables() { Assert.assertArrayEquals(new String[] { "foo", "$BAR" }, batch.parseLine("foo $BAR")); Assert.assertArrayEquals( new String[] { "prefix", "$UNDECLARED_VAR", "suffix", "plus", "\"quotes with space\"" }, batch.parseLine("prefix $UNDECLARED_VAR suffix plus 'quotes with ... | protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.put("systemProp", System.getProperties()); Expres... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... |
@Test public void testQuotes() { Assert.assertArrayEquals(new String[] { "\"foo\"", "\"bar\"" }, batch.parseLine("\"foo\" \"bar\"")); Assert.assertArrayEquals(new String[] { "\"foo\"", "further", "parameters" }, batch.parseLine("\"foo\" further parameters")); Assert.assertArrayEquals(new String[] { "\"foo\"", "\"bar\""... | protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.put("systemProp", System.getProperties()); Expres... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... | CommandBatch implements ExecutableCliCommand { protected String[] parseLine(String command) { String[] args = new String[0]; if (command.startsWith(COMMENT_PREFIX) || StringUtils.isBlank(command)) { return args; } Map<String, Object> params = new HashMap<>(variables); params.put("systemEnv", System.getenv()); params.pu... |
@Test(expected = BusinessException.class) public void testInvalid() throws BusinessException { new HashPassword("").execute(cliEnv); } | public void execute(CliEnvironment cle) throws BusinessException { boolean passwordSet = StringUtils.isNotBlank(password); if (!(interactive || passwordSet)) { throw new BusinessException("Either password must be given or -i must be set!"); } if (interactive) { runInteractive(cle); return; } String digest = savePasswor... | HashPassword implements ExecutableCliCommand { public void execute(CliEnvironment cle) throws BusinessException { boolean passwordSet = StringUtils.isNotBlank(password); if (!(interactive || passwordSet)) { throw new BusinessException("Either password must be given or -i must be set!"); } if (interactive) { runInteract... | HashPassword implements ExecutableCliCommand { public void execute(CliEnvironment cle) throws BusinessException { boolean passwordSet = StringUtils.isNotBlank(password); if (!(interactive || passwordSet)) { throw new BusinessException("Either password must be given or -i must be set!"); } if (interactive) { runInteract... | HashPassword implements ExecutableCliCommand { public void execute(CliEnvironment cle) throws BusinessException { boolean passwordSet = StringUtils.isNotBlank(password); if (!(interactive || passwordSet)) { throw new BusinessException("Either password must be given or -i must be set!"); } if (interactive) { runInteract... | HashPassword implements ExecutableCliCommand { public void execute(CliEnvironment cle) throws BusinessException { boolean passwordSet = StringUtils.isNotBlank(password); if (!(interactive || passwordSet)) { throw new BusinessException("Either password must be given or -i must be set!"); } if (interactive) { runInteract... |
@Test public void testAppngHome() { File result = path.getFile(APPNG_ROOT); Mockito.when(cliBootstrapEnvironment.getFileFromEnv(CliBootstrap.APPNG_HOME)).thenReturn(result); Assert.assertEquals(result, CliBootstrap.getPlatformRootPath(cliBootstrapEnvironment)); } | static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); static String CURRENT_COMMAND; static final String APPNG_HOME; } |
@Test public void testAppngHomeUndefined() { try { CliBootstrap.getPlatformRootPath(cliBootstrapEnvironment); Assert.fail("IllegalArgumentException expected, but no exception has been thrown."); } catch (IllegalArgumentException e) { Assert.assertEquals("APPNG_HOME is not defined!", e.getMessage()); } } | static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); static String CURRENT_COMMAND; static final String APPNG_HOME; } |
@Test public void testAppngHomeInvalid() { File result = path.getFile("invalid-path"); Mockito.when(cliBootstrapEnvironment.getFileFromEnv(CliBootstrap.APPNG_HOME)).thenReturn(result); try { CliBootstrap.getPlatformRootPath(cliBootstrapEnvironment); Assert.fail("IllegalArgumentException expected, but no exception has b... | static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); } | CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); static String CURRENT_COMMAND; static final String APPNG_HOME; } |
@Test public void testNumber() { assertFalse("number(foo)"); assertTrue("number(bar)"); } | public static boolean number(String string) { return regExp(string, EXP_NUMBER); } | RuleValidation { public static boolean number(String string) { return regExp(string, EXP_NUMBER); } } | RuleValidation { public static boolean number(String string) { return regExp(string, EXP_NUMBER); } RuleValidation(Request container); } | RuleValidation { public static boolean number(String string) { return regExp(string, EXP_NUMBER); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean captcha(Strin... | RuleValidation { public static boolean number(String string) { return regExp(string, EXP_NUMBER); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean captcha(Strin... |
@Test public void testTabbedEmpty() throws BusinessException { String table = prettyTable.render(true, true); Assert.assertEquals("\nA\tB\tC\n", table); } | public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { String col = column... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... |
@Test public void testTabbed() throws BusinessException { prettyTable.addRow(1, null, 3); String table = prettyTable.render(true, true); Assert.assertEquals("\nA\tB\tC\n1\tnull\t3\n", table); } | static String tabbed(String n) { return n + PrettyTable.TAB; } | PrettyTable { static String tabbed(String n) { return n + PrettyTable.TAB; } } | PrettyTable { static String tabbed(String n) { return n + PrettyTable.TAB; } PrettyTable(); } | PrettyTable { static String tabbed(String n) { return n + PrettyTable.TAB; } PrettyTable(); void addColumn(String name); void addColumn(String name, boolean isVerbose); void addRow(Object... values); String render(boolean tabbedValues, boolean beVerbose); List<TableRow> getRows(); int getColumnIndex(String id); } | PrettyTable { static String tabbed(String n) { return n + PrettyTable.TAB; } PrettyTable(); void addColumn(String name); void addColumn(String name, boolean isVerbose); void addRow(Object... values); String render(boolean tabbedValues, boolean beVerbose); List<TableRow> getRows(); int getColumnIndex(String id); } |
@Test public void testTableEmpty() throws BusinessException, IOException { String table = prettyTable.render(false, true); URL resource = getClass().getClassLoader().getResource("PrettyTableTest-empty.txt"); String expected = FileUtils.readFileToString(new File(resource.getFile()), Charset.defaultCharset()); Assert.ass... | public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { String col = column... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... | PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : columns) { Strin... |
@Test public void testEditPerson() throws ProcessingException, IOException { CallableAction callableAction = getAction("personEvent", "editPerson").withParam(FORM_ACTION, "editPerson") .withParam("id", "1").getCallableAction(new Person(1, "Luke the Duke", "Skywalker")); callableAction.perform(); WritingXmlValidator.val... | @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personId = request.convert(options.getOptionValue("actio... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... |
@Test public void testCreatePerson() throws ProcessingException, IOException { CallableAction callableAction = getAction("personEvent", "createPerson").withParam(FORM_ACTION, "createPerson") .getCallableAction(new Person(null, "Obi Wan", "Kenobi")); callableAction.perform(); WritingXmlValidator.validateXml(callableActi... | @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personId = request.convert(options.getOptionValue("actio... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... | PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { Integer personI... |
@Test public void testUpdateAppNG() throws Exception { target = UpNGizr.appNGHome; Resource resource = getResource("appng-application"); new Updater(new MockServletContext()).updateAppNG(resource, target); assertFolderNotEmpty("WEB-INF"); assertFolderNotEmpty("WEB-INF/classes"); Assert.assertFalse(new File(target, "WEB... | @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpdateRunning.... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... |
@Test public void testUpdateAppNGizer() throws Exception { target = UpNGizr.appNGizerHome; Resource resource = getResource("appng-appngizer"); new Updater(new MockServletContext()).updateAppNGizer(resource, target); assertFolderNotEmpty("WEB-INF"); File metaInf = assertFolderNotEmpty("META-INF"); Assert.assertTrue(new ... | protected void updateAppNGizer(Resource resource, String appNGizerHome) throws RestClientException, IOException { if (!(resource.exists() && new File(appNGizerHome).exists())) { return; } Path warArchive = Files.createTempFile(null, null); try ( FileOutputStream out = new FileOutputStream(warArchive.toFile()); InputStr... | Updater { protected void updateAppNGizer(Resource resource, String appNGizerHome) throws RestClientException, IOException { if (!(resource.exists() && new File(appNGizerHome).exists())) { return; } Path warArchive = Files.createTempFile(null, null); try ( FileOutputStream out = new FileOutputStream(warArchive.toFile())... | Updater { protected void updateAppNGizer(Resource resource, String appNGizerHome) throws RestClientException, IOException { if (!(resource.exists() && new File(appNGizerHome).exists())) { return; } Path warArchive = Files.createTempFile(null, null); try ( FileOutputStream out = new FileOutputStream(warArchive.toFile())... | Updater { protected void updateAppNGizer(Resource resource, String appNGizerHome) throws RestClientException, IOException { if (!(resource.exists() && new File(appNGizerHome).exists())) { return; } Path warArchive = Files.createTempFile(null, null); try ( FileOutputStream out = new FileOutputStream(warArchive.toFile())... | Updater { protected void updateAppNGizer(Resource resource, String appNGizerHome) throws RestClientException, IOException { if (!(resource.exists() && new File(appNGizerHome).exists())) { return; } Path warArchive = Files.createTempFile(null, null); try ( FileOutputStream out = new FileOutputStream(warArchive.toFile())... |
@Test public void testBlockedIP() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); request.setRemoteAddr("foobar.org"); ResponseEntity<String> updated = new Updater(request.getServletContext()).updateAppng("1.17.0", null, request); Assert.assertEquals(HttpStatus.FORBIDDEN, updated.getSt... | @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpdateRunning.... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... | Updater { @RequestMapping(path = "/update/{version:.+}", produces = MediaType.TEXT_PLAIN_VALUE, method = RequestMethod.POST) public ResponseEntity<String> updateAppng(@PathVariable("version") String version, @RequestParam(required = false) String onSuccess, HttpServletRequest request) { if (isBlocked(request) || isUpda... |
@Test public void testCheckVersionAvailable() throws IOException { ResponseEntity<Void> checkVersionAvailable = new Updater(new MockServletContext()) .checkVersionAvailable("1.17.0", new MockHttpServletRequest()); Assert.assertEquals(HttpStatus.OK, checkVersionAvailable.getStatusCode()); } | @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(version, A... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... |
@Test public void testCheckVersionNotAvailable() throws IOException { ResponseEntity<Void> checkVersionAvailable = new Updater(new MockServletContext()) .checkVersionAvailable("0.8.15", new MockHttpServletRequest()); Assert.assertEquals(HttpStatus.NOT_FOUND, checkVersionAvailable.getStatusCode()); } | @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(version, A... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... | Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource = getArtifact(... |
@Test public void testNumberFractionDigits() { assertFalse("numberFractionDigits(foobar,1,1)"); assertFalse("numberFractionDigits(foobar,1,2)"); assertFalse("numberFractionDigits(foobar,2,1)"); assertFalse("numberFractionDigits(foobar,2,2)"); assertFalse("numberFractionDigits(foobar,3,1)"); assertTrue("numberFractionDi... | public static boolean numberFractionDigits(String string, int digits, int fraction) { return number(string, DOT, digits, fraction); } | RuleValidation { public static boolean numberFractionDigits(String string, int digits, int fraction) { return number(string, DOT, digits, fraction); } } | RuleValidation { public static boolean numberFractionDigits(String string, int digits, int fraction) { return number(string, DOT, digits, fraction); } RuleValidation(Request container); } | RuleValidation { public static boolean numberFractionDigits(String string, int digits, int fraction) { return number(string, DOT, digits, fraction); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean ... | RuleValidation { public static boolean numberFractionDigits(String string, int digits, int fraction) { return number(string, DOT, digits, fraction); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean ... |
@Test public void testGetStartPage() throws IOException, URISyntaxException { ResponseEntity<String> startPage = new Updater(new MockServletContext()).getStartPage("1.17.0", "myTarget", new MockHttpServletRequest()); Assert.assertEquals(HttpStatus.OK, startPage.getStatusCode()); List<String> lines = Files.readAllLines(... | @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOException, ... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... |
@Test public void testGetStartPageWithLocalHostName() throws IOException, URISyntaxException { MockServletContext context = new MockServletContext(); context.setInitParameter("useFQDN", "true"); ResponseEntity<String> startPage = new Updater(context).getStartPage("1.17.0", "myTarget", new MockHttpServletRequest()); Ass... | @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOException, ... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... | Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest request) throws IOE... |
@Test public void testParameter() throws IOException, JspException { StringWriter targetWriter = new StringWriter(); Parameter p1 = new Parameter(); p1.setName("param1"); p1.setBodyContent(new MockBodyContent("value1", targetWriter)); p1.setParent(this); p1.doEndTag(); Parameter p2 = new Parameter(); p2.setUnescape(tru... | public Parameter() { } | Parameter extends BodyTagSupport { public Parameter() { } } | Parameter extends BodyTagSupport { public Parameter() { } Parameter(); } | Parameter extends BodyTagSupport { public Parameter() { } Parameter(); @Override int doEndTag(); String getName(); void setName(String name); boolean isUnescape(); void setUnescape(boolean unescape); @Override String toString(); } | Parameter extends BodyTagSupport { public Parameter() { } Parameter(); @Override int doEndTag(); String getName(); void setName(String name); boolean isUnescape(); void setUnescape(boolean unescape); @Override String toString(); } |
@Test(expected = UnsupportedOperationException.class) public void testWriteToUrl() { Attribute attribute = init(Mode.WRITE, Scope.URL); attribute.doStartTag(); } | @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } return SKIP_BODY; } | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... |
@Test(expected = UnsupportedOperationException.class) public void testWriteToSite() { Attribute attribute = init(Mode.WRITE, Scope.SITE); attribute.doStartTag(); } | @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } return SKIP_BODY; } | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... |
@Test(expected = UnsupportedOperationException.class) public void testWriteToPlatform() { Attribute attribute = init(Mode.WRITE, Scope.PLATFORM); attribute.doStartTag(); } | @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } return SKIP_BODY; } | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... | Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue(); break; } r... |
@Test public void test() { MultiSiteSupport multiSiteSupport = new MultiSiteSupport(); String siteName = "localhost"; String applicationName = "application"; MockServletContext servletContext = new MockServletContext(); MockHttpServletRequest request = new MockHttpServletRequest(servletContext); request.setSession(new ... | public void process(Environment env, String application, HttpServletRequest servletRequest) throws JspException { process(env, application, null, servletRequest); } | MultiSiteSupport { public void process(Environment env, String application, HttpServletRequest servletRequest) throws JspException { process(env, application, null, servletRequest); } } | MultiSiteSupport { public void process(Environment env, String application, HttpServletRequest servletRequest) throws JspException { process(env, application, null, servletRequest); } } | MultiSiteSupport { public void process(Environment env, String application, HttpServletRequest servletRequest) throws JspException { process(env, application, null, servletRequest); } void process(Environment env, String application, HttpServletRequest servletRequest); void process(Environment env, String application,... | MultiSiteSupport { public void process(Environment env, String application, HttpServletRequest servletRequest) throws JspException { process(env, application, null, servletRequest); } void process(Environment env, String application, HttpServletRequest servletRequest); void process(Environment env, String application,... |
@Test public void test() throws JspException { PageContext pageContext = AttributeTest.setupTagletTest(); DefaultEnvironment environment = DefaultEnvironment.get(pageContext); environment.setSubject(new SubjectImpl()); final MultiSiteSupport mock = Mockito.mock(MultiSiteSupport.class); ApplicationProvider app = Mockito... | @Override public int doStartTag() throws JspException { try { Environment env = DefaultEnvironment.get(pageContext); HttpServletRequest servletRequest = (HttpServletRequest) pageContext.getRequest(); MultiSiteSupport multiSiteSupport = processMultiSiteSupport(env, servletRequest); SiteImpl executingSite = multiSiteSupp... | Permission extends TagSupport { @Override public int doStartTag() throws JspException { try { Environment env = DefaultEnvironment.get(pageContext); HttpServletRequest servletRequest = (HttpServletRequest) pageContext.getRequest(); MultiSiteSupport multiSiteSupport = processMultiSiteSupport(env, servletRequest); SiteIm... | Permission extends TagSupport { @Override public int doStartTag() throws JspException { try { Environment env = DefaultEnvironment.get(pageContext); HttpServletRequest servletRequest = (HttpServletRequest) pageContext.getRequest(); MultiSiteSupport multiSiteSupport = processMultiSiteSupport(env, servletRequest); SiteIm... | Permission extends TagSupport { @Override public int doStartTag() throws JspException { try { Environment env = DefaultEnvironment.get(pageContext); HttpServletRequest servletRequest = (HttpServletRequest) pageContext.getRequest(); MultiSiteSupport multiSiteSupport = processMultiSiteSupport(env, servletRequest); SiteIm... | Permission extends TagSupport { @Override public int doStartTag() throws JspException { try { Environment env = DefaultEnvironment.get(pageContext); HttpServletRequest servletRequest = (HttpServletRequest) pageContext.getRequest(); MultiSiteSupport multiSiteSupport = processMultiSiteSupport(env, servletRequest); SiteIm... |
@Test public void testTaglet() throws Exception { Mockito.when(taglet.processTaglet(site, application, request, tagletAttributes)).thenReturn("a taglet"); Mockito.when(application.getBean("taglet", Taglet.class)).thenReturn(taglet); boolean processPage = tagletProcessor.perform(site, site, application, tagletAttributes... | public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessException { boolean pr... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... |
@Test public void testGlobalTaglet() throws Exception { Mockito.when(globalTaglet.processTaglet(site, site, application, request, tagletAttributes)) .thenReturn("a global taglet"); Mockito.when(application.getBean("taglet", Taglet.class)).thenReturn(globalTaglet); boolean processPage = tagletProcessor.perform(site, sit... | public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessException { boolean pr... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... |
@Test public void testReplaceInFile() throws Exception { ClassLoader classLoader = ApplicationStartupTest.class.getClassLoader(); File original = new File(classLoader.getResource("xml/sourceConfig.xml").toURI()); File copy = new File("src/test/resources/xml/copyConfig.xml"); File replacementSource = new File(classLoade... | protected static void replaceInFile(File file, String search, String replacement) throws IOException { Path path = file.toPath(); Charset charset = StandardCharsets.UTF_8; String content = new String(Files.readAllBytes(path), charset); content = content.replaceAll(Pattern.quote(search), Matcher.quoteReplacement(replace... | ApplicationStartup { protected static void replaceInFile(File file, String search, String replacement) throws IOException { Path path = file.toPath(); Charset charset = StandardCharsets.UTF_8; String content = new String(Files.readAllBytes(path), charset); content = content.replaceAll(Pattern.quote(search), Matcher.quo... | ApplicationStartup { protected static void replaceInFile(File file, String search, String replacement) throws IOException { Path path = file.toPath(); Charset charset = StandardCharsets.UTF_8; String content = new String(Files.readAllBytes(path), charset); content = content.replaceAll(Pattern.quote(search), Matcher.quo... | ApplicationStartup { protected static void replaceInFile(File file, String search, String replacement) throws IOException { Path path = file.toPath(); Charset charset = StandardCharsets.UTF_8; String content = new String(Files.readAllBytes(path), charset); content = content.replaceAll(Pattern.quote(search), Matcher.quo... | ApplicationStartup { protected static void replaceInFile(File file, String search, String replacement) throws IOException { Path path = file.toPath(); Charset charset = StandardCharsets.UTF_8; String content = new String(Files.readAllBytes(path), charset); content = content.replaceAll(Pattern.quote(search), Matcher.quo... |
@Test public void testPageProcessor() throws Exception { Taglet myTaglet = Mockito.spy(new MyTaglet()); Mockito.when(application.getBean("taglet", Taglet.class)).thenReturn(myTaglet); boolean processPage = tagletProcessor.perform(site, site, application, tagletAttributes, request, "taglet", "", writer); Assert.assertFa... | public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessException { boolean pr... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... | TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException, BusinessExce... |
@Test public void test() throws Exception { differenceListener.ignoreDifference("/properties/property/description/text()"); Site created = new Site(); created.setName("localhost"); created.setHost("localhost"); created.setDomain("http: created.setDescription("none"); created.setActive(false); created.setCreateRepositor... | @GetMapping(value = "/site/{site}/property/{prop}") public ResponseEntity<Property> getProperty(@PathVariable("site") String site, @PathVariable("prop") String prop) { SiteImpl siteByName = getSiteByName(site); if (null == siteByName) { return notFound(); } return getPropertyResponse(prop, siteByName, null); } | SitePropertyController extends PropertyBase { @GetMapping(value = "/site/{site}/property/{prop}") public ResponseEntity<Property> getProperty(@PathVariable("site") String site, @PathVariable("prop") String prop) { SiteImpl siteByName = getSiteByName(site); if (null == siteByName) { return notFound(); } return getProper... | SitePropertyController extends PropertyBase { @GetMapping(value = "/site/{site}/property/{prop}") public ResponseEntity<Property> getProperty(@PathVariable("site") String site, @PathVariable("prop") String prop) { SiteImpl siteByName = getSiteByName(site); if (null == siteByName) { return notFound(); } return getProper... | SitePropertyController extends PropertyBase { @GetMapping(value = "/site/{site}/property/{prop}") public ResponseEntity<Property> getProperty(@PathVariable("site") String site, @PathVariable("prop") String prop) { SiteImpl siteByName = getSiteByName(site); if (null == siteByName) { return notFound(); } return getProper... | SitePropertyController extends PropertyBase { @GetMapping(value = "/site/{site}/property/{prop}") public ResponseEntity<Property> getProperty(@PathVariable("site") String site, @PathVariable("prop") String prop) { SiteImpl siteByName = getSiteByName(site); if (null == siteByName) { return notFound(); } return getProper... |
@Test public void testInitialize() throws Exception { ignorePasswordAndInstalledDate(); postAndVerify("/platform/database/initialize", "xml/database-init.xml", null, HttpStatus.OK); } | @PostMapping(value = "/platform/database/initialize") public ResponseEntity<Database> initialize( @RequestParam(name = "managed", required = false, defaultValue = "false") boolean isManaged) throws Exception { DatabaseConnection platformConnection = databaseService.initDatabase(configurer.getProps(), isManaged, true); ... | DatabaseController extends ControllerBase { @PostMapping(value = "/platform/database/initialize") public ResponseEntity<Database> initialize( @RequestParam(name = "managed", required = false, defaultValue = "false") boolean isManaged) throws Exception { DatabaseConnection platformConnection = databaseService.initDataba... | DatabaseController extends ControllerBase { @PostMapping(value = "/platform/database/initialize") public ResponseEntity<Database> initialize( @RequestParam(name = "managed", required = false, defaultValue = "false") boolean isManaged) throws Exception { DatabaseConnection platformConnection = databaseService.initDataba... | DatabaseController extends ControllerBase { @PostMapping(value = "/platform/database/initialize") public ResponseEntity<Database> initialize( @RequestParam(name = "managed", required = false, defaultValue = "false") boolean isManaged) throws Exception { DatabaseConnection platformConnection = databaseService.initDataba... | DatabaseController extends ControllerBase { @PostMapping(value = "/platform/database/initialize") public ResponseEntity<Database> initialize( @RequestParam(name = "managed", required = false, defaultValue = "false") boolean isManaged) throws Exception { DatabaseConnection platformConnection = databaseService.initDataba... |
@Test public void testEncode() { Assert.assertEquals("name%20with%20spaces", AppNGizer.encode("name with spaces")); } | static String encode(String segment) { try { return UriUtils.encodePathSegment(segment, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return segment; } } | AppNGizer implements AppNGizerClient { static String encode(String segment) { try { return UriUtils.encodePathSegment(segment, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return segment; } } } | AppNGizer implements AppNGizerClient { static String encode(String segment) { try { return UriUtils.encodePathSegment(segment, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return segment; } } AppNGizer(String endpoint, String sharedSecret); } | AppNGizer implements AppNGizerClient { static String encode(String segment) { try { return UriUtils.encodePathSegment(segment, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return segment; } } AppNGizer(String endpoint, String sharedSecret); Home welcome(); Home login(); Subjects subjects()... | AppNGizer implements AppNGizerClient { static String encode(String segment) { try { return UriUtils.encodePathSegment(segment, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return segment; } } AppNGizer(String endpoint, String sharedSecret); Home welcome(); Home login(); Subjects subjects()... |
@Ignore("Run locally") @Test(expected = HttpClientErrorException.class) public void testUploadPackage() throws Exception { getAppNGizer().uploadPackage("local", new File("pom.xml")); } | public Package uploadPackage(String name, File archive) throws IOException { MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); multipartRequest.add("file", new FileSystemResource(archive)); HttpHeaders headers = getHeaders(); headers.setContentType(MediaType.MULTIPART_FORM_DATA); return exch... | AppNGizer implements AppNGizerClient { public Package uploadPackage(String name, File archive) throws IOException { MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); multipartRequest.add("file", new FileSystemResource(archive)); HttpHeaders headers = getHeaders(); headers.setContentType(Medi... | AppNGizer implements AppNGizerClient { public Package uploadPackage(String name, File archive) throws IOException { MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); multipartRequest.add("file", new FileSystemResource(archive)); HttpHeaders headers = getHeaders(); headers.setContentType(Medi... | AppNGizer implements AppNGizerClient { public Package uploadPackage(String name, File archive) throws IOException { MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); multipartRequest.add("file", new FileSystemResource(archive)); HttpHeaders headers = getHeaders(); headers.setContentType(Medi... | AppNGizer implements AppNGizerClient { public Package uploadPackage(String name, File archive) throws IOException { MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); multipartRequest.add("file", new FileSystemResource(archive)); HttpHeaders headers = getHeaders(); headers.setContentType(Medi... |
@Test public void testStyleSheetProvider() throws Exception { ClassLoader classLoader = getClass().getClassLoader(); ssProvider.setName("container"); ssProvider.setInsertBefore("include-4.xsl"); addStyleSheet("include-1.xsl"); addStyleSheet("include-2.xsl"); addStyleSheet("include-3.xsl"); File expected = new File(clas... | public StyleSheetProvider() { } | StyleSheetProvider { public StyleSheetProvider() { } } | StyleSheetProvider { public StyleSheetProvider() { } StyleSheetProvider(); } | StyleSheetProvider { public StyleSheetProvider() { } StyleSheetProvider(); void init(); void setMasterSource(InputStream masterXsl, String templateRoot); void addStyleSheet(InputStream styleSheet, String reference); byte[] getStyleSheet(boolean deleteIncludes); byte[] getStyleSheet(boolean deleteIncludes, OutputStream ... | StyleSheetProvider { public StyleSheetProvider() { } StyleSheetProvider(); void init(); void setMasterSource(InputStream masterXsl, String templateRoot); void addStyleSheet(InputStream styleSheet, String reference); byte[] getStyleSheet(boolean deleteIncludes); byte[] getStyleSheet(boolean deleteIncludes, OutputStream ... |
@Test public void test() throws Exception { String outFile = "src/test/resources/xml/application.xml"; ApplicationPropertyConstantCreator .main(new String[] { outFile, "org.appng.xml.ApplicationProperty", "target/tmp", "PROP_" }); String actual = FileUtils.readFileToString(new File("target/tmp/org/appng/xml/Application... | public static void main(String[] args) throws IOException, JAXBException { if (args.length < 3) { throw new IllegalArgumentException("need 3 params (filePath, targetClass, outFolder)"); } String filePath = args[0]; String targetClass = args[1]; String outfolder = args[2]; String prefix = args.length == 4 ? args[3] : ""... | ApplicationPropertyConstantCreator { public static void main(String[] args) throws IOException, JAXBException { if (args.length < 3) { throw new IllegalArgumentException("need 3 params (filePath, targetClass, outFolder)"); } String filePath = args[0]; String targetClass = args[1]; String outfolder = args[2]; String pre... | ApplicationPropertyConstantCreator { public static void main(String[] args) throws IOException, JAXBException { if (args.length < 3) { throw new IllegalArgumentException("need 3 params (filePath, targetClass, outFolder)"); } String filePath = args[0]; String targetClass = args[1]; String outfolder = args[2]; String pre... | ApplicationPropertyConstantCreator { public static void main(String[] args) throws IOException, JAXBException { if (args.length < 3) { throw new IllegalArgumentException("need 3 params (filePath, targetClass, outFolder)"); } String filePath = args[0]; String targetClass = args[1]; String outfolder = args[2]; String pre... | ApplicationPropertyConstantCreator { public static void main(String[] args) throws IOException, JAXBException { if (args.length < 3) { throw new IllegalArgumentException("need 3 params (filePath, targetClass, outFolder)"); } String filePath = args[0]; String targetClass = args[1]; String outfolder = args[2]; String pre... |
@Test public void testFile() throws Exception { Map<String, StringBuilder> parsed = parseTags.parse(new File("pages/en/42.jsp")); Assert.assertEquals("The Hitchhiker's Guide to the Galaxy", parsed.get("title").toString()); String contents = parsed.get("contents").toString(); String expected = "The Hitchhiker's Guide to... | public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ArrayList<>(... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... |
@Test public void testNestedTags() throws Exception { String in = "<a:searchable index=\"true\" field=\"contents\">" + "<a:searchable index=\"true\" field=\"field1\"> A </a:searchable>" + "<a:searchable index=\"true\" field=\"field2\"> B </a:searchable>" + "<a:searchable index=\"false\"> C </a:searchable>" + " D </a:se... | public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ArrayList<>(... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... |
@Test public void testNotIndexed() throws Exception { String in = "<html><head></head><appNG:searchable index=\"false\">" + "<appNG:searchable index=\"true\" field=\"field1\"> A </appNG:searchable>" + "<appNG:searchable index=\"true\" field=\"field2\"> B </appNG:searchable>" + "<appNG:searchable index=\"false\"> C </ap... | public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ArrayList<>(... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... | ParseTags { public Map<String, StringBuilder> parse(InputStream is) throws IOException { try (InputStream inner = is) { Map<String, StringBuilder> fieldMap = new HashMap<>(); Document doc = Jsoup.parse(inner, null, ""); Elements searchables = doc.getElementsByTag(tagPrefix + ":" + SEARCHABLE); List<Node> skipped = new ... |
@Test public void testGetString() throws IOException { Assert.assertEquals("abcd", processor.getString("/root/a/string")); Assert.assertEquals("abcd", processor.getString(processor.getNode("/root/a"), "string")); } | public String getString(String xpathExpression) { return (String) evaluate(document, xpathExpression, XPathConstants.STRING); } | XPathProcessor { public String getString(String xpathExpression) { return (String) evaluate(document, xpathExpression, XPathConstants.STRING); } } | XPathProcessor { public String getString(String xpathExpression) { return (String) evaluate(document, xpathExpression, XPathConstants.STRING); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public String getString(String xpathExpression) { return (String) evaluate(document, xpathExpression, XPathConstants.STRING); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); ... | XPathProcessor { public String getString(String xpathExpression) { return (String) evaluate(document, xpathExpression, XPathConstants.STRING); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); ... |
@Test public void testGetBoolean() throws IOException { Assert.assertEquals(Boolean.TRUE, processor.getBoolean("/root/a/boolean")); Assert.assertEquals(Boolean.TRUE, processor.getBoolean(processor.getNode("/root/a"), "boolean")); } | public Boolean getBoolean(String xpathExpression) { return (Boolean) evaluate(document, xpathExpression, XPathConstants.BOOLEAN); } | XPathProcessor { public Boolean getBoolean(String xpathExpression) { return (Boolean) evaluate(document, xpathExpression, XPathConstants.BOOLEAN); } } | XPathProcessor { public Boolean getBoolean(String xpathExpression) { return (Boolean) evaluate(document, xpathExpression, XPathConstants.BOOLEAN); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public Boolean getBoolean(String xpathExpression) { return (Boolean) evaluate(document, xpathExpression, XPathConstants.BOOLEAN); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespac... | XPathProcessor { public Boolean getBoolean(String xpathExpression) { return (Boolean) evaluate(document, xpathExpression, XPathConstants.BOOLEAN); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespac... |
@Test public void testGetNumber() throws IOException { Assert.assertEquals(3.45d, processor.getNumber("/root/a/double")); Assert.assertEquals(3.45d, processor.getNumber(processor.getNode("/root/a"), "double")); } | public Number getNumber(String xpathExpression) { return (Number) evaluate(document, xpathExpression, XPathConstants.NUMBER); } | XPathProcessor { public Number getNumber(String xpathExpression) { return (Number) evaluate(document, xpathExpression, XPathConstants.NUMBER); } } | XPathProcessor { public Number getNumber(String xpathExpression) { return (Number) evaluate(document, xpathExpression, XPathConstants.NUMBER); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public Number getNumber(String xpathExpression) { return (Number) evaluate(document, xpathExpression, XPathConstants.NUMBER); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); ... | XPathProcessor { public Number getNumber(String xpathExpression) { return (Number) evaluate(document, xpathExpression, XPathConstants.NUMBER); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); ... |
@Test public void testGetXml() { Node node = processor.getNode("/root/b"); String xml = processor.getXml(node); ByteArrayOutputStream out = new ByteArrayOutputStream(); processor.getXml(node, out); Assert.assertEquals(xml, out.toString()); } | public String getXml(Node node) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); getXml(node, outputStream); return new String(outputStream.toByteArray()); } | XPathProcessor { public String getXml(Node node) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); getXml(node, outputStream); return new String(outputStream.toByteArray()); } } | XPathProcessor { public String getXml(Node node) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); getXml(node, outputStream); return new String(outputStream.toByteArray()); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public String getXml(Node node) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); getXml(node, outputStream); return new String(outputStream.toByteArray()); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); voi... | XPathProcessor { public String getXml(Node node) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); getXml(node, outputStream); return new String(outputStream.toByteArray()); } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); voi... |
@Test public void testNewText() { Text text = processor.newText("data"); Assert.assertEquals("data", text.getData()); } | public Text newText(String tagName) { Text text = document.createTextNode(tagName); return text; } | XPathProcessor { public Text newText(String tagName) { Text text = document.createTextNode(tagName); return text; } } | XPathProcessor { public Text newText(String tagName) { Text text = document.createTextNode(tagName); return text; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public Text newText(String tagName) { Text text = document.createTextNode(tagName); return text; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); String getXml(Node node); voi... | XPathProcessor { public Text newText(String tagName) { Text text = document.createTextNode(tagName); return text; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); String getXml(Node node); voi... |
@Test public void testFitToHeight() throws IOException { File targetFile = new File(targetFolder, "desert-height-100.jpg"); ImageProcessor ip = getSource(targetFile); ip.fitToHeight(100); ImageMetaData metaData = new ImageProcessor(ip.getImage(), null, true).getMetaData(); assertDimensions(133, 100, metaData); } | public ImageProcessor fitToHeight(Integer maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); if (height > maxHeight) { height = maxHeight; width = Math.round(((float) maxHeight / height) * width); } return resize(width, height); } | ImageProcessor { public ImageProcessor fitToHeight(Integer maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); if (height > maxHeight) { height = maxHeight; width = Math.round(((float) maxHeight / height) * width); } return resize(w... | ImageProcessor { public ImageProcessor fitToHeight(Integer maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); if (height > maxHeight) { height = maxHeight; width = Math.round(((float) maxHeight / height) * width); } return resize(w... | ImageProcessor { public ImageProcessor fitToHeight(Integer maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); if (height > maxHeight) { height = maxHeight; width = Math.round(((float) maxHeight / height) * width); } return resize(w... | ImageProcessor { public ImageProcessor fitToHeight(Integer maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); if (height > maxHeight) { height = maxHeight; width = Math.round(((float) maxHeight / height) * width); } return resize(w... |
@Test public void testNewCDATA() { Text text = processor.newCDATA("data"); Assert.assertEquals("data", text.getData()); } | public CDATASection newCDATA(String tagName) { CDATASection cdata = document.createCDATASection(tagName); return cdata; } | XPathProcessor { public CDATASection newCDATA(String tagName) { CDATASection cdata = document.createCDATASection(tagName); return cdata; } } | XPathProcessor { public CDATASection newCDATA(String tagName) { CDATASection cdata = document.createCDATASection(tagName); return cdata; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public CDATASection newCDATA(String tagName) { CDATASection cdata = document.createCDATASection(tagName); return cdata; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); String... | XPathProcessor { public CDATASection newCDATA(String tagName) { CDATASection cdata = document.createCDATASection(tagName); return cdata; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); String... |
@Test public void testNewElement() { Element el = processor.newElement("data"); Assert.assertEquals("data", el.getTagName()); } | public Element newElement(String tagName) { Element element = document.createElement(tagName); return element; } | XPathProcessor { public Element newElement(String tagName) { Element element = document.createElement(tagName); return element; } } | XPathProcessor { public Element newElement(String tagName) { Element element = document.createElement(tagName); return element; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public Element newElement(String tagName) { Element element = document.createElement(tagName); return element; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); String getXml(N... | XPathProcessor { public Element newElement(String tagName) { Element element = document.createElement(tagName); return element; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String prefix, String namespace); String getXml(N... |
@Test public void testNewAttribute() { Attr attr = processor.newAttribute("name", "value"); Assert.assertEquals("name", attr.getName()); Assert.assertEquals("value", attr.getValue()); } | public Attr newAttribute(String name, String value) { Attr attribute = document.createAttribute(name); attribute.setNodeValue(value); return attribute; } | XPathProcessor { public Attr newAttribute(String name, String value) { Attr attribute = document.createAttribute(name); attribute.setNodeValue(value); return attribute; } } | XPathProcessor { public Attr newAttribute(String name, String value) { Attr attribute = document.createAttribute(name); attribute.setNodeValue(value); return attribute; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); } | XPathProcessor { public Attr newAttribute(String name, String value) { Attr attribute = document.createAttribute(name); attribute.setNodeValue(value); return attribute; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String p... | XPathProcessor { public Attr newAttribute(String name, String value) { Attr attribute = document.createAttribute(name); attribute.setNodeValue(value); return attribute; } XPathProcessor(String url); XPathProcessor(URL url); XPathProcessor(InputStream is); XPathProcessor(Document document); void setNamespace(String p... |
@Test public void doTest() { MockitoAnnotations.initMocks(this); Map<String, List<String>> paramters = new HashMap<>(); paramters.put(NAME, Arrays.asList("Doe")); paramters.put(INTEGER_LIST, Arrays.asList("1", "2", "3")); paramters.put(BIRTH_DATE, Arrays.asList("14.05.1944")); Mockito.when(request.getParameterNames()).... | @SuppressWarnings("unchecked") public T bind() { MutablePropertyValues mpvs = new MutablePropertyValues(); for (String name : request.getParameterNames()) { addValue(mpvs, name, request.getParameterList(name)); } for (String name : request.getFormUploads().keySet()) { addValue(mpvs, name, request.getFormUploads(name));... | RequestDataBinder extends DataBinder { @SuppressWarnings("unchecked") public T bind() { MutablePropertyValues mpvs = new MutablePropertyValues(); for (String name : request.getParameterNames()) { addValue(mpvs, name, request.getParameterList(name)); } for (String name : request.getFormUploads().keySet()) { addValue(mpv... | RequestDataBinder extends DataBinder { @SuppressWarnings("unchecked") public T bind() { MutablePropertyValues mpvs = new MutablePropertyValues(); for (String name : request.getParameterNames()) { addValue(mpvs, name, request.getParameterList(name)); } for (String name : request.getFormUploads().keySet()) { addValue(mpv... | RequestDataBinder extends DataBinder { @SuppressWarnings("unchecked") public T bind() { MutablePropertyValues mpvs = new MutablePropertyValues(); for (String name : request.getParameterNames()) { addValue(mpvs, name, request.getParameterList(name)); } for (String name : request.getFormUploads().keySet()) { addValue(mpv... | RequestDataBinder extends DataBinder { @SuppressWarnings("unchecked") public T bind() { MutablePropertyValues mpvs = new MutablePropertyValues(); for (String name : request.getParameterNames()) { addValue(mpvs, name, request.getParameterList(name)); } for (String name : request.getFormUploads().keySet()) { addValue(mpv... |
@Test public void testSetItem() { dataContainer.setItem(persons.get(0)); Assert.assertEquals(fieldProcessor, dataContainer.getFieldProcessor()); Assert.assertEquals(persons.get(0), dataContainer.getItem()); Assert.assertNull(dataContainer.getPageable()); Assert.assertNull(dataContainer.getPage()); Assert.assertTrue(dat... | public void setItem(Object item) { this.item = item; setSingleResult(true); initItem(); } | DataContainer { public void setItem(Object item) { this.item = item; setSingleResult(true); initItem(); } } | DataContainer { public void setItem(Object item) { this.item = item; setSingleResult(true); initItem(); } DataContainer(final FieldProcessor fieldProcessor); } | DataContainer { public void setItem(Object item) { this.item = item; setSingleResult(true); initItem(); } DataContainer(final FieldProcessor fieldProcessor); Object getItem(); void setItem(Object item); boolean isSingleResult(); Collection<?> getItems(); void setItems(Collection<?> items); void setPage(Collection<?> it... | DataContainer { public void setItem(Object item) { this.item = item; setSingleResult(true); initItem(); } DataContainer(final FieldProcessor fieldProcessor); Object getItem(); void setItem(Object item); boolean isSingleResult(); Collection<?> getItems(); void setItems(Collection<?> items); void setPage(Collection<?> it... |
@Test public void testSetPage() { dataContainer.setPage(page); Assert.assertNull(dataContainer.getPageable()); Assert.assertEquals(page, dataContainer.getPage()); Assert.assertFalse(dataContainer.isSingleResult()); Assert.assertNull(dataContainer.getItems()); Assert.assertNull(dataContainer.getWrappedData().isPaginate(... | public void setPage(Collection<?> items, Pageable pageable) { setPage(items, pageable, false); } | DataContainer { public void setPage(Collection<?> items, Pageable pageable) { setPage(items, pageable, false); } } | DataContainer { public void setPage(Collection<?> items, Pageable pageable) { setPage(items, pageable, false); } DataContainer(final FieldProcessor fieldProcessor); } | DataContainer { public void setPage(Collection<?> items, Pageable pageable) { setPage(items, pageable, false); } DataContainer(final FieldProcessor fieldProcessor); Object getItem(); void setItem(Object item); boolean isSingleResult(); Collection<?> getItems(); void setItems(Collection<?> items); void setPage(Collectio... | DataContainer { public void setPage(Collection<?> items, Pageable pageable) { setPage(items, pageable, false); } DataContainer(final FieldProcessor fieldProcessor); Object getItem(); void setItem(Object item); boolean isSingleResult(); Collection<?> getItems(); void setItems(Collection<?> items); void setPage(Collectio... |
@Test public void testSetItems() { dataContainer.setItems(persons); Assert.assertNull(dataContainer.getPageable()); Assert.assertNull(dataContainer.getPage()); Assert.assertFalse(dataContainer.isSingleResult()); Assert.assertEquals(persons, dataContainer.getItems()); Assert.assertFalse(dataContainer.getWrappedData().is... | public void setItems(Collection<?> items) { this.items = items; setSingleResult(false); initItems(items); setPageable(null); } | DataContainer { public void setItems(Collection<?> items) { this.items = items; setSingleResult(false); initItems(items); setPageable(null); } } | DataContainer { public void setItems(Collection<?> items) { this.items = items; setSingleResult(false); initItems(items); setPageable(null); } DataContainer(final FieldProcessor fieldProcessor); } | DataContainer { public void setItems(Collection<?> items) { this.items = items; setSingleResult(false); initItems(items); setPageable(null); } DataContainer(final FieldProcessor fieldProcessor); Object getItem(); void setItem(Object item); boolean isSingleResult(); Collection<?> getItems(); void setItems(Collection<?> ... | DataContainer { public void setItems(Collection<?> items) { this.items = items; setSingleResult(false); initItems(items); setPageable(null); } DataContainer(final FieldProcessor fieldProcessor); Object getItem(); void setItem(Object item); boolean isSingleResult(); Collection<?> getItems(); void setItems(Collection<?> ... |
@Test public void testMd5Digest() { String md5Digest = AuthTools.getMd5Digest(testPattern); Assert.assertEquals("7C2AD50DBEA658E2F87DDE1609114237", md5Digest); } | public static String getMd5Digest(String input) { return getDigest(input, MessageDigestAlgorithms.MD5); } | AuthTools { public static String getMd5Digest(String input) { return getDigest(input, MessageDigestAlgorithms.MD5); } } | AuthTools { public static String getMd5Digest(String input) { return getDigest(input, MessageDigestAlgorithms.MD5); } private AuthTools(); } | AuthTools { public static String getMd5Digest(String input) { return getDigest(input, MessageDigestAlgorithms.MD5); } private AuthTools(); static byte[] base64ToByte(String data); static String byteToBase64(byte[] data); static String getRandomSalt(int length); static String getMd5Digest(String input); static String g... | AuthTools { public static String getMd5Digest(String input) { return getDigest(input, MessageDigestAlgorithms.MD5); } private AuthTools(); static byte[] base64ToByte(String data); static String byteToBase64(byte[] data); static String getRandomSalt(int length); static String getMd5Digest(String input); static String g... |
@Test public void testSha1Digest() { String sha1Digest = AuthTools.getSha1Digest(testPattern); Assert.assertEquals("746BDF044C80DD81336A522BF27D8C661947D3EF", sha1Digest); } | public static String getSha1Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_1); } | AuthTools { public static String getSha1Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_1); } } | AuthTools { public static String getSha1Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_1); } private AuthTools(); } | AuthTools { public static String getSha1Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_1); } private AuthTools(); static byte[] base64ToByte(String data); static String byteToBase64(byte[] data); static String getRandomSalt(int length); static String getMd5Digest(String input); static Strin... | AuthTools { public static String getSha1Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_1); } private AuthTools(); static byte[] base64ToByte(String data); static String byteToBase64(byte[] data); static String getRandomSalt(int length); static String getMd5Digest(String input); static Strin... |
@Test public void testSha512Digest() { String sha512Digest = AuthTools.getSha512Digest(testPattern); Assert.assertEquals( "AB9D85DC074D06B675DAEE7FA4A70C7D0BD8F9A284713DAA0E5689DAA9367DD10258E331D3494053B4F5A1084D7881455DB5AADB84BDFAF5638677ED1D1C4881", sha512Digest); } | public static String getSha512Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_512); } | AuthTools { public static String getSha512Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_512); } } | AuthTools { public static String getSha512Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_512); } private AuthTools(); } | AuthTools { public static String getSha512Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_512); } private AuthTools(); static byte[] base64ToByte(String data); static String byteToBase64(byte[] data); static String getRandomSalt(int length); static String getMd5Digest(String input); static S... | AuthTools { public static String getSha512Digest(String input) { return getDigest(input, MessageDigestAlgorithms.SHA_512); } private AuthTools(); static byte[] base64ToByte(String data); static String byteToBase64(byte[] data); static String getRandomSalt(int length); static String getMd5Digest(String input); static S... |
@Test public void testFitToWidthAndHeight() throws IOException { ImageProcessor ip = getSource(new File(targetFolder, "desert-512x384.jpg")); ip.fitToWidthAndHeight(512, 512); ImageMetaData metaData = new ImageProcessor(ip.getImage(), null, true).getMetaData(); assertDimensions(512, 384, metaData); } | public ImageProcessor fitToWidthAndHeight(int maxwidth, int maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); float ratioWidth = (float) maxwidth / width; float ratioHeight = (float) maxHeight / height; float ratio = Math.min(rati... | ImageProcessor { public ImageProcessor fitToWidthAndHeight(int maxwidth, int maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); float ratioWidth = (float) maxwidth / width; float ratioHeight = (float) maxHeight / height; float rati... | ImageProcessor { public ImageProcessor fitToWidthAndHeight(int maxwidth, int maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); float ratioWidth = (float) maxwidth / width; float ratioHeight = (float) maxHeight / height; float rati... | ImageProcessor { public ImageProcessor fitToWidthAndHeight(int maxwidth, int maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); float ratioWidth = (float) maxwidth / width; float ratioHeight = (float) maxHeight / height; float rati... | ImageProcessor { public ImageProcessor fitToWidthAndHeight(int maxwidth, int maxHeight) throws IOException { ImageMetaData metaData = getMetaData(); int width = metaData.getWidth(); int height = metaData.getHeight(); float ratioWidth = (float) maxwidth / width; float ratioHeight = (float) maxHeight / height; float rati... |
@Test public void testPerformException() { ApplicationRequest applicationRequest = initApplication(false); Mockito.when(config.getLinkpanel()).thenReturn(null); try { CallableAction action = new CallableAction(site, application, applicationRequest, actionRef); action.perform(); fail("ProcessingException must occur!"); ... | public FieldProcessor perform() throws ProcessingException { return perform(false); } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... |
@Test public void testPerformWithErrorFromDataProvider() throws ProcessingException { ApplicationRequest applicationRequest = initApplication(true); AtomicReference<Messages> envMessages = new AtomicReference<Messages>(new Messages()); AtomicReference<Messages> actionMessages = new AtomicReference<Messages>(new Message... | public FieldProcessor perform() throws ProcessingException { return perform(false); } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... |
@Test public void testPerformWithErrorFromAction() throws ProcessingException { ApplicationRequest applicationRequest = initApplication(true); AtomicReference<Messages> envMessages = new AtomicReference<Messages>(new Messages()); AtomicReference<Messages> actionMessages = new AtomicReference<Messages>(new Messages()); ... | public FieldProcessor perform() throws ProcessingException { return perform(false); } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... |
@Test public void testPerform() throws ProcessingException { ApplicationRequest applicationRequest = initApplication(true); AtomicReference<Messages> envMessages = new AtomicReference<Messages>(new Messages()); AtomicReference<Messages> actionMessages = new AtomicReference<Messages>(new Messages()); mockMessages(envMes... | public FieldProcessor perform() throws ProcessingException { return perform(false); } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } } | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... | CallableAction { public FieldProcessor perform() throws ProcessingException { return perform(false); } CallableAction(Site site, Application application, ApplicationRequest applicationRequest,
ActionRef actionRef); protected CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelpe... |
@Test public void testCustomString() { Assert.assertEquals("custom", propertyHolder.getString("customString")); Assert.assertEquals("string", propertyHolder.getString("emptyCustomString")); } | public String getString(String name, String defaultValue) { Property property = getProperty(name); if (null != property) { return property.getString(); } return defaultValue; } | PropertyHolder implements Properties { public String getString(String name, String defaultValue) { Property property = getProperty(name); if (null != property) { return property.getString(); } return defaultValue; } } | PropertyHolder implements Properties { public String getString(String name, String defaultValue) { Property property = getProperty(name); if (null != property) { return property.getString(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); } | PropertyHolder implements Properties { public String getString(String name, String defaultValue) { Property property = getProperty(name); if (null != property) { return property.getString(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolde... | PropertyHolder implements Properties { public String getString(String name, String defaultValue) { Property property = getProperty(name); if (null != property) { return property.getString(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolde... |
@Test public void testBoolean() { Assert.assertEquals(true, propertyHolder.getBoolean("boolean")); Assert.assertEquals(false, propertyHolder.getBoolean("bla", false)); } | public Boolean getBoolean(String name) { return getBoolean(name, null); } | PropertyHolder implements Properties { public Boolean getBoolean(String name) { return getBoolean(name, null); } } | PropertyHolder implements Properties { public Boolean getBoolean(String name) { return getBoolean(name, null); } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); } | PropertyHolder implements Properties { public Boolean getBoolean(String name) { return getBoolean(name, null); } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolder setFinal(); Set<String> getPropertyNames(); boolean propertyExists(String name); Property getProperty... | PropertyHolder implements Properties { public Boolean getBoolean(String name) { return getBoolean(name, null); } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolder setFinal(); Set<String> getPropertyNames(); boolean propertyExists(String name); Property getProperty... |
@Test public void testFloat() { Assert.assertEquals(Float.valueOf(4.5f), propertyHolder.getFloat("float")); Assert.assertEquals(Float.valueOf(1.2f), propertyHolder.getFloat("bla", 1.2f)); } | public Float getFloat(String name, Float defaultValue) { Property property = getProperty(name); if (null != property) { return property.getFloat(); } return defaultValue; } | PropertyHolder implements Properties { public Float getFloat(String name, Float defaultValue) { Property property = getProperty(name); if (null != property) { return property.getFloat(); } return defaultValue; } } | PropertyHolder implements Properties { public Float getFloat(String name, Float defaultValue) { Property property = getProperty(name); if (null != property) { return property.getFloat(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); } | PropertyHolder implements Properties { public Float getFloat(String name, Float defaultValue) { Property property = getProperty(name); if (null != property) { return property.getFloat(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolder se... | PropertyHolder implements Properties { public Float getFloat(String name, Float defaultValue) { Property property = getProperty(name); if (null != property) { return property.getFloat(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolder se... |
@Test public void testDouble() { Assert.assertEquals(Double.valueOf(7.9d), propertyHolder.getDouble("double")); Assert.assertEquals(Double.valueOf(1.2d), propertyHolder.getDouble("bla", 1.2d)); } | public Double getDouble(String name, Double defaultValue) { Property property = getProperty(name); if (null != property) { return property.getDouble(); } return defaultValue; } | PropertyHolder implements Properties { public Double getDouble(String name, Double defaultValue) { Property property = getProperty(name); if (null != property) { return property.getDouble(); } return defaultValue; } } | PropertyHolder implements Properties { public Double getDouble(String name, Double defaultValue) { Property property = getProperty(name); if (null != property) { return property.getDouble(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); } | PropertyHolder implements Properties { public Double getDouble(String name, Double defaultValue) { Property property = getProperty(name); if (null != property) { return property.getDouble(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolde... | PropertyHolder implements Properties { public Double getDouble(String name, Double defaultValue) { Property property = getProperty(name); if (null != property) { return property.getDouble(); } return defaultValue; } PropertyHolder(String prefix, Iterable<? extends Property> properties); PropertyHolder(); PropertyHolde... |
@Test public void testList() { Assert.assertEquals(Arrays.asList("1", "2"), propertyHolder.getList("list", ",")); Assert.assertEquals(Arrays.asList("3", "4"), propertyHolder.getList("bla", "3,4", ",")); } | public List<String> getList(String name, String defaultValue, String delimiter) { List<String> result = new ArrayList<>(); String string = getString(name, defaultValue); if (null != string && string.length() > 0) { String[] splitted = string.split(delimiter); for (String value : splitted) { result.add(value.trim()); } ... | PropertyHolder implements Properties { public List<String> getList(String name, String defaultValue, String delimiter) { List<String> result = new ArrayList<>(); String string = getString(name, defaultValue); if (null != string && string.length() > 0) { String[] splitted = string.split(delimiter); for (String value : s... | PropertyHolder implements Properties { public List<String> getList(String name, String defaultValue, String delimiter) { List<String> result = new ArrayList<>(); String string = getString(name, defaultValue); if (null != string && string.length() > 0) { String[] splitted = string.split(delimiter); for (String value : s... | PropertyHolder implements Properties { public List<String> getList(String name, String defaultValue, String delimiter) { List<String> result = new ArrayList<>(); String string = getString(name, defaultValue); if (null != string && string.length() > 0) { String[] splitted = string.split(delimiter); for (String value : s... | PropertyHolder implements Properties { public List<String> getList(String name, String defaultValue, String delimiter) { List<String> result = new ArrayList<>(); String string = getString(name, defaultValue); if (null != string && string.length() > 0) { String[] splitted = string.split(delimiter); for (String value : s... |
@Test public void testProperties() { Properties props = new Properties(); props.put("a", "1"); props.put("b", "2"); Assert.assertEquals(props, propertyHolder.getProperties("properties")); Assert.assertEquals(null, propertyHolder.getProperties("bla")); } | public java.util.Properties getProperties(String name) { String clob = getClob(name); if (null != clob) { java.util.Properties properties = new java.util.Properties(); try { properties.load(new ByteArrayInputStream(clob.getBytes())); } catch (IOException e) { throw new IllegalArgumentException("failed converting proper... | PropertyHolder implements Properties { public java.util.Properties getProperties(String name) { String clob = getClob(name); if (null != clob) { java.util.Properties properties = new java.util.Properties(); try { properties.load(new ByteArrayInputStream(clob.getBytes())); } catch (IOException e) { throw new IllegalArgu... | PropertyHolder implements Properties { public java.util.Properties getProperties(String name) { String clob = getClob(name); if (null != clob) { java.util.Properties properties = new java.util.Properties(); try { properties.load(new ByteArrayInputStream(clob.getBytes())); } catch (IOException e) { throw new IllegalArgu... | PropertyHolder implements Properties { public java.util.Properties getProperties(String name) { String clob = getClob(name); if (null != clob) { java.util.Properties properties = new java.util.Properties(); try { properties.load(new ByteArrayInputStream(clob.getBytes())); } catch (IOException e) { throw new IllegalArgu... | PropertyHolder implements Properties { public java.util.Properties getProperties(String name) { String clob = getClob(name); if (null != clob) { java.util.Properties properties = new java.util.Properties(); try { properties.load(new ByteArrayInputStream(clob.getBytes())); } catch (IOException e) { throw new IllegalArgu... |
@Test public void testMetaData() throws IOException { ImageProcessor ip = new ImageProcessor(sourceFile, null, true); ImageMetaData metaData = ip.getMetaData(); Assert.assertEquals(1024, metaData.getWidth()); Assert.assertEquals(768, metaData.getHeight()); Assert.assertEquals(845941L, metaData.getFileSize(), 0.0d); } | public ImageMetaData getMetaData() throws IOException { ImageInputStream input = new FileImageInputStream(sourceFile); Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(input); if (imageReaders.hasNext()) { ImageReader reader = imageReaders.next(); reader.setInput(input); ImageMetaData imageMetaData = new Im... | ImageProcessor { public ImageMetaData getMetaData() throws IOException { ImageInputStream input = new FileImageInputStream(sourceFile); Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(input); if (imageReaders.hasNext()) { ImageReader reader = imageReaders.next(); reader.setInput(input); ImageMetaData image... | ImageProcessor { public ImageMetaData getMetaData() throws IOException { ImageInputStream input = new FileImageInputStream(sourceFile); Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(input); if (imageReaders.hasNext()) { ImageReader reader = imageReaders.next(); reader.setInput(input); ImageMetaData image... | ImageProcessor { public ImageMetaData getMetaData() throws IOException { ImageInputStream input = new FileImageInputStream(sourceFile); Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(input); if (imageReaders.hasNext()) { ImageReader reader = imageReaders.next(); reader.setInput(input); ImageMetaData image... | ImageProcessor { public ImageMetaData getMetaData() throws IOException { ImageInputStream input = new FileImageInputStream(sourceFile); Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(input); if (imageReaders.hasNext()) { ImageReader reader = imageReaders.next(); reader.setInput(input); ImageMetaData image... |
@Test public void testPlainProperties() { Properties plainProperties = propertyHolder.getPlainProperties(); Assert.assertEquals(plainProperties, propertyHolder.getPlainProperties()); } | public java.util.Properties getPlainProperties() { java.util.Properties props = new java.util.Properties(); Set<String> propertyNames = getPropertyNames(); for (String name : propertyNames) { Property property = getProperty(name); if (null != property) { String value = property.getString(); if (null == value) { value =... | PropertyHolder implements Properties { public java.util.Properties getPlainProperties() { java.util.Properties props = new java.util.Properties(); Set<String> propertyNames = getPropertyNames(); for (String name : propertyNames) { Property property = getProperty(name); if (null != property) { String value = property.ge... | PropertyHolder implements Properties { public java.util.Properties getPlainProperties() { java.util.Properties props = new java.util.Properties(); Set<String> propertyNames = getPropertyNames(); for (String name : propertyNames) { Property property = getProperty(name); if (null != property) { String value = property.ge... | PropertyHolder implements Properties { public java.util.Properties getPlainProperties() { java.util.Properties props = new java.util.Properties(); Set<String> propertyNames = getPropertyNames(); for (String name : propertyNames) { Property property = getProperty(name); if (null != property) { String value = property.ge... | PropertyHolder implements Properties { public java.util.Properties getPlainProperties() { java.util.Properties props = new java.util.Properties(); Set<String> propertyNames = getPropertyNames(); for (String name : propertyNames) { Property property = getProperty(name); if (null != property) { String value = property.ge... |
@Test public void testNoData() { MetaData metaData2 = elementHelper.getFilteredMetaData(applicationRequest, metaData, false); Assert.assertTrue(metaData2.getFields().isEmpty()); metaData2 = elementHelper.getFilteredMetaData(applicationRequest, metaData, true); Assert.assertTrue(metaData2.getFields().isEmpty()); } | MetaData getFilteredMetaData(ApplicationRequest request, MetaData metaData, boolean write) { MetaData result = new MetaData(); if (null != metaData) { result.setBinding(metaData.getBinding()); result.setResultSelector(metaData.getResultSelector()); result.setBindClass(metaData.getBindClass()); result.setValidation(meta... | ElementHelper { MetaData getFilteredMetaData(ApplicationRequest request, MetaData metaData, boolean write) { MetaData result = new MetaData(); if (null != metaData) { result.setBinding(metaData.getBinding()); result.setResultSelector(metaData.getResultSelector()); result.setBindClass(metaData.getBindClass()); result.se... | ElementHelper { MetaData getFilteredMetaData(ApplicationRequest request, MetaData metaData, boolean write) { MetaData result = new MetaData(); if (null != metaData) { result.setBinding(metaData.getBinding()); result.setResultSelector(metaData.getResultSelector()); result.setBindClass(metaData.getBindClass()); result.se... | ElementHelper { MetaData getFilteredMetaData(ApplicationRequest request, MetaData metaData, boolean write) { MetaData result = new MetaData(); if (null != metaData) { result.setBinding(metaData.getBinding()); result.setResultSelector(metaData.getResultSelector()); result.setBindClass(metaData.getBindClass()); result.se... | ElementHelper { MetaData getFilteredMetaData(ApplicationRequest request, MetaData metaData, boolean write) { MetaData result = new MetaData(); if (null != metaData) { result.setBinding(metaData.getBinding()); result.setResultSelector(metaData.getResultSelector()); result.setBindClass(metaData.getBindClass()); result.se... |
@Test public void testInitNavigation() { Linkpanel linkpanel = new Linkpanel(); linkpanel.setId("panel"); linkpanel.setLocation(PanelLocation.TOP); addLink(linkpanel, "link1", "target", "${1 eq 1}"); addLink(linkpanel, "link2", "target", "${1 eq 2}"); rootCfg.setNavigation(linkpanel); PageConfig pageConfig = new PageCo... | public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Linkpanel navigati... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... |
@Test public void testInitNavigationNoPermission() { Linkpanel linkpanel = new Linkpanel(); Permissions permissions = new Permissions(); Permission p1 = new Permission(); p1.setRef("foo"); permissions.getPermissionList().add(p1); linkpanel.setPermissions(permissions); linkpanel.setId("panel"); linkpanel.setLocation(Pan... | public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Linkpanel navigati... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... | ElementHelper { public void initNavigation(ApplicationRequest applicationRequest, Path pathInfo, PageConfig pageConfig) { ParameterSupport parameterSupport = applicationRequest.getParameterSupportDollar(); Linkpanel pageLinks = initLinkpanel(applicationRequest, pathInfo, pageConfig.getLinkpanel(), parameterSupport); Li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.