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

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

Introduction

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

Prototype

boolean IS_OS_LINUX

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

Click Source Link

Document

Is true if this is Linux.

The field will return false if OS_NAME is null.

Usage

From source file:org.apache.hama.bsp.message.TestHamaAsyncMessageManager.java

public void testMemoryMessaging() throws Exception {
    if (!SystemUtils.IS_OS_LINUX) {
        System.out.println("Skipping testcase because Async is only supported for LINUX!");
        return;/*from w  w w  . j  a  v  a2  s .  c o  m*/
    }

    HamaConfiguration conf = new HamaConfiguration();
    conf.setClass(MessageManager.RECEIVE_QUEUE_TYPE_CLASS, MemoryQueue.class, MessageQueue.class);
    messagingInternal(conf);
}

From source file:org.apache.pulsar.broker.service.BrokerService.java

public BrokerService(PulsarService pulsar) throws Exception {
    this.pulsar = pulsar;
    this.managedLedgerFactory = pulsar.getManagedLedgerFactory();
    this.port = new URI(pulsar.getBrokerServiceUrl()).getPort();
    this.tlsPort = new URI(pulsar.getBrokerServiceUrlTls()).getPort();
    this.topics = new ConcurrentOpenHashMap<>();
    this.replicationClients = new ConcurrentOpenHashMap<>();
    this.keepAliveIntervalSeconds = pulsar.getConfiguration().getKeepAliveIntervalSeconds();
    this.configRegisteredListeners = new ConcurrentOpenHashMap<>();
    this.pendingTopicLoadingQueue = Queues.newConcurrentLinkedQueue();

    this.multiLayerTopicsMap = new ConcurrentOpenHashMap<>();
    this.pulsarStats = new PulsarStats(pulsar);
    this.offlineTopicStatCache = new ConcurrentOpenHashMap<>();

    final DefaultThreadFactory acceptorThreadFactory = new DefaultThreadFactory("pulsar-acceptor");
    final DefaultThreadFactory workersThreadFactory = new DefaultThreadFactory("pulsar-io");
    final int numThreads = Runtime.getRuntime().availableProcessors() * 2;
    log.info("Using {} threads for broker service IO", numThreads);

    EventLoopGroup acceptorEventLoop, workersEventLoop;
    if (SystemUtils.IS_OS_LINUX) {
        try {/*from  w  w w.ja v a2  s .  co  m*/
            acceptorEventLoop = new EpollEventLoopGroup(1, acceptorThreadFactory);
            workersEventLoop = new EpollEventLoopGroup(numThreads, workersThreadFactory);
        } catch (UnsatisfiedLinkError e) {
            acceptorEventLoop = new NioEventLoopGroup(1, acceptorThreadFactory);
            workersEventLoop = new NioEventLoopGroup(numThreads, workersThreadFactory);
        }
    } else {
        acceptorEventLoop = new NioEventLoopGroup(1, acceptorThreadFactory);
        workersEventLoop = new NioEventLoopGroup(numThreads, workersThreadFactory);
    }

    this.acceptorGroup = acceptorEventLoop;
    this.workerGroup = workersEventLoop;
    this.statsUpdater = Executors
            .newSingleThreadScheduledExecutor(new DefaultThreadFactory("pulsar-stats-updater"));
    if (pulsar.getConfiguration().isAuthorizationEnabled()) {
        this.authorizationManager = new AuthorizationManager(pulsar.getConfiguration(),
                pulsar.getConfigurationCache());
    }

    if (pulsar.getConfigurationCache() != null) {
        pulsar.getConfigurationCache().policiesCache().registerListener(this);
    }

    this.inactivityMonitor = Executors
            .newSingleThreadScheduledExecutor(new DefaultThreadFactory("pulsar-inactivity-monitor"));
    this.messageExpiryMonitor = Executors
            .newSingleThreadScheduledExecutor(new DefaultThreadFactory("pulsar-msg-expiry-monitor"));
    this.backlogQuotaManager = new BacklogQuotaManager(pulsar);
    this.backlogQuotaChecker = Executors
            .newSingleThreadScheduledExecutor(new DefaultThreadFactory("pulsar-backlog-quota-checker"));
    this.authenticationService = new AuthenticationService(pulsar.getConfiguration());
    this.dynamicConfigurationCache = new ZooKeeperDataCache<Map<String, String>>(pulsar().getLocalZkCache()) {
        @Override
        public Map<String, String> deserialize(String key, byte[] content) throws Exception {
            return ObjectMapperFactory.getThreadLocal().readValue(content, HashMap.class);
        }
    };
    this.blockedDispatchers = new ConcurrentOpenHashSet<>();
    // update dynamic configuration and register-listener
    updateConfigurationAndRegisterListeners();
    this.lookupRequestSemaphore = new AtomicReference<Semaphore>(
            new Semaphore(pulsar.getConfiguration().getMaxConcurrentLookupRequest(), false));
    this.topicLoadRequestSemaphore = new AtomicReference<Semaphore>(
            new Semaphore(pulsar.getConfiguration().getMaxConcurrentTopicLoadRequest(), false));
    if (pulsar.getConfiguration().getMaxUnackedMessagesPerBroker() > 0
            && pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked() > 0.0) {
        this.maxUnackedMessages = pulsar.getConfiguration().getMaxUnackedMessagesPerBroker();
        this.maxUnackedMsgsPerDispatcher = (int) ((maxUnackedMessages
                * pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked()) / 100);
        log.info("Enabling per-broker unack-message limit {} and dispatcher-limit {} on blocked-broker",
                maxUnackedMessages, maxUnackedMsgsPerDispatcher);
        // block misbehaving dispatcher by checking periodically
        pulsar.getExecutor().scheduleAtFixedRate(() -> checkUnAckMessageDispatching(), 600, 30,
                TimeUnit.SECONDS);
    } else {
        this.maxUnackedMessages = 0;
        this.maxUnackedMsgsPerDispatcher = 0;
        log.info(
                "Disabling per broker unack-msg blocking due invalid unAckMsgSubscriptionPercentageLimitOnBrokerBlocked {} ",
                pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked());
    }

    PersistentReplicator.setReplicatorQueueSize(pulsar.getConfiguration().getReplicationProducerQueueSize());
}

From source file:org.apache.pulsar.testclient.LoadSimulationClient.java

/**
 * Create a LoadSimulationClient with the given JCommander arguments.
 * //from   w w  w .  j a  va  2s .c  o  m
 * @param arguments
 *            Arguments to configure this from.
 */
public LoadSimulationClient(final MainArguments arguments) throws Exception {
    payloadCache = new ConcurrentHashMap<>();
    topicsToTradeUnits = new ConcurrentHashMap<>();
    final EventLoopGroup eventLoopGroup = SystemUtils.IS_OS_LINUX
            ? new EpollEventLoopGroup(Runtime.getRuntime().availableProcessors(),
                    new DefaultThreadFactory("pulsar-test-client"))
            : new NioEventLoopGroup(Runtime.getRuntime().availableProcessors(),
                    new DefaultThreadFactory("pulsar-test-client"));
    clientConf = new ClientConfiguration();

    clientConf.setConnectionsPerBroker(4);

    // Disable stats on the clients to reduce CPU/memory usage.
    clientConf.setStatsInterval(0, TimeUnit.SECONDS);

    producerConf = new ProducerConfiguration();

    // Disable timeout.
    producerConf.setSendTimeout(0, TimeUnit.SECONDS);

    producerConf.setMessageRoutingMode(ProducerConfiguration.MessageRoutingMode.RoundRobinPartition);

    // Enable batching.
    producerConf.setBatchingMaxPublishDelay(1, TimeUnit.MILLISECONDS);
    producerConf.setBatchingEnabled(true);
    consumerConf = new ConsumerConfiguration();
    consumerConf.setMessageListener(ackListener);
    admin = new PulsarAdmin(new URL(arguments.serviceURL), clientConf);
    client = new PulsarClientImpl(arguments.serviceURL, clientConf, eventLoopGroup);
    port = arguments.port;
    executor = Executors.newCachedThreadPool(new DefaultThreadFactory("test-client"));
}

