@BeforeMethod(alwaysRun = true) public void setUp() throws Exception { List<String> propsToRemove = ImmutableList.of( "imageDescriptionRegex", "imageNameRegex", "inboundPorts", "hardwareId", "minRam"); // Don't let any defaults from brooklyn.properties (except credentials) interfere with test brooklynProperties = BrooklynProperties.Factory.newDefault(); for (String propToRemove : propsToRemove) { for (String propVariant : ImmutableList.of( propToRemove, CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, propToRemove))) { brooklynProperties.remove("brooklyn.locations.jclouds." + PROVIDER + "." + propVariant); brooklynProperties.remove("brooklyn.locations." + propVariant); brooklynProperties.remove("brooklyn.jclouds." + PROVIDER + "." + propVariant); brooklynProperties.remove("brooklyn.jclouds." + propVariant); } } // Also removes scriptHeader (e.g. if doing `. ~/.bashrc` and `. ~/.profile`, then that can // cause "stdin: is not a tty") brooklynProperties.remove("brooklyn.ssh.config.scriptHeader"); ctx = new LocalManagementContext(brooklynProperties); app = ApplicationBuilder.newManagedApp(TestApplication.class, ctx); }
public static NatType fromValue(String natType) { try { return valueOf( CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(natType, "natType"))); } catch (IllegalArgumentException e) { return UNRECOGNIZED; } }
private void introspectProperties() { properties = new HashMap<>(); try { BeanInfo beanInfo = Introspector.getBeanInfo(getOutlinedClass()); for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) { if (!getObjectGetClassMethod().equals(descriptor.getReadMethod())) { properties.put( camelCased ? descriptor.getName() : CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, descriptor.getName()), new PropertyImpl<>(descriptor)); } } } catch (IntrospectionException e) { throw new ReflectionException(e); } }
protected String getWriteMethodName(Object key) { String name = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, key.toString()); return "set" + name; }
public void setDetails() { StringBuilder html = new StringBuilder("<html>"); String name = CaseFormat.LOWER_CAMEL.to( CaseFormat.UPPER_CAMEL, Optional.fromNullable(ifs.getName()).or(IFS.UNTITLED)); String words = CharMatcher.JAVA_LETTER_OR_DIGIT.negate().replaceFrom(name, ' '); html.append("<a name=\"top\"></a>") .append(String.format("<h1 id=\"title\">IFS %s</h1>", words)); if (ifs.isEmpty()) { html.append("<h2>Empty</h2>"); } else { int i = 0; int columns = (int) Math.floor((float) getWidth() / 350f); html.append("<table>"); for (Transform t : Ordering.from(IFS.IDENTITY).immutableSortedCopy(ifs)) { if (i % columns == 0 && i != 0) html.append("</tr>"); if (i % columns == 0) html.append("<tr>"); html.append("<td>").append("<table class=\"ifs\" width=\"250px\">"); double[] matrix = new double[6]; t.getTransform().getMatrix(matrix); Color c = Color.WHITE; if (controller.isColour()) { if (controller.hasPalette()) { c = controller.getColours().get(i % controller.getPaletteSize()); } else { c = Color.getHSBColor((float) i / (float) ifs.size(), 0.8f, 0.8f); } } String transform = String.format( "<tr class=\"transform\">" + "<td class=\"id\">%02d</td>" + "<td class=\"bracketl\" rowspan=\"2\"> </td>" + "<td class=\"matrixr1\" align=\"right\">%.3f</td>" + "<td class=\"matrixr1\" align=\"right\">%.3f</td>" + "<td class=\"matrixr1\" align=\"right\">%.3f</td>" + "<td class=\"bracketr\" rowspan=\"2\"> </td>" + "</tr>" + "<tr class=\"transform\">" + "<td class=\"info\">%.1f%%" + "<div style=\"width: 15px; height: 10px; border: 1px solid %s; " + "background: #%02x%02x%02x; padding: 0; margin: 0;\"> </div>" + "</td>" + "<td class=\"matrixr2\" align=\"right\">%.3f</td>" + "<td class=\"matrixr2\" align=\"right\">%.3f</td>" + "<td class=\"matrixr2\" align=\"right\">%.3f</td>" + "</tr>" + "<tr class=\"space\"><td colspan=\"6\"> </td></tr>", t.getId(), matrix[0], matrix[1], matrix[2], 100d * t.getDeterminant() / ifs.getWeight(), controller.isColour() ? "black" : "white", c.getRed(), c.getGreen(), c.getBlue(), matrix[3], matrix[4], matrix[5]); html.append(transform).append("</table>").append("</td>"); i++; } html.append("</tr>").append("</table>"); } html.append("</html>"); setText(html.toString()); repaint(); scrollToReference("top"); }
private String injectionSiteDelegateMethodName(Element injectionSiteElement) { return "inject" + CaseFormat.LOWER_CAMEL.to( CaseFormat.UPPER_CAMEL, injectionSiteElement.getSimpleName().toString()); }