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
private static String substract1(String binVal) { | |
StringBuilder sb = new StringBuilder(); | |
int remainder = 0; | |
for (int i = binVal.length() - 1; i >= 0; i--) { | |
if (binVal.charAt(i) == '0') { | |
sb.insert(0, '1'); | |
remainder = 1; | |
} else if (i > 0) { | |
sb.insert(0, '0'); | |
remainder = 0; |
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
private static String add1(String binVal) { | |
StringBuilder sb = new StringBuilder(); | |
int remainder = 0; | |
for (int i = binVal.length() - 1; i >= 0; i--) { | |
if (binVal.charAt(i) == '1') { | |
sb.insert(0, '0'); | |
remainder = 1; | |
} else { | |
sb.insert(0, '1'); | |
remainder = 0; |
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
private static String numToBin(String num) { | |
BigInteger bi = new BigInteger(num); | |
byte[] val = bi.toByteArray(); | |
StringBuilder sb = new StringBuilder(); | |
for (byte b: val) { | |
sb.append(String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0')); | |
} | |
sb.toString(); | |
} |
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
@Configuration | |
public class FeatureTogglingBeans { | |
@Bean | |
@ConditionalOnProperty( | |
name = "feature.version", | |
havingValue = "v1", | |
matchIfMissing = true) | |
public SampleService sampleService() { | |
return new DefaultSampleService(); |
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
variables: | |
VERSION: $CI_COMMIT_SHORT_SHA | |
image: kubectl-image | |
stages: | |
- Apply QA | |
- Redeploy QA | |
- Apply Stage | |
- Redeploy Stage |
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
@ConfigurationProperties(prefix = "feature") | |
public class ConfigProperties { | |
private String firstFeatureVersion; | |
private String secondFeatureVersion; | |
// getters and setters | |
} |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: ${CI_PROJECT_NAME}-deployment | |
namespace: ${NAMESPACE} | |
spec: | |
replicas: ${REPLICA} | |
selector: | |
matchLabels: | |
app: ${CI_PROJECT_NAME} |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: ${CI_PROJECT_NAME}-config | |
namespace: namespace | |
data: | |
FEATURE_TOGGLE_NOTIFICATION: 'false' | |
VERSION_DOCUMENT_UPLOAD: 'v2' |
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
@ExtendWith(SpringExtension.class) | |
@WebMvcTest(TestController.class) | |
class TestControllerTest { | |
@Autowired | |
private MockMvc mockMvc; | |
@Test | |
void it_should_get_test_message() throws Exception { | |
//Given |
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
<plugin> | |
<groupId>org.jacoco</groupId> | |
<artifactId>jacoco-maven-plugin</artifactId> | |
<version>0.8.5</version> | |
<executions> | |
<execution> | |
<id>pre-test</id> | |
<goals> | |
<goal>prepare-agent</goal> | |
</goals> |
NewerOlder