From source file:org.apache.pulsar.testclient.PerformanceProducer.java

public static void main(String[] args) throws Exception {
    final Arguments arguments = new Arguments();
    JCommander jc = new JCommander(arguments);
    jc.setProgramName("pulsar-perf-producer");

    try {//from   w ww  . j  a  v a 2  s  . co  m
        jc.parse(args);
    } catch (ParameterException e) {
        System.out.println(e.getMessage());
        jc.usage();
        System.exit(-1);
    }

    if (arguments.help) {
        jc.usage();
        System.exit(-1);
    }

    if (arguments.destinations.size() != 1) {
        System.out.println("Only one topic name is allowed");
        jc.usage();
        System.exit(-1);
    }

    if (arguments.confFile != null) {
        Properties prop = new Properties(System.getProperties());
        prop.load(new FileInputStream(arguments.confFile));

        if (arguments.serviceURL == null) {
            arguments.serviceURL = prop.getProperty("brokerServiceUrl");
        }

        if (arguments.serviceURL == null) {
            arguments.serviceURL = prop.getProperty("webServiceUrl");
        }

        // fallback to previous-version serviceUrl property to maintain backward-compatibility
        if (arguments.serviceURL == null) {
            arguments.serviceURL = prop.getProperty("serviceUrl", "http://localhost:8080/");
        }

        if (arguments.authPluginClassName == null) {
            arguments.authPluginClassName = prop.getProperty("authPlugin", null);
        }

        if (arguments.authParams == null) {
            arguments.authParams = prop.getProperty("authParams", null);
        }
    }

    arguments.testTime = TimeUnit.SECONDS.toMillis(arguments.testTime);

    // Dump config variables
    ObjectMapper m = new ObjectMapper();
    ObjectWriter w = m.writerWithDefaultPrettyPrinter();
    log.info("Starting Pulsar perf producer with config: {}", w.writeValueAsString(arguments));

    // Read payload data from file if needed
    byte payloadData[];
    if (arguments.payloadFilename != null) {
        payloadData = Files.readAllBytes(Paths.get(arguments.payloadFilename));
    } else {
        payloadData = new byte[arguments.msgSize];
    }

    // Now processing command line arguments
    String prefixTopicName = arguments.destinations.get(0);
    List<Future<Producer>> futures = Lists.newArrayList();

    EventLoopGroup eventLoopGroup;
    if (SystemUtils.IS_OS_LINUX) {
        eventLoopGroup = new EpollEventLoopGroup(Runtime.getRuntime().availableProcessors(),
                new DefaultThreadFactory("pulsar-perf-producer"));
    } else {
        eventLoopGroup = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors(),
                new DefaultThreadFactory("pulsar-perf-producer"));
    }

    ClientConfiguration clientConf = new ClientConfiguration();
    clientConf.setConnectionsPerBroker(arguments.maxConnections);
    clientConf.setStatsInterval(arguments.statsIntervalSeconds, TimeUnit.SECONDS);
    if (isNotBlank(arguments.authPluginClassName)) {
        clientConf.setAuthentication(arguments.authPluginClassName, arguments.authParams);
    }

    PulsarClient client = new PulsarClientImpl(arguments.serviceURL, clientConf, eventLoopGroup);

    ProducerConfiguration producerConf = new ProducerConfiguration();
    producerConf.setSendTimeout(0, TimeUnit.SECONDS);
    producerConf.setCompressionType(arguments.compression);
    // enable round robin message routing if it is a partitioned topic
    producerConf.setMessageRoutingMode(MessageRoutingMode.RoundRobinPartition);
    if (arguments.batchTime > 0) {
        producerConf.setBatchingMaxPublishDelay(arguments.batchTime, TimeUnit.MILLISECONDS);
        producerConf.setBatchingEnabled(true);
        producerConf.setMaxPendingMessages(arguments.msgRate);
    }

    // Block if queue is full else we will start seeing errors in sendAsync
    producerConf.setBlockIfQueueFull(true);

    for (int i = 0; i < arguments.numTopics; i++) {
        String topic = (arguments.numTopics == 1) ? prefixTopicName
                : String.format("%s-%d", prefixTopicName, i);
        log.info("Adding {} publishers on destination {}", arguments.numProducers, topic);

        for (int j = 0; j < arguments.numProducers; j++) {
            futures.add(client.createProducerAsync(topic, producerConf));
        }
    }

    final List<Producer> producers = Lists.newArrayListWithCapacity(futures.size());
    for (Future<Producer> future : futures) {
        producers.add(future.get());
    }

    log.info("Created {} producers", producers.size());

    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            printAggregatedStats();
        }
    });

    Collections.shuffle(producers);
    AtomicBoolean isDone = new AtomicBoolean();

    executor.submit(() -> {
        try {
            RateLimiter rateLimiter = RateLimiter.create(arguments.msgRate);

            long startTime = System.currentTimeMillis();

            // Send messages on all topics/producers
            long totalSent = 0;
            while (true) {
                for (Producer producer : producers) {
                    if (arguments.testTime > 0) {
                        if (System.currentTimeMillis() - startTime > arguments.testTime) {
                            log.info("------------------- DONE -----------------------");
                            printAggregatedStats();
                            isDone.set(true);
                            Thread.sleep(5000);
                            System.exit(0);
                        }
                    }

                    if (arguments.numMessages > 0) {
                        if (totalSent++ >= arguments.numMessages) {
                            log.info("------------------- DONE -----------------------");
                            printAggregatedStats();
                            isDone.set(true);
                            Thread.sleep(5000);
                            System.exit(0);
                        }
                    }
                    rateLimiter.acquire();

                    final long sendTime = System.nanoTime();

                    producer.sendAsync(payloadData).thenRun(() -> {
                        messagesSent.increment();
                        bytesSent.add(payloadData.length);

                        long latencyMicros = NANOSECONDS.toMicros(System.nanoTime() - sendTime);
                        recorder.recordValue(latencyMicros);
                        cumulativeRecorder.recordValue(latencyMicros);
                    }).exceptionally(ex -> {
                        log.warn("Write error on message", ex);
                        System.exit(-1);
                        return null;
                    });
                }
            }
        } catch (Throwable t) {
            log.error("Got error", t);
        }
    });

    // Print report stats
    long oldTime = System.nanoTime();

    Histogram reportHistogram = null;

    String statsFileName = "perf-producer-" + System.currentTimeMillis() + ".hgrm";
    log.info("Dumping latency stats to {}", statsFileName);

    PrintStream histogramLog = new PrintStream(new FileOutputStream(statsFileName), false);
    HistogramLogWriter histogramLogWriter = new HistogramLogWriter(histogramLog);

    // Some log header bits
    histogramLogWriter.outputLogFormatVersion();
    histogramLogWriter.outputLegend();

    while (true) {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            break;
        }

        if (isDone.get()) {
            break;
        }

        long now = System.nanoTime();
        double elapsed = (now - oldTime) / 1e9;

        double rate = messagesSent.sumThenReset() / elapsed;
        double throughput = bytesSent.sumThenReset() / elapsed / 1024 / 1024 * 8;

        reportHistogram = recorder.getIntervalHistogram(reportHistogram);

        log.info(
                "Throughput produced: {}  msg/s --- {} Mbit/s --- Latency: mean: {} ms - med: {} - 95pct: {} - 99pct: {} - 99.9pct: {} - 99.99pct: {} - Max: {}",
                throughputFormat.format(rate), throughputFormat.format(throughput),
                dec.format(reportHistogram.getMean() / 1000.0),
                dec.format(reportHistogram.getValueAtPercentile(50) / 1000.0),
                dec.format(reportHistogram.getValueAtPercentile(95) / 1000.0),
                dec.format(reportHistogram.getValueAtPercentile(99) / 1000.0),
                dec.format(reportHistogram.getValueAtPercentile(99.9) / 1000.0),
                dec.format(reportHistogram.getValueAtPercentile(99.99) / 1000.0),
                dec.format(reportHistogram.getMaxValue() / 1000.0));

        histogramLogWriter.outputIntervalHistogram(reportHistogram);
        reportHistogram.reset();

        oldTime = now;
    }

    client.close();
}

From source file:org.apache.sysml.utils.NativeHelper.java

private static void performLoading(String customLibPath, String userSpecifiedBLAS) {
    // Only Linux supported for BLAS
    if (!SystemUtils.IS_OS_LINUX)
        return;//from ww  w .  j av  a 2 s  .  c  om

    // attemptedLoading variable ensures that we don't try to load SystemML and other dependencies 
    // again and again especially in the parfor (hence the double-checking with synchronized).
    if (shouldReload(customLibPath) && isSupportedBLAS(userSpecifiedBLAS) && isSupportedArchitecture()) {
        long start = System.nanoTime();
        synchronized (NativeHelper.class) {
            if (shouldReload(customLibPath)) {
                // Set attempted loading unsuccessful in case of exception
                CURRENT_NATIVE_BLAS_STATE = NativeBlasState.ATTEMPTED_LOADING_NATIVE_BLAS_UNSUCCESSFULLY;
                String[] blas = new String[] { userSpecifiedBLAS };
                if (userSpecifiedBLAS.equalsIgnoreCase("auto")) {
                    blas = new String[] { "mkl", "openblas" };
                }

                if (checkAndLoadBLAS(customLibPath, blas)
                        && loadLibraryHelper("libsystemml_" + blasType + "-Linux-x86_64.so")) {
                    LOG.info("Using native blas: " + blasType + getNativeBLASPath());
                    CURRENT_NATIVE_BLAS_STATE = NativeBlasState.SUCCESSFULLY_LOADED_NATIVE_BLAS_AND_IN_USE;
                }
            }
        }
        double timeToLoadInMilliseconds = (System.nanoTime() - start) * 1e-6;
        if (timeToLoadInMilliseconds > 1000)
            LOG.warn("Time to load native blas: " + timeToLoadInMilliseconds + " milliseconds.");
    } else if (LOG.isDebugEnabled() && !isSupportedBLAS(userSpecifiedBLAS)) {
        LOG.debug("Using internal Java BLAS as native BLAS support the configuration 'sysml.native.blas'="
                + userSpecifiedBLAS + ".");
    }
}

From source file:org.apache.tez.dag.app.TestMockDAGAppMaster.java

@Test(timeout = 10000)
public void testBasicCounters() throws Exception {
    TezConfiguration tezconf = new TezConfiguration(defaultConf);
    MockTezClient tezClient = new MockTezClient("testMockAM", tezconf, true, null, null, null, null, false,
            false);//from  w w w .j  a v a  2  s  . c o m
    tezClient.start();

    final String vAName = "A";
    final String vBName = "B";
    final String procCounterName = "Proc";
    final String globalCounterName = "Global";
    DAG dag = DAG.create("testBasicCounters");
    Vertex vA = Vertex.create(vAName, ProcessorDescriptor.create("Proc.class"), 10);
    Vertex vB = Vertex.create(vBName, ProcessorDescriptor.create("Proc.class"), 1);
    dag.addVertex(vA).addVertex(vB).addEdge(
            Edge.create(vA, vB, EdgeProperty.create(DataMovementType.SCATTER_GATHER, DataSourceType.PERSISTED,
                    SchedulingType.SEQUENTIAL, OutputDescriptor.create("Out"), InputDescriptor.create("In"))));
    TezCounters temp = new TezCounters();
    temp.findCounter(new String(globalCounterName), new String(globalCounterName)).increment(1);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutput out = new DataOutputStream(bos);
    temp.write(out);
    final byte[] payload = bos.toByteArray();

    MockDAGAppMaster mockApp = tezClient.getLocalClient().getMockApp();
    MockContainerLauncher mockLauncher = mockApp.getContainerLauncher();
    mockLauncher.startScheduling(false);
    mockApp.countersDelegate = new CountersDelegate() {
        @Override
        public TezCounters getCounters(TaskSpec taskSpec) {
            String vName = taskSpec.getVertexName();
            TezCounters counters = new TezCounters();
            final DataInputByteBuffer in = new DataInputByteBuffer();
            in.reset(ByteBuffer.wrap(payload));
            try {
                // this ensures that the serde code path is covered.
                // the internal merges of counters covers the constructor code path.
                counters.readFields(in);
            } catch (IOException e) {
                Assert.fail(e.getMessage());
            }
            counters.findCounter(vName, procCounterName).increment(1);
            for (OutputSpec output : taskSpec.getOutputs()) {
                counters.findCounter(vName, output.getDestinationVertexName()).increment(1);
            }
            for (InputSpec input : taskSpec.getInputs()) {
                counters.findCounter(vName, input.getSourceVertexName()).increment(1);
            }
            return counters;
        }
    };
    mockApp.doSleep = false;
    DAGClient dagClient = tezClient.submitDAG(dag);
    mockLauncher.waitTillContainersLaunched();
    DAGImpl dagImpl = (DAGImpl) mockApp.getContext().getCurrentDAG();
    mockLauncher.startScheduling(true);
    DAGStatus status = dagClient.waitForCompletion();
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, status.getState());
    TezCounters counters = dagImpl.getAllCounters();

    String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
    if (SystemUtils.IS_OS_LINUX) {
        Assert.assertTrue(counters.findCounter(DAGCounter.AM_CPU_MILLISECONDS).getValue() > 0);
    }

    // verify processor counters
    Assert.assertEquals(10, counters.findCounter(vAName, procCounterName).getValue());
    Assert.assertEquals(1, counters.findCounter(vBName, procCounterName).getValue());
    // verify edge counters
    Assert.assertEquals(10, counters.findCounter(vAName, vBName).getValue());
    Assert.assertEquals(1, counters.findCounter(vBName, vAName).getValue());
    // verify global counters
    Assert.assertEquals(11, counters.findCounter(globalCounterName, globalCounterName).getValue());
    VertexImpl vAImpl = (VertexImpl) dagImpl.getVertex(vAName);
    VertexImpl vBImpl = (VertexImpl) dagImpl.getVertex(vBName);
    TezCounters vACounters = vAImpl.getAllCounters();
    TezCounters vBCounters = vBImpl.getAllCounters();
    String vACounterName = vACounters.findCounter(globalCounterName, globalCounterName).getName();
    String vBCounterName = vBCounters.findCounter(globalCounterName, globalCounterName).getName();
    if (vACounterName != vBCounterName) {
        Assert.fail("String counter name objects dont match despite interning.");
    }
    CounterGroup vaGroup = vACounters.getGroup(globalCounterName);
    String vaGrouName = vaGroup.getName();
    CounterGroup vBGroup = vBCounters.getGroup(globalCounterName);
    String vBGrouName = vBGroup.getName();
    if (vaGrouName != vBGrouName) {
        Assert.fail("String group name objects dont match despite interning.");
    }

    tezClient.stop();
}

