Example usage for java.time Duration ofSeconds

List of usage examples for java.time Duration ofSeconds

Introduction

In this page you can find the example usage for java.time Duration ofSeconds.

Prototype

public static Duration ofSeconds(long seconds) 

Source Link

Document

Obtains a Duration representing a number of seconds.

Usage

From source file:org.cloudfoundry.reactor.uaa.identityproviders.ReactorIdentityProvidersTest.java

@Test
public void delete() {
    mockRequest(InteractionContext.builder()
            .request(TestRequest.builder().method(DELETE)
                    .path("/identity-providers/test-identity-provider-id?rawConfig=true")
                    .header("X-Identity-Zone-Id", "test-identity-zone-id").build())
            .response(TestResponse.builder().status(OK)
                    .payload("fixtures/uaa/identity-providers/DELETE_{id}_response.json").build())
            .build());//from ww w  . j a v a2 s  .  c o m

    this.identityProviders
            .delete(DeleteIdentityProviderRequest.builder().identityProviderId("test-identity-provider-id")
                    .identityZoneId("test-identity-zone-id").build())
            .as(StepVerifier::create)
            .expectNext(DeleteIdentityProviderResponse.builder().active(true).createdAt(1466035298319L)
                    .configuration(SamlConfiguration.builder().addShadowUserOnLogin(true)
                            .assertionConsumerIndex(0).attributeMappings(AttributeMappings.builder().build())
                            .externalGroupsWhitelist(Collections.emptyList())
                            .groupMappingMode(ExternalGroupMappingMode.EXPLICITLY_MAPPED)
                            .idpEntityAlias("saml-for-delete")
                            .linkText("IDPEndpointsMockTests Saml Provider:saml-for-delete")
                            .metaDataLocation(
                                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\" entityID=\"http://www.okta"
                                            + ".com/saml-for-delete\"><md:IDPSSODescriptor WantAuthnRequestsSigned=\"true\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\"><md:KeyDescriptor "
                                            + "use=\"signing\"><ds:KeyInfo xmlns:ds=\"http://www.w3"
                                            + ".org/2000/09/xmldsig#\"><ds:X509Data><ds:X509Certificate>MIICmTCCAgKgAwIBAgIGAUPATqmEMA0GCSqGSIb3DQEBBQUAMIGPMQswCQYDVQQGEwJVUzETMBEG"
                                            + "\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\nMBIGA1UECwwLU1NPUHJvdmlkZXIxEDAOBgNVBAMMB1Bpdm90YWwxHDAaBgkqhkiG9w0BCQEWDWlu"
                                            + "\nZm9Ab2t0YS5jb20wHhcNMTQwMTIzMTgxMjM3WhcNNDQwMTIzMTgxMzM3WjCBjzELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNVBAoM"
                                            + "\nBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRAwDgYDVQQDDAdQaXZvdGFsMRwwGgYJKoZIhvcN\nAQkBFg1pbmZvQG9rdGEuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeil67/TLOiTZU"
                                            + "\nWWgW2XEGgFZ94bVO90v5J1XmcHMwL8v5Z/8qjdZLpGdwI7Ph0CyXMMNklpaR/Ljb8fsls3amdT5O\nBw92Zo8ulcpjw2wuezTwL0eC0wY/GQDAZiXL59npE6U+fH1lbJIq92hx0HJSru/0O1q3+A/+jjZL\n3tL"
                                            + "/SwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAI5BoWZoH6Mz9vhypZPOJCEKa/K+biZQsA4Zqsuk\nvvphhSERhqk/Nv76Vkl8uvJwwHbQrR9KJx4L3PRkGCG24rix71jEuXVGZUsDNM3CUKnARx4MEab6\nGFHNkZ6DmoT"
                                            + "/PFagngecHu+EwmuDtaG0rEkFrARwe+d8Ru0BN558abFb</ds:X509Certificate></ds:X509Data></ds:KeyInfo></md:KeyDescriptor><md:NameIDFormat>urn:oasis:names:tc:SAML:1"
                                            + ".1:nameid-format:emailAddress</md:NameIDFormat><md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat><md:SingleSignOnService "
                                            + "Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" Location=\"https://pivotal.oktapreview"
                                            + ".com/app/pivotal_pivotalcfstaging_1/k2lw4l5bPODCMIIDBRYZ/sso/saml\"/><md:SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" "
                                            + "Location=\"https://pivotal.oktapreview.com/app/pivotal_pivotalcfstaging_1/k2lw4l5bPODCMIIDBRYZ/sso/saml\"/></md:IDPSSODescriptor></md:EntityDescriptor>\n")
                            .metadataTrustCheck(false)
                            .nameId("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress")
                            .showSamlLink(false)
                            .socketFactoryClassName(
                                    "org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory")
                            .zoneId("uaa").build())
                    .id("3ba5978b-8db1-4f27-bfbd-f24f6773b52f").identityZoneId("uaa")
                    .lastModified(1466035298319L).name("saml-for-delete name").originKey("saml-for-delete")
                    .type(Type.SAML).version(0).build())
            .expectComplete().verify(Duration.ofSeconds(5));
}

From source file:org.cloudfoundry.reactor.uaa.identityproviders.ReactorIdentityProvidersTest.java

@Test
public void get() {
    mockRequest(InteractionContext.builder()
            .request(TestRequest.builder().method(GET)
                    .path("/identity-providers/test-identity-provider-id?rawConfig=true")
                    .header("X-Identity-Zone-Id", "test-identity-zone-id").build())
            .response(TestResponse.builder().status(CREATED)
                    .payload("fixtures/uaa/identity-providers/GET_{id}_response.json").build())
            .build());//from   w w w  . ja  va2s  . c  o m

    this.identityProviders
            .get(GetIdentityProviderRequest.builder().identityProviderId("test-identity-provider-id")
                    .identityZoneId("test-identity-zone-id").build())
            .as(StepVerifier::create)
            .expectNext(GetIdentityProviderResponse.builder().active(true).createdAt(1465001966715L)
                    .configuration(SamlConfiguration.builder().addShadowUserOnLogin(true)
                            .assertionConsumerIndex(0).attributeMappings(AttributeMappings.builder().build())
                            .externalGroupsWhitelist(Collections.emptyList())
                            .groupMappingMode(ExternalGroupMappingMode.EXPLICITLY_MAPPED)
                            .idpEntityAlias("saml-for-get")
                            .linkText("IDPEndpointsMockTests Saml Provider:saml-for-get")
                            .metaDataLocation(
                                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\" entityID=\"http://www.okta"
                                            + ".com/saml-for-get\"><md:IDPSSODescriptor WantAuthnRequestsSigned=\"true\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\"><md:KeyDescriptor "
                                            + "use=\"signing\"><ds:KeyInfo xmlns:ds=\"http://www.w3"
                                            + ".org/2000/09/xmldsig#\"><ds:X509Data><ds:X509Certificate>MIICmTCCAgKgAwIBAgIGAUPATqmEMA0GCSqGSIb3DQEBBQUAMIGPMQswCQYDVQQGEwJVUzETMBEG"
                                            + "\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\nMBIGA1UECwwLU1NPUHJvdmlkZXIxEDAOBgNVBAMMB1Bpdm90YWwxHDAaBgkqhkiG9w0BCQEWDWlu"
                                            + "\nZm9Ab2t0YS5jb20wHhcNMTQwMTIzMTgxMjM3WhcNNDQwMTIzMTgxMzM3WjCBjzELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNVBAoM"
                                            + "\nBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRAwDgYDVQQDDAdQaXZvdGFsMRwwGgYJKoZIhvcN\nAQkBFg1pbmZvQG9rdGEuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeil67/TLOiTZU"
                                            + "\nWWgW2XEGgFZ94bVO90v5J1XmcHMwL8v5Z/8qjdZLpGdwI7Ph0CyXMMNklpaR/Ljb8fsls3amdT5O\nBw92Zo8ulcpjw2wuezTwL0eC0wY/GQDAZiXL59npE6U+fH1lbJIq92hx0HJSru/0O1q3+A/+jjZL\n3tL"
                                            + "/SwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAI5BoWZoH6Mz9vhypZPOJCEKa/K+biZQsA4Zqsuk\nvvphhSERhqk/Nv76Vkl8uvJwwHbQrR9KJx4L3PRkGCG24rix71jEuXVGZUsDNM3CUKnARx4MEab6\nGFHNkZ6DmoT"
                                            + "/PFagngecHu+EwmuDtaG0rEkFrARwe+d8Ru0BN558abFb</ds:X509Certificate></ds:X509Data></ds:KeyInfo></md:KeyDescriptor><md:NameIDFormat>urn:oasis:names:tc:SAML:1"
                                            + ".1:nameid-format:emailAddress</md:NameIDFormat><md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat><md:SingleSignOnService "
                                            + "Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" Location=\"https://pivotal.oktapreview"
                                            + ".com/app/pivotal_pivotalcfstaging_1/k2lw4l5bPODCMIIDBRYZ/sso/saml\"/><md:SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" "
                                            + "Location=\"https://pivotal.oktapreview.com/app/pivotal_pivotalcfstaging_1/k2lw4l5bPODCMIIDBRYZ/sso/saml\"/></md:IDPSSODescriptor></md:EntityDescriptor>\n")
                            .metadataTrustCheck(false)
                            .nameId("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress")
                            .showSamlLink(false)
                            .socketFactoryClassName(
                                    "org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory")
                            .zoneId("uaa").build())
                    .id("0077d56d-4e10-447a-9438-57d058e033ae").identityZoneId("uaa")
                    .lastModified(1465001966715L).name("saml-for-get name").originKey("saml-for-get")
                    .type(Type.SAML).version(0).build())
            .expectComplete().verify(Duration.ofSeconds(5));
}

From source file:org.cloudfoundry.reactor.uaa.identityproviders.ReactorIdentityProvidersTest.java

@Test
public void list() {
    mockRequest(InteractionContext.builder()
            .request(TestRequest.builder().method(GET).path("/identity-providers?rawConfig=true")
                    .header("X-Identity-Zone-Id", "test-identity-zone-id").build())
            .response(TestResponse.builder().status(OK)
                    .payload("fixtures/uaa/identity-providers/GET_response.json").build())
            .build());//from  w w  w. j  av  a 2 s.  c  om

    this.identityProviders
            .list(ListIdentityProvidersRequest.builder().identityZoneId("test-identity-zone-id").build())
            .as(StepVerifier::create)
            .expectNext(ListIdentityProvidersResponse.builder().identityProvider(IdentityProvider
                    .builder().active(true).createdAt(1465001965526L).configuration(SamlConfiguration.builder()
                            .addShadowUserOnLogin(true).assertionConsumerIndex(0)
                            .attributeMappings(AttributeMappings.builder().build())
                            .externalGroupsWhitelist(Collections.emptyList())
                            .groupMappingMode(ExternalGroupMappingMode.EXPLICITLY_MAPPED).idpEntityAlias("SAML")
                            .linkText("IDPEndpointsMockTests Saml Provider:SAML")
                            .metaDataLocation(
                                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\" entityID=\"http://www.okta"
                                            + ".com/SAML\"><md:IDPSSODescriptor WantAuthnRequestsSigned=\"true\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\"><md:KeyDescriptor "
                                            + "use=\"signing\"><ds:KeyInfo xmlns:ds=\"http://www.w3"
                                            + ".org/2000/09/xmldsig#\"><ds:X509Data><ds:X509Certificate>MIICmTCCAgKgAwIBAgIGAUPATqmEMA0GCSqGSIb3DQEBBQUAMIGPMQswCQYDVQQGEwJVUzETMBEG"
                                            + "\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\nMBIGA1UECwwLU1NPUHJvdmlkZXIxEDAOBgNVBAMMB1Bpdm90YWwxHDAaBgkqhkiG9w0BCQEWDWlu"
                                            + "\nZm9Ab2t0YS5jb20wHhcNMTQwMTIzMTgxMjM3WhcNNDQwMTIzMTgxMzM3WjCBjzELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNVBAoM"
                                            + "\nBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRAwDgYDVQQDDAdQaXZvdGFsMRwwGgYJKoZIhvcN\nAQkBFg1pbmZvQG9rdGEuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeil67/TLOiTZU"
                                            + "\nWWgW2XEGgFZ94bVO90v5J1XmcHMwL8v5Z/8qjdZLpGdwI7Ph0CyXMMNklpaR/Ljb8fsls3amdT5O\nBw92Zo8ulcpjw2wuezTwL0eC0wY/GQDAZiXL59npE6U+fH1lbJIq92hx0HJSru/0O1q3+A/+jjZL\n3tL"
                                            + "/SwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAI5BoWZoH6Mz9vhypZPOJCEKa/K+biZQsA4Zqsuk\nvvphhSERhqk/Nv76Vkl8uvJwwHbQrR9KJx4L3PRkGCG24rix71jEuXVGZUsDNM3CUKnARx4MEab6\nGFHNkZ6DmoT"
                                            + "/PFagngecHu+EwmuDtaG0rEkFrARwe+d8Ru0BN558abFb</ds:X509Certificate></ds:X509Data></ds:KeyInfo></md:KeyDescriptor><md:NameIDFormat>urn:oasis:names:tc:SAML:1"
                                            + ".1:nameid-format:emailAddress</md:NameIDFormat><md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat><md:SingleSignOnService "
                                            + "Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" Location=\"https://pivotal.oktapreview"
                                            + ".com/app/pivotal_pivotalcfstaging_1/k2lw4l5bPODCMIIDBRYZ/sso/saml\"/><md:SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" "
                                            + "Location=\"https://pivotal.oktapreview.com/app/pivotal_pivotalcfstaging_1/k2lw4l5bPODCMIIDBRYZ/sso/saml\"/></md:IDPSSODescriptor></md:EntityDescriptor>\n")
                            .metadataTrustCheck(false)
                            .nameId("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress")
                            .showSamlLink(false)
                            .socketFactoryClassName(
                                    "org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory")
                            .zoneId("uaa").build())
                    .id("a2e96056-c777-40b8-95b8-ff81b441fcf1").identityZoneId("uaa")
                    .lastModified(1465001965526L).name("SAML name").originKey("SAML").type(Type.SAML).version(0)
                    .build())
                    .identityProvider(IdentityProvider.builder().active(false).createdAt(946713600000L)
                            .id("e6f15c2c-e5fa-46f6-a301-66b802d0102f").identityZoneId("uaa")
                            .lastModified(1465001954764L).name("keystone").originKey("keystone")
                            .type(Type.KEYSTONE).version(1).build())
                    .identityProvider(IdentityProvider.builder().active(false).createdAt(946713600000L)
                            .id("a3b9ef5d-e717-4ea9-91fa-371fa7a32f46").identityZoneId("uaa")
                            .lastModified(1465001955226L).name("ldap").originKey("ldap").type(Type.LDAP)
                            .version(1).build())
                    .identityProvider(IdentityProvider.builder().active(true).createdAt(1465001966855L)
                            .configuration(OAuth2Configuration.builder()
                                    .attributeMappings(AttributeMappings.builder().build())
                                    .authUrl("http://auth.url").externalGroupsWhitelist(Collections.emptyList())
                                    .tokenUrl("http://token.url").tokenKey("token-key").showLinkText(false)
                                    .skipSslVerification(false).relyingPartyId("uaa")
                                    .relyingPartySecret("secret").addShadowUserOnLogin(true).build())
                            .id("16506900-561d-411f-904b-15c3e2722cba").identityZoneId("uaa")
                            .lastModified(1465001966855L).name("UAA Provider").originKey("oauth2.0")
                            .type(Type.OAUTH2).version(0).build())
                    .identityProvider(IdentityProvider.builder().active(true).createdAt(946713600000L)
                            .id("8d364146-ecb3-461e-b294-87580807a08f").identityZoneId("uaa")
                            .lastModified(1465001955249L).name("uaa").originKey("uaa").type(Type.INTERNAL)
                            .version(1).build())
                    .build())
            .expectComplete().verify(Duration.ofSeconds(5));
}

From source file:org.cloudfoundry.reactor.uaa.identityproviders.ReactorIdentityProvidersTest.java

@Test
public void update() {
    mockRequest(InteractionContext.builder()
            .request(TestRequest.builder().method(PUT)
                    .path("/identity-providers/test-identity-provider-id?rawConfig=true")
                    .header("X-Identity-Zone-Id", "test-identity-zone-id")
                    .payload("fixtures/uaa/identity-providers/PUT_{id}_request.json").build())
            .response(TestResponse.builder().status(OK)
                    .payload("fixtures/uaa/identity-providers/PUT_{id}_response.json").build())
            .build());//from  w  ww.  j  a va  2  s. co m

    this.identityProviders
            .update(UpdateIdentityProviderRequest.builder().active(true)
                    .configuration(InternalConfiguration.builder().disableInternalUserManagement(false)
                            .lockoutPolicy(LockoutPolicy.builder().lockAccountPeriodInSecond(8)
                                    .lockoutPeriodInSecond(8).numberOfAllowedFailures(8).build())
                            .build())
                    .name("uaa").originKey("uaa").type(Type.INTERNAL).version(1)
                    .identityZoneId("test-identity-zone-id").identityProviderId("test-identity-provider-id")
                    .build())
            .as(StepVerifier::create)
            .expectNext(UpdateIdentityProviderResponse.builder().active(true).createdAt(946713600000L)
                    .configuration(InternalConfiguration.builder().disableInternalUserManagement(false)
                            .lockoutPolicy(LockoutPolicy.builder().lockAccountPeriodInSecond(8)
                                    .lockoutPeriodInSecond(8).numberOfAllowedFailures(8).build())
                            .build())
                    .id("test-identity-provider-id").identityZoneId("uaa").lastModified(1465001967669L)
                    .name("uaa").originKey("uaa").type(Type.INTERNAL).version(2).build())
            .expectComplete().verify(Duration.ofSeconds(5));
}

From source file:org.janusgraph.CassandraStorageSetup.java

private static ModifiableConfiguration getGenericConfiguration(String ks, String backend) {
    ModifiableConfiguration config = buildGraphConfiguration();
    config.set(CASSANDRA_KEYSPACE, cleanKeyspaceName(ks));
    log.debug("Set keyspace name: {}", config.get(CASSANDRA_KEYSPACE));
    config.set(PAGE_SIZE, 500);/*from   w  ww  . j  a v a2s. co m*/
    config.set(CONNECTION_TIMEOUT, Duration.ofSeconds(60L));
    config.set(STORAGE_BACKEND, backend);
    return config;
}

From source file:org.janusgraph.codepipelines.AwsCodePipelinesCi.java

private void run() throws IOException {
    final File file = new File(getOptionValue(PIPELINES_JSON_OPTION));
    final Region region = Region.of(getOptionValue(REGION_OPTION));
    final AwsCredentialsProvider provider = ProfileCredentialsProvider.builder()
            .profileName(getOptionValue(PROFILE_OPTION)).build();

    final ClientHttpConfiguration http = ClientHttpConfiguration.builder()
            .httpClient(ApacheSdkHttpClientFactory.builder() //consider netty some other time
                    .socketTimeout(Duration.ofSeconds(10)).connectionTimeout(Duration.ofMillis(750)).build()
                    .createHttpClient())
            .build();//from www .  j a v  a 2 s  . co m

    final AwsCodePipelinesLogic.AwsCodePipelinesLogicBuilder builder = AwsCodePipelinesLogic.builder()
            .githubToken(getOptionValue(GITHUB_TOKEN_OPTION)).githubOwner(getOptionValue(GITHUB_OWNER_OPTION))
            .githubRepo(getOptionValue(GITHUB_REPO_OPTION)).githubBranch(getOptionValue(GITHUB_BRANCH_OPTION))
            .codeBuildServiceRoleArn(getOptionValue(CODE_BUILD_SERVICE_ROLE_ARN_OPTION))
            .codePipelineRoleArn(getOptionValue(CODEPIPELINE_ROLE_ARN_OPTION))
            .s3Bucket(getOptionValue(BUCKET_OPTION))
            .s3BucketLocationConstraint(BucketLocationConstraint.fromValue(region.value()))
            .s3(S3Client.builder().httpConfiguration(http).region(region).credentialsProvider(provider).build())
            .codeBuild(CodeBuildClient.builder().httpConfiguration(http).region(region)
                    .credentialsProvider(provider).build())
            .codePipeline(CodePipelineClient.builder().httpConfiguration(http).region(region)
                    .credentialsProvider(provider).build());

    final Tag timeTag = Tag.builder().key("date").value(Long.toString(System.currentTimeMillis())).build();
    final PipelineDefinitions definitions = new ObjectMapper(new YAMLFactory()).readValue(file,
            PipelineDefinitions.class);
    definitions.getPipelines().stream()
            .map(def -> builder.pipelineName(def.getName()).sourceOutputArtifactName(def.getName() + "Source")
                    .parallelBuildActions(def.getParallelBuildActions())
                    .defaultComputeImage(definitions.getDefaultComputeImage())
                    .defaultComputeType(definitions.getDefaultComputeType())
                    .defaultPrivilegedMode(definitions.isDefaultPrivilegedMode())
                    .tags(ImmutableList.of(Tag.builder().key("project").value(def.getName()).build(), timeTag))
                    .build())
            .forEach(AwsCodePipelinesLogic::run);
}

From source file:org.janusgraph.diskstorage.cql.CassandraStorageSetup.java

