Example usage for org.apache.commons.lang SystemUtils IS_JAVA_1_6

List of usage examples for org.apache.commons.lang SystemUtils IS_JAVA_1_6

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils IS_JAVA_1_6.

Prototype

boolean IS_JAVA_1_6

To view the source code for org.apache.commons.lang SystemUtils IS_JAVA_1_6.

Click Source Link

Document

Is true if this is Java version 1.6 (also 1.6.x versions).

The field will return false if #JAVA_VERSION is null.

Usage

From source file:marytts.tests.junit4.EnvironmentTest.java

@Test
public void testJavaVersion() {
    assertThat(SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7).isTrue();
}

From source file:org.eclipse.wb.internal.swing.gef.policy.layout.gbl.header.edit.RowHeaderEditPart.java

public void buildContextMenu(IMenuManager manager) {
    // operations
    {/*  w  ww . ja v  a  2  s  . c o  m*/
        manager.add(new DimensionHeaderAction<RowInfo>(this, GefMessages.RowHeaderEditPart_insertRow) {
            @Override
            protected void run(RowInfo row) throws Exception {
                m_layout.getRowOperations().insert(row.getIndex());
            }
        });
        manager.add(new DimensionHeaderAction<RowInfo>(this, GefMessages.RowHeaderEditPart_appendRow) {
            @Override
            protected void run(RowInfo row) throws Exception {
                m_layout.getRowOperations().insert(row.getIndex() + 1);
            }
        });
        manager.add(new DimensionHeaderAction<RowInfo>(this, GefMessages.RowHeaderEditPart_deleteRow,
                AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/delete.gif")) {
            @Override
            protected void run(RowInfo row) throws Exception {
                m_layout.getRowOperations().delete(row.getIndex());
            }
        });
        manager.add(new DimensionHeaderAction<RowInfo>(this, GefMessages.RowHeaderEditPart_deleteContents) {
            @Override
            protected void run(RowInfo row) throws Exception {
                m_layout.getRowOperations().clear(row.getIndex());
            }
        });
        manager.add(new DimensionHeaderAction<RowInfo>(this, GefMessages.RowHeaderEditPart_splitRow) {
            @Override
            protected void run(RowInfo row) throws Exception {
                m_layout.getRowOperations().split(row.getIndex());
            }
        });
    }
    // alignment
    {
        manager.add(new Separator());
        manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaTop,
                AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/top.gif"), RowInfo.Alignment.TOP));
        manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaCenter,
                AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/center.gif"),
                RowInfo.Alignment.CENTER));
        manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaBottom,
                AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/bottom.gif"),
                RowInfo.Alignment.BOTTOM));
        manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaFill,
                AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/fill.gif"),
                RowInfo.Alignment.FILL));
        if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) {
            manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaBaseline,
                    AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/baseline.gif"),
                    RowInfo.Alignment.BASELINE));
            manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaAboveBaseline,
                    AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/baseline_above.gif"),
                    RowInfo.Alignment.BASELINE_ABOVE));
            manager.add(new SetAlignmentRowAction(this, GefMessages.RowHeaderEditPart_vaBelowBaseline,
                    AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/baseline_below.gif"),
                    RowInfo.Alignment.BASELINE_BELOW));
        }
    }
    // grow
    {
        manager.add(new Separator());
        manager.add(new SetGrowAction<RowInfo>(this, GefMessages.RowHeaderEditPart_grow,
                AbstractGridBagLayoutInfo.getImageDescriptor("headers/v/menu/grow.gif")));
    }
    // properties
    {
        manager.add(new Separator());
        manager.add(new Action(GefMessages.RowHeaderEditPart_properties) {
            @Override
            public void run() {
                editDimension();
            }
        });
    }
}

From source file:org.eclipse.wb.internal.swing.model.layout.gbl.AbstractGridBagConstraintsInfo.java

/**
 * Adds the vertical alignment {@link Action}'s.
 *//*from  w ww. ja v a2s.co m*/
public void fillVerticalAlignmentMenu(IMenuManager manager) {
    manager.add(new SetAlignmentVerticalAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaTop,
            "top.gif", RowInfo.Alignment.TOP));
    manager.add(new SetAlignmentVerticalAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaCenter,
            "center.gif", RowInfo.Alignment.CENTER));
    manager.add(new SetAlignmentVerticalAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaBottom,
            "bottom.gif", RowInfo.Alignment.BOTTOM));
    manager.add(new SetAlignmentVerticalAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaFill,
            "fill.gif", RowInfo.Alignment.FILL));
    if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) {
        manager.add(
                new SetAlignmentVerticalAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaBaseline,
                        "baseline.gif", RowInfo.Alignment.BASELINE));
        manager.add(new SetAlignmentVerticalAction(this,
                ModelMessages.AbstractGridBagConstraintsInfo_vaAboveBaseline, "baseline_above.gif",
                RowInfo.Alignment.BASELINE_ABOVE));
        manager.add(new SetAlignmentVerticalAction(this,
                ModelMessages.AbstractGridBagConstraintsInfo_vaBelowBaseline, "baseline_below.gif",
                RowInfo.Alignment.BASELINE_BELOW));
    }
    manager.add(new Separator());
    manager.add(
            new SetGrowAction(this, ModelMessages.AbstractGridBagConstraintsInfo_vaGrow, "grow.gif", false));
}

From source file:org.eclipse.wb.internal.swing.model.layout.gbl.actions.SelectionActionsSupport.java

@Override
public void addSelectionActions(List<ObjectInfo> objects, List<Object> actions) throws Exception {
    if (objects.isEmpty()) {
        return;//from   w w w .  j a  v  a 2 s. c o  m
    }
    // prepare constraints
    List<AbstractGridBagConstraintsInfo> constraints = Lists.newArrayList();
    for (ObjectInfo object : objects) {
        // check object
        if (!m_layout.isManagedObject(object)) {
            return;
        }
        // add data info
        ComponentInfo component = (ComponentInfo) object;
        constraints.add(m_layout.getConstraints(component));
    }
    // create horizontal actions
    actions.add(new Separator());
    addAlignmentAction(actions, constraints, true, "left.gif", ModelMessages.SelectionActionsSupport_haLeft,
            ColumnInfo.Alignment.LEFT);
    addAlignmentAction(actions, constraints, true, "center.gif", ModelMessages.SelectionActionsSupport_haCenter,
            ColumnInfo.Alignment.CENTER);
    addAlignmentAction(actions, constraints, true, "right.gif", ModelMessages.SelectionActionsSupport_haRight,
            ColumnInfo.Alignment.RIGHT);
    addAlignmentAction(actions, constraints, true, "fill.gif", ModelMessages.SelectionActionsSupport_haFill,
            ColumnInfo.Alignment.FILL);
    // create vertical actions
    actions.add(new Separator());
    addAlignmentAction(actions, constraints, false, "top.gif", ModelMessages.SelectionActionsSupport_vaTop,
            RowInfo.Alignment.TOP);
    addAlignmentAction(actions, constraints, false, "center.gif",
            ModelMessages.SelectionActionsSupport_vaCenter, RowInfo.Alignment.CENTER);
    addAlignmentAction(actions, constraints, false, "bottom.gif",
            ModelMessages.SelectionActionsSupport_vaBottom, RowInfo.Alignment.BOTTOM);
    addAlignmentAction(actions, constraints, false, "fill.gif", ModelMessages.SelectionActionsSupport_vaFill,
            RowInfo.Alignment.FILL);
    if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) {
        addAlignmentAction(actions, constraints, false, "baseline.gif",
                ModelMessages.SelectionActionsSupport_vaBaseline, RowInfo.Alignment.BASELINE);
        addAlignmentAction(actions, constraints, false, "baseline_above.gif",
                ModelMessages.SelectionActionsSupport_vaAboveBaseline, RowInfo.Alignment.BASELINE_ABOVE);
        addAlignmentAction(actions, constraints, false, "baseline_below.gif",
                ModelMessages.SelectionActionsSupport_vaBelowBaseline, RowInfo.Alignment.BASELINE_BELOW);
    }
    // create grow actions
    actions.add(new Separator());
    addGrowAction(actions, constraints, true, "grow.gif", ModelMessages.SelectionActionsSupport_haGrow);
    addGrowAction(actions, constraints, false, "grow.gif", ModelMessages.SelectionActionsSupport_vaGrow);
}

