@Override public final void runBare() throws Throwable { // Patch a bug with maven that does not pass properly the system property // with an empty value if ("org.hsqldb.jdbcDriver".equals(System.getProperty("gatein.test.datasource.driver"))) { System.setProperty("gatein.test.datasource.password", ""); } // log.info("Running unit test:" + getName()); for (Map.Entry<?, ?> entry : System.getProperties().entrySet()) { if (entry.getKey() instanceof String) { String key = (String) entry.getKey(); log.debug(key + "=" + entry.getValue()); } } // beforeRunBare(); // try { super.runBare(); log.info("Unit test " + getName() + " completed"); } catch (Throwable throwable) { log.error("Unit test " + getName() + " did not complete", throwable); // throw throwable; } finally { afterRunBare(); } }
public Set<Portlet> getPortlets() throws PortletInvokerException { Set<Portlet> portlets = new HashSet<Portlet>(super.getPortlets()); Registration registration = RegistrationLocal.getRegistration(); if (registration != null) { Set<PortletContext> contexts = registration.getKnownPortletContexts(); for (PortletContext context : contexts) { try { portlets.add(super.getPortlet(context)); } catch (NoSuchPortletException e) { final RegistrationSPI registrationSPI = getRegistrationAsSPI(); try { registrationSPI.removePortletContext(context); log.debug( "Removed '" + context + "' from Registration '" + registration.getRegistrationHandle() + "' because it cannot be resolved anymore."); } catch (RegistrationException e1) { throw new PortletInvokerException(e1); } } } } return portlets; }
public void addNodes( String navType, String navOwner, String nodePrefix, int startIndex, int endIndex) { if (startIndex < endIndex) { SiteKey key = new SiteKey(navType, navOwner); NavigationContext navCtx = navService.loadNavigation(key); if (navCtx == null) { LOG.error("Navigation type= " + navType + " , owner= " + navOwner + " does not exist"); } else { NavNode rootNode = navService.loadNode(new NavNodeModel(), navCtx, Scope.CHILDREN, null).getNode(); int index = rootNode.getSize(); for (int i = startIndex; i < endIndex; i++) { String nodeName = nodePrefix + "_" + i; if (rootNode.getChild(nodeName) != null) { LOG.debug( "Navigation node named " + nodeName + " already exist, will not add it anymore"); } else { rootNode.addChild(index, nodeName); index++; } } navService.saveNode(rootNode.context, null); } } }
public void processRender(WebuiRequestContext context) throws Exception { ResourceBundle res = context.getApplicationResourceBundle(); UIForm uiForm = getAncestorOfType(UIForm.class); String formId = null; if (uiForm.getId().equals("UISearchForm")) formId = uiForm.<UIComponent>getParent().getId(); else formId = uiForm.getId(); Writer w = context.getWriter(); w.write("<select class=\"selectbox\" name=\""); w.write(name); w.write("\""); if (onchange_ != null) { w.append(" onchange=\"").append(renderOnChangeEvent(uiForm)).append("\""); } if (isMultiple_) w.write(" multiple=\"true\""); if (size_ > 1) w.write(" size=\"" + size_ + "\""); if (isDisabled()) w.write(" disabled "); renderHTMLAttributes(w); w.write(">\n"); for (SelectItem item : options_) { String label = item.getLabel(); if (item instanceof SelectOption) { try { label = res.getString(formId + ".label.option." + ((SelectOption) item).getValue()); } catch (MissingResourceException ex) { } w.write(renderOption(((SelectOption) item), label)); } else if (item instanceof SelectOptionGroup) { label = item.getLabel(); try { label = res.getString(getFrom().getId() + ".optionGroup.label." + label); } catch (MissingResourceException ex) { log.debug("Could not find: " + getFrom().getId() + ".optionGroup.label." + label); } w.write("<optgroup label=\""); w.write(label); w.write("\">\n"); for (SelectOption opt : ((SelectOptionGroup) item).getOptions()) { label = opt.getLabel(); try { label = res.getString(formId + ".label.option." + opt.getValue()); } catch (MissingResourceException ex) { } w.write(renderOption(opt, label)); } w.write("</optgroup>\n"); } } w.write("</select>\n"); if (this.isMandatory()) w.write(" *"); }
public void validateTicket(HttpServletRequest httpRequest, String ticket) throws Exception { Cas20ProxyTicketValidator ticketValidator = new Cas20ProxyTicketValidator(casServerUrl); ticketValidator.setRenew(this.renewTicket); // String serviceUrl = "http://"+ httpRequest.getServerName() +":" + httpRequest.getServerPort() // + // httpRequest.getContextPath() +"/private/classic"; Assertion assertion = ticketValidator.validate(ticket, this.casServiceUrl); log.debug( "------------------------------------------------------------------------------------"); log.debug("Service: " + this.casServiceUrl); log.debug("Principal: " + assertion.getPrincipal().getName()); log.debug( "------------------------------------------------------------------------------------"); String principal = assertion.getPrincipal().getName(); this.saveSSOCredentials(principal, httpRequest); }
public void addPlugin(ComponentPlugin plugin) { if (plugin instanceof SSOFilterIntegratorPlugin) { SSOFilterIntegratorPlugin ssoPlugin = (SSOFilterIntegratorPlugin) plugin; if (!ssoPlugin.isEnabled()) { return; } SSOInterceptor ssoInterceptor = ssoPlugin.getFilter(); this.ssoInterceptors.put(ssoInterceptor, ssoPlugin.getFilterMapping()); log.debug("Added new SSOInterceptor " + ssoInterceptor); } }
/** * Destroy the clones scoped by this Registration. * * @param registration the Registration about to be destroyed * @return */ public Vote destructionScheduledFor(Registration registration) { if (registration != null) { List<PortletContext> portletContexts = new ArrayList<PortletContext>(registration.getKnownPortletContexts()); List<DestroyCloneFailure> failures = Collections.emptyList(); try { failures = super.destroyClones(portletContexts); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Couldn't destroy clones", e); } return Vote.negativeVote("Couldn't destroy clones: " + failures); } } return RegistrationDestructionListener.SUCCESS; }
static { // Detecting version from maven properties // empty value is ok String version = ""; URL url = ResourceRequestHandler.class.getClassLoader().getResource(PATH); if (url != null) { log.debug("Loading resource serving version from " + url); InputStream in = null; try { in = url.openStream(); Properties props = new Properties(); props.load(in); version = props.getProperty("version"); } catch (IOException e) { log.error("Could not read properties from " + url, e); } finally { IOTools.safeClose(in); } } // log.info("Use version \"" + version + "\" for resource serving"); VERSION = version; }