public static ModifiableConfiguration getCQLConfiguration(final String keyspace) {
    final ModifiableConfiguration config = buildGraphConfiguration();
    config.set(KEYSPACE, cleanKeyspaceName(keyspace));
    LOGGER.debug("Set keyspace name: {}", config.get(KEYSPACE));
    config.set(PAGE_SIZE, 500);//w  w  w . j  av  a  2 s .  co  m
    config.set(CONNECTION_TIMEOUT, Duration.ofSeconds(60L));
    config.set(STORAGE_BACKEND, "cql");
    if (HOSTNAME != null)
        config.set(STORAGE_HOSTS, new String[] { HOSTNAME });
    config.set(DROP_ON_CLEAR, false);
    return config;
}

From source file:org.janusgraph.graphdb.database.management.ManagementSystem.java

@Override
public Duration getTTL(final JanusGraphSchemaType type) {
    Preconditions.checkArgument(type != null);
    int ttl;//from  ww  w .  ja  v  a  2 s  .  c  o  m
    if (type instanceof VertexLabelVertex) {
        ttl = ((VertexLabelVertex) type).getTTL();
    } else if (type instanceof RelationTypeVertex) {
        ttl = ((RelationTypeVertex) type).getTTL();
    } else {
        throw new IllegalArgumentException("given type does not support TTL: " + type.getClass());
    }
    return Duration.ofSeconds(ttl);
}

From source file:org.janusgraph.graphdb.types.system.ImplicitKey.java

public <O> O computeProperty(InternalElement e) {
    if (this == ID) {
        return (O) e.id();
    } else if (this == JANUSGRAPHID) {
        return (O) Long.valueOf(e.longId());
    } else if (this == LABEL) {
        return (O) e.label();
    } else if (this == KEY) {
        if (e instanceof JanusGraphProperty)
            return (O) ((JanusGraphProperty) e).key();
        else//from  ww w.j a va2s.  c  o  m
            return null;
    } else if (this == VALUE) {
        if (e instanceof JanusGraphProperty)
            return (O) ((JanusGraphProperty) e).value();
        else
            return null;
    } else if (this == TIMESTAMP || this == VISIBILITY) {
        if (e instanceof InternalRelation) {
            InternalRelation r = (InternalRelation) e;
            if (this == VISIBILITY) {
                return r.getValueDirect(this);
            } else {
                assert this == TIMESTAMP;
                Long time = r.getValueDirect(this);
                if (time == null)
                    return null; //there is no timestamp
                return (O) r.tx().getConfiguration().getTimestampProvider().getTime(time);
            }
        } else {
            return null;
        }
    } else if (this == TTL) {
        int ttl;
        if (e instanceof InternalRelation) {
            ttl = ((InternalRelationType) ((InternalRelation) e).getType()).getTTL();
        } else if (e instanceof InternalVertex) {
            ttl = ((InternalVertexLabel) ((InternalVertex) e).vertexLabel()).getTTL();
        } else {
            ttl = 0;
        }
        return (O) Duration.ofSeconds(ttl);
    } else
        throw new AssertionError("Implicit key property is undefined: " + this.name());
}

From source file:org.nuxeo.runtime.AbstractRuntimeService.java

@Override
public synchronized void start() {
    if (isStarted) {
        return;/*from w  w  w .  j a  va  2 s .  c  om*/
    }
    if (Boolean.parseBoolean(getProperty(REDIRECT_JUL, "false"))) {
        Level threshold = Level.parse(getProperty(REDIRECT_JUL_THRESHOLD, "INFO").toUpperCase());
        JavaUtilLoggingHelper.redirectToApacheCommons(threshold);
    }
    log.info("Starting Nuxeo Runtime service " + getName() + "; version: " + getVersion());
    // NXRuntime.setInstance(this);
    manager = createComponentManager();
    Framework.sendEvent(new RuntimeServiceEvent(RuntimeServiceEvent.RUNTIME_ABOUT_TO_START, this));
    ServicePassivator.passivate().withQuietDelay(Duration.ofSeconds(0)).monitor()
            .withTimeout(Duration.ofSeconds(0)).withEnforceMode(false).await().proceed(() -> {
                try {
                    doStart();
                    startExtensions();
                } finally {
                    Framework.sendEvent(new RuntimeServiceEvent(RuntimeServiceEvent.RUNTIME_STARTED, this));
                    isStarted = true;
                }
            });
}