Skip to content

Instantly share code, notes, and snippets.

@1UC1F3R616
Last active July 26, 2024 11:55
Show Gist options
  • Save 1UC1F3R616/232f0298c80f04102c93f7cf3afa7172 to your computer and use it in GitHub Desktop.
Save 1UC1F3R616/232f0298c80f04102c93f7cf3afa7172 to your computer and use it in GitHub Desktop.
scrape-book

Must be one of the following:

feat: A new feature. fix: A bug fix. docs: Documentation only changes. style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). refactor: A code change that neither fixes a bug nor adds a feature. perf: A code change that improves performance. test: Adding missing tests. chore: Changes to the build process or auxiliary tools and libraries such as documentation generation.

Initial commit πŸŽ‰ πŸŽ‰

New feature ✨ ✨

Bugfix πŸ› πŸ›

Documentation πŸ“š πŸ“š

Performance 🐎 🐎

Tests 🚨 🚨

Refactor code πŸ”¨ πŸ”¨

Removing code/files πŸ”₯ πŸ”₯

Adding CI build system πŸ‘· πŸ‘·

Security πŸ”’ πŸ”’

Upgrading dependencies ⬆️ ⬆️

Downgrading dependencies ⬇️ ⬇️

Critical hotfix πŸš‘ πŸš‘

Work in progress 🚧 🚧

Lint πŸ‘• πŸ‘•

Configuration files πŸ”§ πŸ”§

@1UC1F3R616
Copy link
Author

Managed and optimized infrastructure and Backend APIs for a Marketplace serving 4000+ tutors and coaching institutes, ensuring high availability and scalability.

Enhanced database query performance and reliability through the implementation of batch processing in Python and GoLang, resulting in optimized data processing efficiency.

Implemented caching with Redis, substantially reducing the load on the database and enhancing overall performance.

Built an OCR and integrated it with Quiz APIs using Python, GoLang, and AWS Lambda, enhancing the platform's functionality and user experience.

Established Jenkins pipelines to orchestrate automatic builds and deployments within Docker and Kubernetes environments, ensuring seamless continuous integration and delivery workflows.

Leveraged H3 hexagonal grid indexing to meticulously map communities, elevating spatial analysis precision and efficiency.

Seamlessly integrated Mapbox with React for dynamic visualization of geographic regions, enhancing user engagement and navigational clarity.

Employed Mux APIs, using Golang, for seamless video transcoding, dynamically optimizing multimedia content delivery for livestreaming and displaying shorts in both mobile and web applications.

Integrated Amazon S3 for scalable video storage, complemented by a pub-sub mechanism using AWS SNS for efficient notification and processing when adding videos to S3.

Spearheaded the development of k6 load testing strategies and crafted data processing scripts in Python.

Integrated Stripe payment gateway to facilitate secure and efficient online transactions.

Implemented Sentry for real-time error monitoring and proactive issue resolution, ensuring high application reliability.

@1UC1F3R616
Copy link
Author

FROM tomcat:8
WORKDIR /usr/local/tomcat/webapps/
ADD https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war ./sample.war
EXPOSE 8080
CMD ["catalina.sh", "run"]

@1UC1F3R616
Copy link
Author

docker run -itd -p 8080:8080 tomcat:1
curl localhost:8080

@1UC1F3R616
Copy link
Author

@ExtendWith(MockitoExtension.class)
public class NotAllNullParametersValidatorTest {

    @Mock
    private NotAllNullParameters constraintAnnotation;

    @Mock
    private ConstraintValidatorContext context;

    @Mock
    private ConstraintValidatorContext.ConstraintViolationBuilder constraintViolationBuilder;

    private NotAllNullParametersValidator validator;

    @BeforeEach
    public void setup() throws NoSuchFieldException, IllegalAccessException {
        validator = new NotAllNullParametersValidator();
        when(context.buildConstraintViolationWithTemplate(anyString())).thenReturn(constraintViolationBuilder);
        when(constraintViolationBuilder.addConstraintViolation()).thenReturn(context); // Return the context for chaining
        
        // Inject the mocked paramNames to avoid NullPointerException
        String[] paramNames = {"param1", "param2"};
        Field paramNamesField = NotAllNullParametersValidator.class.getDeclaredField("paramNames");
        paramNamesField.setAccessible(true);
        paramNamesField.set(validator, paramNames);

        validator.initialize(constraintAnnotation);
    }

    @Test
    public void testAllNullValues() {
        Object[] values = {null, null};
        assertFalse(validator.isValid(values, context));
    }

    @Test
    public void testNullValuesArray() {
        assertThrows(IllegalArgumentException.class, () -> validator.isValid(null, context));
    }

    @Test
    public void testInvalidValuesLength() {
        Object[] values = {"value1"}; // Less than the number of parameters
        assertThrows(IllegalArgumentException.class, () -> validator.isValid(values, context));
    }

    @Test
    public void testBooleanFalseValue() {
        Object[] values = {false, null};
        assertFalse(validator.isValid(values, context));
    }
    
    @Test
    public void testOneValueNonNull() {
        Object[] values = {"value1", null};
        assertTrue(validator.isValid(values, context));
    }

    @Test
    public void testBooleanTrueValue() {
        Object[] values = {true, null};
        assertTrue(validator.isValid(values, context));
    }

    @Test
    public void testAllNonNullValues() {
        Object[] values = {"value1", 2};
        assertTrue(validator.isValid(values, context));
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment