Tabnine Logo
SingleSelectCapability.getDefault
Code IndexAdd Tabnine to your IDE (free)

How to use
getDefault
method
in
io.spring.initializr.metadata.SingleSelectCapability

Best Java code snippets using io.spring.initializr.metadata.SingleSelectCapability.getDefault (Showing top 9 results out of 315)

origin: spring-io/initializr

protected void singleSelect(ObjectNode parent, SingleSelectCapability capability) {
  ObjectNode single = nodeFactory.objectNode();
  single.put("type", capability.getType().getName());
  DefaultMetadataElement defaultType = capability.getDefault();
  if (defaultType != null) {
    single.put("default", defaultType.getId());
  }
  ArrayNode values = nodeFactory.arrayNode();
  values.addAll(capability.getContent().stream().map(this::mapValue)
      .collect(Collectors.toList()));
  single.set("values", values);
  parent.set(capability.getId(), single);
}
origin: spring-io/initializr

@Test
void defaultEmpty() {
  SingleSelectCapability capability = new SingleSelectCapability("test");
  assertThat(capability.getDefault()).isNull();
}
origin: spring-io/initializr

@Test
void defaultType() {
  SingleSelectCapability capability = new SingleSelectCapability("test");
  capability.getContent().add(DefaultMetadataElement.create("foo", false));
  DefaultMetadataElement second = DefaultMetadataElement.create("bar", true);
  capability.getContent().add(second);
  assertThat(capability.getDefault()).isEqualTo(second);
}
origin: spring-io/initializr

private ResponseEntity<String> dependenciesFor(InitializrMetadataVersion version,
    String bootVersion) {
  InitializrMetadata metadata = this.metadataProvider.get();
  Version v = (bootVersion != null) ? Version.parse(bootVersion)
      : Version.parse(metadata.getBootVersions().getDefault().getId());
  DependencyMetadata dependencyMetadata = this.dependencyMetadataProvider
      .get(metadata, v);
  String content = new DependencyMetadataV21JsonMapper().write(dependencyMetadata);
  return ResponseEntity.ok().contentType(version.getMediaType())
      .eTag(createUniqueId(content))
      .cacheControl(CacheControl.maxAge(7, TimeUnit.DAYS)).body(content);
}
origin: spring-io/initializr

@Test
void defaultNoDefault() {
  SingleSelectCapability capability = new SingleSelectCapability("test");
  capability.getContent().add(DefaultMetadataElement.create("foo", false));
  capability.getContent().add(DefaultMetadataElement.create("bar", false));
  assertThat(capability.getDefault()).isNull();
}
origin: spring-io/initializr

@Test
void initializeSetsMetadataDefaults() {
  ProjectRequest request = initProjectRequest();
  assertThat(request.getName()).isEqualTo(this.metadata.getName().getContent());
  assertThat(request.getType())
      .isEqualTo(this.metadata.getTypes().getDefault().getId());
  assertThat(request.getDescription())
      .isEqualTo(this.metadata.getDescription().getContent());
  assertThat(request.getGroupId())
      .isEqualTo(this.metadata.getGroupId().getContent());
  assertThat(request.getArtifactId())
      .isEqualTo(this.metadata.getArtifactId().getContent());
  assertThat(request.getVersion())
      .isEqualTo(this.metadata.getVersion().getContent());
  assertThat(request.getBootVersion())
      .isEqualTo(this.metadata.getBootVersions().getDefault().getId());
  assertThat(request.getPackaging())
      .isEqualTo(this.metadata.getPackagings().getDefault().getId());
}
origin: spring-io/initializr

@Test
void defaultBootVersionIsAlwaysSet() {
  InitializrMetadata metadata = new InitializrMetadataTestBuilder()
      .addBootVersion("0.0.9.RELEASE", true)
      .addBootVersion("0.0.8.RELEASE", false).build();
  assertThat(metadata.getBootVersions().getDefault().getId())
      .isEqualTo("0.0.9.RELEASE");
  DefaultInitializrMetadataProvider provider = new DefaultInitializrMetadataProvider(
      metadata, objectMapper, this.restTemplate);
  expectJson(metadata.getConfiguration().getEnv().getSpringBootMetadataUrl(),
      "metadata/sagan/spring-boot-no-default.json");
  InitializrMetadata updatedMetadata = provider.get();
  assertThat(updatedMetadata.getBootVersions()).isNotNull();
  List<DefaultMetadataElement> updatedBootVersions = updatedMetadata
      .getBootVersions().getContent();
  assertThat(updatedBootVersions).hasSize(4);
  assertBootVersion(updatedBootVersions.get(0), "1.3.1 (SNAPSHOT)", true);
  assertBootVersion(updatedBootVersions.get(1), "1.3.0", false);
  assertBootVersion(updatedBootVersions.get(2), "1.2.6 (SNAPSHOT)", false);
  assertBootVersion(updatedBootVersions.get(3), "1.2.5", false);
}
origin: spring-io/initializr

@Test
void bootVersionsAreReplaced() {
  InitializrMetadata metadata = new InitializrMetadataTestBuilder()
      .addBootVersion("0.0.9.RELEASE", true)
      .addBootVersion("0.0.8.RELEASE", false).build();
  assertThat(metadata.getBootVersions().getDefault().getId())
      .isEqualTo("0.0.9.RELEASE");
  DefaultInitializrMetadataProvider provider = new DefaultInitializrMetadataProvider(
      metadata, objectMapper, this.restTemplate);
  expectJson(metadata.getConfiguration().getEnv().getSpringBootMetadataUrl(),
      "metadata/sagan/spring-boot.json");
  InitializrMetadata updatedMetadata = provider.get();
  assertThat(updatedMetadata.getBootVersions()).isNotNull();
  List<DefaultMetadataElement> updatedBootVersions = updatedMetadata
      .getBootVersions().getContent();
  assertThat(updatedBootVersions).hasSize(4);
  assertBootVersion(updatedBootVersions.get(0), "1.4.1 (SNAPSHOT)", false);
  assertBootVersion(updatedBootVersions.get(1), "1.4.0", true);
  assertBootVersion(updatedBootVersions.get(2), "1.3.8 (SNAPSHOT)", false);
  assertBootVersion(updatedBootVersions.get(3), "1.3.7", false);
}
origin: spring-io/initializr

List<String> depIds = (!getStyle().isEmpty() ? getStyle() : getDependencies());
String actualBootVersion = (getBootVersion() != null) ? getBootVersion()
    : metadata.getBootVersions().getDefault().getId();
Version requestedVersion = Version.parse(actualBootVersion);
this.resolvedDependencies = depIds.stream().map((it) -> {
io.spring.initializr.metadataSingleSelectCapabilitygetDefault

Javadoc

Return the default element of this capability.

Popular methods of SingleSelectCapability

  • getContent
  • get
  • merge
  • <init>
  • getId
  • getType

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • setContentView (Activity)
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JFileChooser (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now