From source file:org.bimserver.test.framework.tests.TestAll.java

public static void main(String[] args) {
    TestConfiguration testConfiguration = new TestConfiguration();
    TestFramework testFramework = new TestFramework(testConfiguration,
            new OptionsParser(args).getPluginDirectories());

    testConfiguration.setActionFactory(new AllActionsFactory(testFramework));
    testConfiguration/*from ww  w .j a v a2s  .  com*/
            .setBimServerClientFactory(new RandomBimServerClientFactory(testFramework, 8080, Type.JSON));
    if (SystemUtils.IS_OS_LINUX) {
        testConfiguration.setTestFileProvider(new FolderWalker(Paths.get("/var/ifc"), testFramework));
        testConfiguration.setOutputFolder(Paths.get("/var/www/test.bimserver.logic-labs.nl/www"));
        testConfiguration.setHomeDir(Paths.get("/var/bimservertest/test"));
    } else {
        testConfiguration.setHomeDir(Paths.get("D:\\BIMserverTest"));
        testConfiguration.setTestFileProvider(
                new FolderWalker(Paths.get("D:\\Dropbox\\Shared\\IFC files public"), testFramework));
        testConfiguration.setOutputFolder(Paths.get("E:\\Output"));
    }
    testConfiguration.setNrVirtualUsers(4);
    testConfiguration.setStopNoVirtualUsers(false);
    testConfiguration.setStopOnServerException(false);
    testConfiguration.setNrEngineProcesses(8);

    testFramework.start();
}

