Search in sources :

Example 16 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class JobRepositoryTest method setup.

@Before
public void setup() {
    JetConfig config = new JetConfig();
    Properties properties = config.getProperties();
    properties.setProperty(JOB_SCAN_PERIOD.getName(), Long.toString(JOB_SCAN_PERIOD_IN_MILLIS));
    instance = createJetMember(config);
    jobRepository = new JobRepository(instance, null);
    jobRepository.setResourcesExpirationMillis(RESOURCES_EXPIRATION_TIME_MILLIS);
    jobIds = instance.getMap(RANDOM_IDS_MAP_NAME);
}
Also used : Properties(java.util.Properties) JetConfig(com.hazelcast.jet.config.JetConfig) Before(org.junit.Before)

Example 17 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class XmlConfigTest method when_filePathSpecified_usesSpecifiedFile.

@Test
public void when_filePathSpecified_usesSpecifiedFile() throws IOException {
    // Given
    File tempFile = File.createTempFile("jet", ".xml");
    try (FileOutputStream os = new FileOutputStream(tempFile)) {
        InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(TEST_XML_1);
        os.write(Util.readFully(resourceAsStream));
    }
    Properties properties = new Properties();
    properties.put(XmlJetConfigLocator.HAZELCAST_JET_CONFIG_PROPERTY, tempFile.getAbsolutePath());
    // When
    JetConfig jetConfig = XmlJetConfigBuilder.getConfig(properties);
    // Then
    assertConfig(jetConfig);
    assertDefaultMemberConfig(jetConfig.getHazelcastConfig());
}
Also used : InputStream(java.io.InputStream) FileOutputStream(java.io.FileOutputStream) Properties(java.util.Properties) File(java.io.File) JetConfig(com.hazelcast.jet.config.JetConfig) Test(org.junit.Test)

Example 18 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class XmlConfigTest method when_noConfigSpecified_usesDefaultConfig.

@Test
public void when_noConfigSpecified_usesDefaultConfig() {
    // When
    JetConfig jetConfig = XmlJetConfigBuilder.getConfig(new Properties());
    // Then
    assertEquals(Runtime.getRuntime().availableProcessors(), jetConfig.getInstanceConfig().getCooperativeThreadCount());
    assertEquals(DEFAULT_FLOW_CONTROL_PERIOD_MS, jetConfig.getInstanceConfig().getFlowControlPeriodMs());
    assertDefaultMemberConfig(jetConfig.getHazelcastConfig());
}
Also used : Properties(java.util.Properties) JetConfig(com.hazelcast.jet.config.JetConfig) Test(org.junit.Test)

Example 19 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class XmlConfigTest method when_configHasVariable_variablesAreReplaced.

@Test
public void when_configHasVariable_variablesAreReplaced() {
    // Given
    Properties properties = new Properties();
    properties.put(XmlJetConfigLocator.HAZELCAST_JET_CONFIG_PROPERTY, "classpath:hazelcast-jet-with-variables.xml");
    properties.put("working.directory", "/var/tmp");
    properties.put("thread.count", String.valueOf(55));
    properties.put("flow.control.period", "50");
    properties.put("backup.count", "2");
    // When
    JetConfig jetConfig = XmlJetConfigBuilder.getConfig(properties);
    // Then
    assertConfig(jetConfig);
}
Also used : Properties(java.util.Properties) JetConfig(com.hazelcast.jet.config.JetConfig) Test(org.junit.Test)

Example 20 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class SnapshotFailureTest method setup.

@Before
public void setup() {
    JetConfig config = new JetConfig();
    config.getInstanceConfig().setCooperativeThreadCount(LOCAL_PARALLELISM);
    // force snapshots to fail by adding a failing map store configuration for snapshot data maps
    MapConfig mapConfig = new MapConfig(SnapshotRepository.SNAPSHOT_DATA_NAME_PREFIX + '*');
    MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    mapStoreConfig.setEnabled(true);
    mapStoreConfig.setImplementation(new FailingMapStore());
    config.getHazelcastConfig().addMapConfig(mapConfig);
    config.getHazelcastConfig().addEventJournalConfig(new EventJournalConfig().setMapName(SnapshotRepository.SNAPSHOT_NAME_PREFIX + '*'));
    JetInstance[] instances = createJetMembers(config, 2);
    instance1 = instances[0];
}
Also used : JetInstance(com.hazelcast.jet.JetInstance) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) JetConfig(com.hazelcast.jet.config.JetConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) Before(org.junit.Before)

Aggregations

JetConfig (com.hazelcast.jet.config.JetConfig)56 Before (org.junit.Before)21 Test (org.junit.Test)15 JetInstance (com.hazelcast.jet.JetInstance)14 Config (com.hazelcast.config.Config)10 Properties (java.util.Properties)9 EventJournalConfig (com.hazelcast.config.EventJournalConfig)8 CountDownLatch (java.util.concurrent.CountDownLatch)7 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)4 EdgeConfig (com.hazelcast.jet.config.EdgeConfig)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 MapConfig (com.hazelcast.config.MapConfig)3 JobConfig (com.hazelcast.jet.config.JobConfig)3 MockPS (com.hazelcast.jet.core.TestProcessors.MockPS)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 InputStream (java.io.InputStream)3 JoinConfig (com.hazelcast.config.JoinConfig)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 JetTestInstanceFactory (com.hazelcast.jet.JetTestInstanceFactory)2 Job (com.hazelcast.jet.Job)2