From source file:org.eclipse.wb.internal.swing.model.layout.gbl.GridBagConstraintsAssistantPage.java

public GridBagConstraintsAssistantPage(Composite parent, Object selection) {
    super(parent, selection);
    GridLayoutFactory.create(this).columns(3);
    ////w  w w  .  jav  a2  s . c om
    if (SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_7) {
        // horizontal alignments
        {
            Group horizontalGroup = createHorizontalAlignmentGroup();
            GridDataFactory.modify(horizontalGroup).fill();
        }
        // vertical alignments
        {
            Group verticalGroup = addChoiceProperty(this, "verticalAlignment",
                    ModelMessages.GridBagConstraintsAssistantPage_verticalAlignmentGroup,
                    new Object[][] {
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaTop,
                                    RowInfo.Alignment.TOP },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaCenter,
                                    RowInfo.Alignment.CENTER },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaBottom,
                                    RowInfo.Alignment.BOTTOM },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaFill,
                                    RowInfo.Alignment.FILL },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaBaseline,
                                    RowInfo.Alignment.BASELINE },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaAboveBaseline,
                                    RowInfo.Alignment.BASELINE_ABOVE },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaBelowBaseline,
                                    RowInfo.Alignment.BASELINE_BELOW } });
            GridDataFactory.modify(verticalGroup).fillV();
        }
        // insets
        {
            Group insetsGroup = createInsetsGroup();
            GridDataFactory.modify(insetsGroup).fillV();
        }
        // weight
        {
            Group weightGroup = createWeightGroup();
            GridDataFactory.modify(weightGroup).fillV();
        }
        // grow
        {
            createGrowGroup();
        }
        // padding
        {
            Group paddingGroup = createPaddingGroup();
            GridDataFactory.create(paddingGroup).fill();
        }
    } else {
        // horizontal alignments
        {
            Group horizontalGroup = createHorizontalAlignmentGroup();
            GridDataFactory.modify(horizontalGroup).fillV();
        }
        // vertical alignments
        {
            Group verticalGroup = addChoiceProperty(this, "verticalAlignment",
                    ModelMessages.GridBagConstraintsAssistantPage_verticalAlignmentGroup,
                    new Object[][] {
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaTop,
                                    RowInfo.Alignment.TOP },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaCenter,
                                    RowInfo.Alignment.CENTER },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaBottom,
                                    RowInfo.Alignment.BOTTOM },
                            new Object[] { ModelMessages.GridBagConstraintsAssistantPage_vaFill,
                                    RowInfo.Alignment.FILL } });
            GridDataFactory.modify(verticalGroup).fillV();
        }
        // insets
        {
            createInsetsGroup();
        }
        // padding
        {
            Group paddingGroup = createPaddingGroup();
            GridDataFactory.create(paddingGroup).fill().spanH(2);
        }
        // grow
        {
            createGrowGroup();
        }
    }
}

From source file:org.jboss.as.test.integration.security.common.negotiation.KerberosTestUtils.java

/**
 * This method throws an {@link AssumptionViolatedException} (i.e. it skips the test-case) if the configuration is
 * unsupported for HTTP authentication with Kerberos. Configuration in this case means combination of [ hostname used | JDK
 * vendor | Java version ]./*from  www.ja v a2 s.  co m*/
 *
 * @param hostName
 * @throws AssumptionViolatedException
 */
public static void assumeKerberosAuthenticationSupported(String hostName) throws AssumptionViolatedException {
    if (IBM_JDK && isRunningOnIPv6()) {
        throw new AssumptionViolatedException(
                "Kerberos tests are not supported on IBM Java with IPv6. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1188632");
    }
    if (isIPv6Hostname(hostName)) {
        if (IBM_JDK && SystemUtils.IS_JAVA_1_7) {
            throw new AssumptionViolatedException(
                    "Kerberos tests are not supported on IBM Java 7 with IPv6-based hostnames. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1185917");
        }
        if (IBM_JDK && SystemUtils.IS_JAVA_1_6) {
            throw new AssumptionViolatedException(
                    "Kerberos tests are not supported on IBM Java 6 with IPv6-based hostnames. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1186129");
        }
        if (OPEN_JDK && SystemUtils.IS_JAVA_1_6) {
            throw new AssumptionViolatedException(
                    "Kerberos tests are not supported on OpenJDK 6 with IPv6-based hostnames. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1186132");
        }
    }
}

From source file:org.jboss.as.test.integration.security.common.negotiation.KerberosTestUtils.java

/**
 * This method throws an {@link AssumptionViolatedException} (i.e. it skips the test-case) if the configuration is
 * unsupported for EJB client authentication with Kerberos. Configuration in this case means combination of [ hostname used
 * | JDK vendor | Java version ]./*from  w  w  w.  jav  a 2s  . com*/
 *
 * @param hostName
 */
public static void assumeEjbKerberosAuthenticationSupported(String hostName) {
    // additionally there is an issue in Oracle Java 6 in EJB client
    if (isIPv6Hostname(hostName) && ORACLE_JDK && SystemUtils.IS_JAVA_1_6) {
        throw new AssumptionViolatedException(
                "Kerberos tests are not supported on Oracle Java 6 with IPv6-based hostnames. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1179710");
    }
    // lets check other known issues in basic Kerberos authentication support
    assumeKerberosAuthenticationSupported(hostName);
}

From source file:org.jboss.as.test.integration.security.common.negotiation.KerberosTestUtils.java

/**
 * This method throws an {@link AssumptionViolatedException} (i.e. it skips the test-case) if the configuration is
 * unsupported for JBoss CLI authentication with Kerberos. Configuration in this case means combination of [ hostname used |
 * JDK vendor | Java version ]./* w  ww  .  jav a  2 s .  c  o m*/
 *
 * @param hostName
 * @throws AssumptionViolatedException
 */
public static void assumeCLIKerberosAuthenticationSupported(String hostName)
        throws AssumptionViolatedException {
    // there is an issue with kerberos ticket cache location on IBM Java
    if (IBM_JDK) {
        throw new AssumptionViolatedException(
                "Kerberos CLI tests are not supported on IBM Java. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1174156");
    }
    // additionally there is an issue in Oracle Java 6 which doesn't support KRB5CCNAME env. variable to hold cache file
    // location this variable is used in CLI tests
    if (ORACLE_JDK && SystemUtils.IS_JAVA_1_6) {
        throw new AssumptionViolatedException(
                "Kerberos CLI tests are not supported on Oracle Java 6, because wrong support of KRB5CCNAME environment property. Find more info in https://bugzilla.redhat.com/show_bug.cgi?id=1173530#c3");
    }
    // lets check other known issues in basic Kerberos authentication support
    assumeKerberosAuthenticationSupported(hostName);
}

From source file:org.jboss.as.test.manualmode.web.ssl.AbstractCertificateLoginModuleTestCase.java

/**
 * Testing access to HTTPS connector which have configured truststore with
 * trusted certificates. Client with trusted certificate is allowed to
 * access both secured/unsecured resource. Client with untrusted certificate
 * can only access unprotected resources.
 *
 * @throws Exception//from  w w  w .j a v a  2  s  .c  om
 */
public void testLoginWithCertificate(String appName) throws Exception {

    Assume.assumeFalse(
            SystemUtils.IS_JAVA_1_6 && SystemUtils.JAVA_VENDOR.toUpperCase(Locale.ENGLISH).contains("IBM"));

    final URL printPrincipalUrl = getServletUrl(HTTPS_PORT, appName, PrincipalPrintingServlet.SERVLET_PATH);
    final URL securedUrl = getServletUrl(HTTPS_PORT, appName, SECURED_SERVLET_WITH_SESSION);
    final URL unsecuredUrl = getServletUrl(HTTPS_PORT, appName, SimpleServlet.SERVLET_PATH);

    final HttpClient httpClient = getHttpsClient(CLIENT_KEYSTORE_FILE);
    final HttpClient httpClientUntrusted = getHttpsClient(UNTRUSTED_KEYSTORE_FILE);

    try {
        makeCallWithHttpClient(printPrincipalUrl, httpClient, HttpServletResponse.SC_FORBIDDEN);

        String responseBody = makeCallWithHttpClient(securedUrl, httpClient, HttpServletResponse.SC_OK);
        assertEquals("Secured page was not reached", SimpleSecuredServlet.RESPONSE_BODY, responseBody);

        String principal = makeCallWithHttpClient(printPrincipalUrl, httpClient, HttpServletResponse.SC_OK);
        assertEquals("Unexpected principal", "cn=client", principal.toLowerCase());

        responseBody = makeCallWithHttpClient(unsecuredUrl, httpClientUntrusted, HttpServletResponse.SC_OK);
        assertEquals("Secured page was not reached", SimpleServlet.RESPONSE_BODY, responseBody);

        try {
            makeCallWithHttpClient(securedUrl, httpClientUntrusted, HttpServletResponse.SC_FORBIDDEN);
        } catch (SSLHandshakeException e) {
            // OK
        } catch (java.net.SocketException se) {
            // OK - on windows usually fails with this one
        }
    } finally {
        httpClient.getConnectionManager().shutdown();
        httpClientUntrusted.getConnectionManager().shutdown();
    }
}

From source file:org.jboss.as.test.manualmode.web.ssl.HTTPSWebConnectorTestCase.java

/**
 * @test.tsfi tsfi.keystore.file//from ww  w  . j  a  v a  2s .  c  o m
 * @test.tsfi tsfi.truststore.file
 * @test.objective Testing default HTTPs connector with verify-client attribute set to "false". The CLIENT-CERT
 *                 authentication (BaseCertLoginModule) is configured for this test. Trusted client is allowed to access
 *                 both secured/unsecured resource. Untrusted client can only access unprotected resources.
 * @test.expectedResult Trusted client has access to protected and unprotected resources. Untrusted client has only access
 *                      to unprotected resources.
 * @throws Exception
 */
@Test
@InSequence(1)
public void testNonVerifyingConnector() throws Exception {

    Assume.assumeFalse(
            SystemUtils.IS_JAVA_1_6 && SystemUtils.JAVA_VENDOR.toUpperCase(Locale.ENGLISH).contains("IBM"));

    final URL printPrincipalUrl = getServletUrl(HTTPS_PORT_VERIFY_FALSE, PrincipalPrintingServlet.SERVLET_PATH);
    final URL securedUrl = getServletUrl(HTTPS_PORT_VERIFY_FALSE, SECURED_SERVLET_WITH_SESSION);
    final URL unsecuredUrl = getServletUrl(HTTPS_PORT_VERIFY_FALSE, SimpleServlet.SERVLET_PATH);

    final HttpClient httpClient = getHttpClient(CLIENT_KEYSTORE_FILE);
    final HttpClient httpClientUntrusted = getHttpClient(UNTRUSTED_KEYSTORE_FILE);

    try {
        makeCallWithHttpClient(printPrincipalUrl, httpClient, HttpServletResponse.SC_FORBIDDEN);

        String responseBody = makeCallWithHttpClient(securedUrl, httpClient, HttpServletResponse.SC_OK);
        assertEquals("Secured page was not reached", SimpleSecuredServlet.RESPONSE_BODY, responseBody);

        String principal = makeCallWithHttpClient(printPrincipalUrl, httpClient, HttpServletResponse.SC_OK);
        assertEquals("Unexpected principal", "cn=client", principal.toLowerCase());

        responseBody = makeCallWithHttpClient(unsecuredUrl, httpClientUntrusted, HttpServletResponse.SC_OK);
        assertEquals("Secured page was not reached", SimpleServlet.RESPONSE_BODY, responseBody);

        try {
            makeCallWithHttpClient(securedUrl, httpClientUntrusted, HttpServletResponse.SC_FORBIDDEN);
        } catch (SSLHandshakeException e) {
            // OK
        } catch (java.net.SocketException se) {
            // OK - on windows usually fails with this one
        }
    } finally {
        httpClient.getConnectionManager().shutdown();
        httpClientUntrusted.getConnectionManager().shutdown();
    }
}