From source file:org.bimserver.test.framework.tests.TestCheckinAll.java

public static void main(String[] args) {
    TestConfiguration testConfiguration = new TestConfiguration();
    TestFramework testFramework = new TestFramework(testConfiguration,
            new OptionsParser(args).getPluginDirectories());

    if (SystemUtils.IS_OS_LINUX) {
        testConfiguration.setTestFileProvider(new FolderWalker(Paths.get("/var/ifc"), testFramework));
        testConfiguration.setOutputFolder(Paths.get("/var/www/test.bimserver.logic-labs.nl/www"));
        testConfiguration.setHomeDir(Paths.get("/var/bimservertest/test"));
    } else {//ww  w.  ja v  a 2 s  .c o  m
        testConfiguration.setHomeDir(Paths.get("D:\\BIMserverTest"));
        testConfiguration.setTestFileProvider(
                new FolderWalker(Paths.get("D:\\Dropbox\\Shared\\IFC files public"), testFramework));
        testConfiguration.setOutputFolder(Paths.get("E:\\Output"));
    }

    testConfiguration.setActionFactory(new CheckinActionsFactory(testFramework));
    testConfiguration
            .setBimServerClientFactory(new RandomBimServerClientFactory(testFramework, 8080, Type.JSON));
    testConfiguration.setNrVirtualUsers(4);

    testFramework.start();
}

From source file:org.cleartk.util.PlatformDetection.java

public PlatformDetection() {
    // resolve OS
    if (SystemUtils.IS_OS_WINDOWS) {
        this.os = OS_WINDOWS;
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        this.os = OS_OSX;
    } else if (SystemUtils.IS_OS_SOLARIS) {
        this.os = OS_SOLARIS;
    } else if (SystemUtils.IS_OS_LINUX) {
        this.os = OS_LINUX;
    } else {/* w w w  .  j  a va  2s  .  co  m*/
        throw new IllegalArgumentException("Unknown operating system " + SystemUtils.OS_NAME);
    }

    // resolve architecture
    Map<String, String> archMap = new HashMap<String, String>();
    archMap.put("x86", ARCH_X86_32);
    archMap.put("i386", ARCH_X86_32);
    archMap.put("i486", ARCH_X86_32);
    archMap.put("i586", ARCH_X86_32);
    archMap.put("i686", ARCH_X86_32);
    archMap.put("x86_64", ARCH_X86_64);
    archMap.put("amd64", ARCH_X86_64);
    archMap.put("powerpc", ARCH_PPC);
    this.arch = archMap.get(SystemUtils.OS_ARCH);
    if (this.arch == null) {
        throw new IllegalArgumentException("Unknown architecture " + SystemUtils.OS_ARCH);
    }
}

From source file:org.codice.ddf.catalog.content.plugin.video.VideoThumbnailPluginTest.java

/** create mock methods */
private BundleContext createMockBundleContext() {
    final BundleContext mockBundleContext = mock(BundleContext.class);

    final Bundle mockBundle = mock(Bundle.class);
    doReturn(mockBundle).when(mockBundleContext).getBundle();

    String ffmpegResourcePath;//w ww.  jav  a2  s.co  m
    URL ffmpegBinaryUrl;

    if (SystemUtils.IS_OS_LINUX) {
        ffmpegResourcePath = "linux/ffmpeg-4.0";
    } else if (SystemUtils.IS_OS_MAC) {
        ffmpegResourcePath = "osx/ffmpeg-4.0";
        //      Skip unit tests on Windows. See DDF-3503.
        //    } else if (SystemUtils.IS_OS_WINDOWS) {
        //      ffmpegResourcePath = "windows/ffmpeg.exe";
    } else {
        fail("Platform is not Linux, Mac, or Windows. No FFmpeg binaries are provided for this platform.");
        return null;
    }

    ffmpegBinaryUrl = getClass().getClassLoader().getResource(ffmpegResourcePath);

    doReturn(ffmpegBinaryUrl).when(mockBundle).getEntry(ffmpegResourcePath);

    return mockBundleContext;
}