-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate code gen to use protocol list
- Loading branch information
Showing
18 changed files
with
104 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/MetadataTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.amazonaws.util.awsclientgenerator.domainmodels.codegeneration; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class MetadataTest { | ||
@Test | ||
public void shouldPreferProtocolOverProtocolsForApiGateway() { | ||
Metadata metadata = new Metadata(); | ||
metadata.setProtocol("api-gateway"); | ||
metadata.setProtocols(ImmutableList.of("json")); | ||
Assert.assertEquals("api-gateway", metadata.findFirstSupportedProtocol()); | ||
} | ||
|
||
@Test | ||
public void shouldPreferProtocolsOverProtocol() { | ||
Metadata metadata = new Metadata(); | ||
metadata.setProtocol("rest-json"); | ||
metadata.setProtocols(ImmutableList.of("json")); | ||
Assert.assertEquals("json", metadata.findFirstSupportedProtocol()); | ||
} | ||
|
||
@Test | ||
public void shouldPreferBestFitProtocol() { | ||
Metadata metadata = new Metadata(); | ||
metadata.setProtocol("rest-json"); | ||
metadata.setProtocols(ImmutableList.of("rest-json", "json")); | ||
Assert.assertEquals("json", metadata.findFirstSupportedProtocol()); | ||
} | ||
|
||
@Test | ||
public void shouldUseProtocolWhenProtocolsIsMissing() { | ||
Metadata metadata = new Metadata(); | ||
metadata.setProtocol("rest-json"); | ||
metadata.setProtocols(ImmutableList.of()); | ||
Assert.assertEquals("rest-json", metadata.findFirstSupportedProtocol()); | ||
} | ||
|
||
@Test | ||
public void shouldThrowExeceptionWhenUnsupportedProtocol() { | ||
Metadata metadata = new Metadata(); | ||
metadata.setServiceFullName("ServiceName"); | ||
metadata.setProtocols(ImmutableList.of("grpc")); | ||
Assert.assertThrows("No supported protocol found for ServiceName", RuntimeException.class, metadata::findFirstSupportedProtocol); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters